diff options
author | hut <hut@lepus.uberspace.de> | 2016-05-24 15:43:24 +0200 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2016-05-24 15:44:14 +0200 |
commit | e01bf0062ad29f356878985a813b47ec86966803 (patch) | |
tree | c1e569bdedb07be83f4fbfea82726967280cb2c9 /ranger | |
parent | 94dc91e291ef666d091966ed664407bb0911e06e (diff) | |
download | ranger-e01bf0062ad29f356878985a813b47ec86966803.tar.gz |
merge setting "relative_line_numbers" into "line_numbers"
line_numbers now takes a string rather than a bool, with the valid values "false", "absolute" and "relative". Related to #546
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/config/rc.conf | 1 | ||||
-rw-r--r-- | ranger/container/settings.py | 4 | ||||
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 6 |
3 files changed, 5 insertions, 6 deletions
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index cf07b232..ea3a812c 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -203,7 +203,6 @@ set clear_filters_on_dir_change false # Disable displaying line numbers in main column set line_numbers false -set relative_line_numbers false # =================================================================== # == Local Options diff --git a/ranger/container/settings.py b/ranger/container/settings.py index be468c21..85729907 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -26,7 +26,7 @@ ALLOWED_SETTINGS = { 'flushinput': bool, 'hidden_filter': str, 'idle_delay': int, - 'line_numbers': bool, + 'line_numbers': str, 'max_console_history_size': (int, type(None)), 'max_history_size': (int, type(None)), 'metadata_deep_search': bool, @@ -39,7 +39,6 @@ ALLOWED_SETTINGS = { 'preview_images_method': str, 'preview_max_size': int, 'preview_script': (str, type(None)), - 'relative_line_numbers': bool, 'save_console_history': bool, 'scroll_offset': int, 'shorten_title': int, @@ -70,6 +69,7 @@ ALLOWED_SETTINGS = { ALLOWED_VALUES = { 'confirm_on_delete': ['always', 'multiple', 'never'], + 'line_numbers': ['false', 'absolute', 'relative'], 'preview_images_method': ['w3m', 'iterm2'], 'vcs_backend_bzr': ['enabled', 'local', 'disabled'], 'vcs_backend_git': ['enabled', 'local', 'disabled'], diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 964f000a..229c0345 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -193,7 +193,7 @@ class BrowserColumn(Pager): def _format_line_number(self, linum_format, i, selected_i): line_number = i - if self.settings.relative_line_numbers: + if self.settings.line_numbers == 'relative': line_number = abs(selected_i - i) if line_number == 0: line_number = selected_i @@ -299,7 +299,7 @@ class BrowserColumn(Pager): # For (2) we could add self.settings.relative_line_numbers to # key, but we still require a conditional check here for (1), # and it solves both problems at the same time. - if self.main_column and self.settings.line_numbers: + if self.main_column and self.settings.line_numbers != 'false': line_number_text = self._format_line_number(linum_format, i, selected_i) @@ -324,7 +324,7 @@ class BrowserColumn(Pager): space = self.wid # line number field - if self.settings.line_numbers: + if self.settings.line_numbers != 'false': if self.main_column and space - linum_text_len > 2: line_number_text = self._format_line_number(linum_format, i, |