summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/actions.py2
-rw-r--r--ranger/core/environment.py3
-rw-r--r--ranger/defaults/keys.py6
-rw-r--r--ranger/defaults/options.py6
-rw-r--r--ranger/fsobject/directory.py32
-rw-r--r--ranger/shared/settings.py20
6 files changed, 43 insertions, 26 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index c4d82e58..6f2b8606 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -315,7 +315,7 @@ class Actions(EnvironmentAware, SettingsAware):
 
 	def sort(self, func=None, reverse=None):
 		if reverse is not None:
-			self.env.settings['reverse'] = bool(reverse)
+			self.env.settings['sort_reverse'] = bool(reverse)
 
 		if func is not None:
 			self.env.settings['sort'] = str(func)
diff --git a/ranger/core/environment.py b/ranger/core/environment.py
index a30b8dcd..74b4f718 100644
--- a/ranger/core/environment.py
+++ b/ranger/core/environment.py
@@ -186,7 +186,8 @@ class Environment(SettingsAware):
 		self.assign_cursor_positions_for_subdirs()
 
 		# set the current file.
-		self.cwd.directories_first = self.settings.directories_first
+		self.cwd.sort_directories_first = self.settings.sort_directories_first
+		self.cwd.sort_reverse = self.settings.sort_reverse
 		self.cwd.sort_if_outdated()
 		self.cf = self.cwd.pointed_obj
 
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index e021a90e..f34c4372 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -113,9 +113,9 @@ def initialize_commands(map):
 	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('bd', fm.toggle_boolean_option('sort_directories_first'))
 	map('bc', fm.toggle_boolean_option('collapse_preview'))
-	map('bs', fm.toggle_boolean_option('case_insensitive'))
+	map('bs', fm.toggle_boolean_option('sort_case_insensitive'))
 
 	# ------------------------------------------------------------ sort
 	map('o', 'O', hint="//s//ize //b//ase//n//ame //m//time //t//ype //r//everse")
@@ -134,7 +134,7 @@ def initialize_commands(map):
 			map('O' + key, fm.sort(func=val, reverse=True))
 
 	map('or', 'Or', 'oR', 'OR', lambda arg: \
-			arg.fm.sort(reverse=not arg.fm.settings.reverse))
+			arg.fm.sort(reverse=not arg.fm.settings.sort_reverse))
 
 	# ----------------------------------------------- console shortcuts
 	@map("A")
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py
index b959fa75..ace68592 100644
--- a/ranger/defaults/options.py
+++ b/ranger/defaults/options.py
@@ -81,7 +81,7 @@ show_cursor = False
 
 # One of: size, basename, mtime, type
 sort = 'basename'
-reverse = False
-case_insensitive = False
-directories_first = True
+sort_reverse = False
+sort_case_insensitive = False
+sort_directories_first = True
 
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py
index b0a93893..ef9d04ff 100644
--- a/ranger/fsobject/directory.py
+++ b/ranger/fsobject/directory.py
@@ -59,8 +59,8 @@ class Directory(FileSystemObject, Accumulator, SettingsAware):
 	load_content_mtime = -1
 
 	old_show_hidden = None
-	old_directories_first = None
-	old_reverse = None
+	old_sort_directories_first = None
+	old_sort_reverse = None
 	old_sort = None
 	old_filter = None
 	old_hidden_filter = None
@@ -85,12 +85,12 @@ class Directory(FileSystemObject, Accumulator, SettingsAware):
 
 		# to find out if something has changed:
 		self.old_show_hidden = self.settings.show_hidden
-		self.old_directories_first = self.settings.directories_first
+		self.old_sort_directories_first = self.settings.sort_directories_first
 		self.old_sort = self.settings.sort
 		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
+		self.old_sort_reverse = self.settings.sort_reverse
+		self.old_sort_case_insensitive = self.settings.sort_case_insensitive
 
 	def get_list(self):
 		return self.files
@@ -208,7 +208,7 @@ class Directory(FileSystemObject, Accumulator, SettingsAware):
 					else:
 						self.mark_item(item, False)
 
-				self.old_directories_first = None
+				self.old_sort_directories_first = None
 				self.sort()
 
 				if len(self.files) > 0:
@@ -271,16 +271,16 @@ class Directory(FileSystemObject, Accumulator, SettingsAware):
 		except:
 			sort_func = sort_by_basename
 
-		if self.settings.case_insensitive and \
+		if self.settings.sort_case_insensitive and \
 				sort_func == sort_by_basename:
 			sort_func = sort_by_basename_icase
 
 		self.files.sort(key = sort_func)
 
-		if self.settings.reverse:
+		if self.settings.sort_reverse:
 			self.files.reverse()
 
-		if self.settings.directories_first:
+		if self.settings.sort_directories_first:
 			self.files.sort(key = sort_by_directory)
 
 		if self.pointer is not None:
@@ -288,17 +288,19 @@ class Directory(FileSystemObject, Accumulator, SettingsAware):
 		else:
 			self.correct_pointer()
 
-		self.old_directories_first = self.settings.directories_first
+		self.old_sort_directories_first = self.settings.sort_directories_first
 		self.old_sort = self.settings.sort
-		self.old_reverse = self.settings.reverse
-		self.old_case_insensitive = self.settings.case_insensitive
+		self.old_sort_reverse = self.settings.sort_reverse
+		self.old_case_insensitive = self.settings.sort_case_insensitive
 
 	def sort_if_outdated(self):
 		"""Sort the containing files if they are outdated"""
-		if self.old_directories_first != self.settings.directories_first \
+		if self.old_sort_directories_first != \
+				self.settings.sort_directories_first \
 				or self.old_sort != self.settings.sort \
-				or self.old_reverse != self.settings.reverse \
-				or self.old_case_insensitive != self.settings.case_insensitive:
+				or self.old_sort_reverse != self.settings.sort_reverse \
+				or self.old_case_insensitive != \
+				self.settings.sort_case_insensitive:
 			self.sort()
 			return True
 		return False
diff --git a/ranger/shared/settings.py b/ranger/shared/settings.py
index a4ca8df5..e53f31b0 100644
--- a/ranger/shared/settings.py
+++ b/ranger/shared/settings.py
@@ -28,9 +28,9 @@ ALLOWED_SETTINGS = {
 	'draw_borders': bool,
 	'draw_bookmark_borders': bool,
 	'sort': str,
-	'reverse': bool,
-	'case_insensitive': bool,
-	'directories_first': bool,
+	'sort_reverse': bool,
+	'sort_case_insensitive': bool,
+	'sort_directories_first': bool,
 	'update_title': bool,
 	'shorten_title': int,  # Note: False is an instance of int
 	'max_filesize_for_preview': (int, type(None)),
@@ -43,6 +43,11 @@ ALLOWED_SETTINGS = {
 	'hidden_filter': lambda x: isinstance(x, str) or hasattr(x, 'match'),
 }
 
+COMPAT_MAP = {
+	'sort_reverse': 'reverse',
+	'sort_directories_first': 'directories_first',
+}
+
 # -- globalize the settings --
 class SettingsAware(object):
 	settings = OpenStruct()
@@ -72,6 +77,15 @@ class SettingsAware(object):
 						settings[setting] = getattr(my_options, setting)
 					except AttributeError:
 						pass
+				for new, old in COMPAT_MAP.items():
+					try:
+						settings[new] = getattr(my_options, old)
+						print("Warning: the option `{0}'"\
+								" was renamed to `{1}'\nPlease update"\
+								" your configuration file soon." \
+								.format(old, new))
+					except AttributeError:
+						pass
 
 		assert check_option_types(settings)