summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/defaults/keys.py3
-rw-r--r--ranger/defaults/options.py1
-rw-r--r--ranger/fsobject/directory.py14
-rw-r--r--ranger/shared/settings.py1
4 files changed, 17 insertions, 2 deletions
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index bdafb4af..e021a90e 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -108,13 +108,14 @@ def initialize_commands(map):
 
 	# -------------------------------------------------- toggle options
 	map('b', hint="show_//h//idden //p//review_files //d//irectories_first " \
-		"//c//ollapse_preview flush//i//nput")
+		"//c//ollapse_preview flush//i//nput ca//s//e_insensitive")
 	map('bh', fm.toggle_boolean_option('show_hidden'))
 	map('bp', fm.toggle_boolean_option('preview_files'))
 	map('bP', fm.toggle_boolean_option('preview_directories'))
 	map('bi', fm.toggle_boolean_option('flushinput'))
 	map('bd', fm.toggle_boolean_option('directories_first'))
 	map('bc', fm.toggle_boolean_option('collapse_preview'))
+	map('bs', fm.toggle_boolean_option('case_insensitive'))
 
 	# ------------------------------------------------------------ sort
 	map('o', 'O', hint="//s//ize //b//ase//n//ame //m//time //t//ype //r//everse")
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py
index a7090285..e41faf2f 100644
--- a/ranger/defaults/options.py
+++ b/ranger/defaults/options.py
@@ -81,5 +81,6 @@ show_cursor = False
 # One of: size, basename, mtime, type
 sort = 'basename'
 reverse = False
+case_insensitive = False
 directories_first = True
 
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py
index 8bb8a78a..3ef897e0 100644
--- a/ranger/fsobject/directory.py
+++ b/ranger/fsobject/directory.py
@@ -27,6 +27,10 @@ def sort_by_basename(path):
 	"""returns path.basename (for sorting)"""
 	return path.basename
 
+def sort_by_basename_icase(path):
+	"""returns case-insensitive path.basename (for sorting)"""
+	return path.basename.lower()
+
 def sort_by_directory(path):
 	"""returns 0 if path is a directory, otherwise 1 (for sorting)"""
 	return 1 - int( isinstance( path, Directory ) )
@@ -86,6 +90,7 @@ class Directory(FileSystemObject, Accumulator, SettingsAware):
 		self.old_filter = self.filter
 		self.old_hidden_filter = self.settings.hidden_filter
 		self.old_reverse = self.settings.reverse
+		self.old_case_insensitive = self.settings.case_insensitive
 
 	def get_list(self):
 		return self.files
@@ -265,6 +270,11 @@ class Directory(FileSystemObject, Accumulator, SettingsAware):
 			sort_func = self.sort_dict[self.settings.sort]
 		except:
 			sort_func = sort_by_basename
+
+		if self.settings.case_insensitive and \
+				sort_func == sort_by_basename:
+			sort_func = sort_by_basename_icase
+
 		self.files.sort(key = sort_func)
 
 		if self.settings.reverse:
@@ -281,12 +291,14 @@ class Directory(FileSystemObject, Accumulator, SettingsAware):
 		self.old_directories_first = self.settings.directories_first
 		self.old_sort = self.settings.sort
 		self.old_reverse = self.settings.reverse
+		self.old_case_insensitive = self.settings.case_insensitive
 
 	def sort_if_outdated(self):
 		"""Sort the containing files if they are outdated"""
 		if self.old_directories_first != self.settings.directories_first \
 				or self.old_sort != self.settings.sort \
-				or self.old_reverse != self.settings.reverse:
+				or self.old_reverse != self.settings.reverse \
+				or self.old_case_insensitive != self.settings.case_insensitive:
 			self.sort()
 			return True
 		return False
diff --git a/ranger/shared/settings.py b/ranger/shared/settings.py
index cdddd623..991f77d2 100644
--- a/ranger/shared/settings.py
+++ b/ranger/shared/settings.py
@@ -28,6 +28,7 @@ ALLOWED_SETTINGS = {
 	'draw_borders': bool,
 	'sort': str,
 	'reverse': bool,
+	'case_insensitive': bool,
 	'directories_first': bool,
 	'update_title': bool,
 	'shorten_title': int,  # Note: False is an instance of int
rix/lynx-snapshots/blame/src/LYrcFile.h?id=0cb11571ef3a2820a888b47eaa0ea3083e3b9b0f'>^
90d33dc9 ^








f6e997b7 ^
90d33dc9 ^



























f6e997b7 ^
90d33dc9 ^

f6e997b7 ^
90d33dc9 ^





































0cb11571 ^
90d33dc9 ^
f6e997b7 ^

90d33dc9 ^





50f9f94b ^
90d33dc9 ^

























f6e997b7 ^

90d33dc9 ^

f6e997b7 ^

90d33dc9 ^


f6e997b7 ^

90d33dc9 ^







f6e997b7 ^
90d33dc9 ^






f6e997b7 ^

90d33dc9 ^
d1349dd6 ^
6bbc5d0b ^
d1349dd6 ^




90d33dc9 ^
d1349dd6 ^
90d33dc9 ^
d1349dd6 ^
90d33dc9 ^
4525eb4b ^
d1349dd6 ^
e087f6d4

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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248