summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-05-26 03:34:08 +0200
committerhut <hut@lavabit.com>2010-05-26 03:34:08 +0200
commitb4f7187f0e05495c2cf902a367f14002d5e50821 (patch)
tree2fbfc200e9eed48a470e3e528a47b797667a7fde
parent1e5adcd713e5c0ed960a924e49958af7aec34759 (diff)
downloadranger-b4f7187f0e05495c2cf902a367f14002d5e50821.tar.gz
defaults.keys: added key ^V for marking files in a specific direction
-rw-r--r--TODO1
-rw-r--r--ranger/core/actions.py10
-rw-r--r--ranger/defaults/keys.py2
-rw-r--r--ranger/ext/direction.py2
-rw-r--r--ranger/help/movement.py5
5 files changed, 18 insertions, 2 deletions
diff --git a/TODO b/TODO
index d2aac406..1e02251c 100644
--- a/TODO
+++ b/TODO
@@ -87,6 +87,7 @@ Bugs
    (X) #87  10/05/10  files are not properly closed after previewing
    ( ) #88  10/05/10  race conditions for data loading from FS
    (X) #90  10/05/11  no link target for broken links
+   ( ) #94  10/05/26  "pressed keys" text cut off when chaining ctrl-XYZ keys
 
 
 Ideas
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 69fbf32f..14f862c7 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -273,6 +273,16 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 		if hasattr(self.ui, 'status'):
 			self.ui.status.need_redraw = True
 
+	def mark_in_direction(self, val=True, dirarg=None):
+		cwd = self.env.cwd
+		direction = Direction(dirarg)
+		pos, selected = direction.select(lst=cwd.files, current=cwd.pointer,
+				pagesize=self.env.termsize[0])
+		cwd.pointer = pos
+		cwd.correct_pointer()
+		for item in selected:
+			cwd.mark_item(item, val)
+
 	# --------------------------
 	# -- Searching
 	# --------------------------
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index 59b45f8e..c95baed9 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -163,6 +163,8 @@ map('T', fm.tag_remove())
 map(' ', fm.mark(toggle=True))
 map('v', fm.mark(all=True, toggle=True))
 map('V', 'uv', fm.mark(all=True, val=False))
+map('<C-V><dir>', fm.mark_in_direction(val=True))
+map('u<C-V><dir>', fm.mark_in_direction(val=False))
 
 # ------------------------------------------ file system operations
 map('yy', 'y<dir>', fm.copy())
diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py
index b9fbcac9..f36e22a6 100644
--- a/ranger/ext/direction.py
+++ b/ranger/ext/direction.py
@@ -134,7 +134,7 @@ class Direction(dict):
 			pos += current
 		return int(max(min(pos, maximum + offset - 1), minimum))
 
-	def select(self, lst, override, current, pagesize, offset=1):
+	def select(self, lst, current, pagesize, override=None, offset=1):
 		dest = self.move(direction=self.down(), override=override,
 			current=current, pagesize=pagesize, minimum=0, maximum=len(lst))
 		selection = lst[min(current, dest):max(current, dest) + offset]
diff --git a/ranger/help/movement.py b/ranger/help/movement.py
index 3287e9bb..3abec359 100644
--- a/ranger/help/movement.py
+++ b/ranger/help/movement.py
@@ -96,7 +96,10 @@ of the file you're pointing at.
 
 	<Space> mark a file
 	v	toggle all marks
-	V	remove all marks
+	V, uv	remove all marks
+	^V	mark files in a specific direction
+		e.g. ^Vgg marks all files from the current to the top
+	u^V	unmark files in a specific direction
 
 By "tagging" files, you can highlight them and mark them to be
 special in whatever context you want.  Tags are persistent across sessions.
22:16:24 -0700 committer Kartik K. Agaram <vc@akkartik.com> 2016-04-13 22:16:24 -0700 2832 - support static arrays in rewrite_stash' href='/akkartik/mu/commit/071rewrite_stash.cc?h=hlt&id=8e60380e8c7e84d4e650b73b4499ca29c3d9732d'>8e60380e ^
d57bf669 ^



3473c63a ^
8e60380e ^



dad3bedd ^























8d72e565 ^
dad3bedd ^

c43b455d ^
dad3bedd ^







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165