From 48945a6d34cfd5ec9ca67be813b6fccfc0a1dfdf Mon Sep 17 00:00:00 2001 From: squigz Date: Wed, 3 Jan 2018 13:49:40 -0500 Subject: Add option to draw separators between columns instead of drawing boxes --- ranger/container/settings.py | 1 + ranger/gui/widgets/view_miller.py | 46 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/ranger/container/settings.py b/ranger/container/settings.py index 2f38a2b6..1dc61046 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -40,6 +40,7 @@ ALLOWED_SETTINGS = { 'display_size_in_status_bar': bool, 'display_tags_in_all_columns': bool, 'draw_borders': bool, + 'draw_separators': bool, 'draw_progress_bar_in_status_bar': bool, 'flushinput': bool, 'freeze_files': bool, diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index 1f08e1af..209978ec 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -100,6 +100,8 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta DisplayableContainer.draw(self) if self.settings.draw_borders: self._draw_borders() + if self.settings.draw_separators: + self._draw_separators() if self.draw_bookmarks: self._draw_bookmarks() elif self.draw_hints: @@ -173,6 +175,50 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta self.addch(self.hei - 1, right_end, curses.ACS_LRCORNER) # pylint: enable=no-member + def _draw_separators(self): + win = self.win + separators = self.settings.draw_separators + self.color('in_browser', 'border') + + left_start = 0 + right_end = self.wid - 1 + + for child in self.columns: + if not child.has_preview(): + left_start = child.x + child.wid + else: + break + + # Shift the rightmost vertical line to the left to create a padding, + # but only when padding_right is on, the preview column is collapsed + # and we did not open the pager to "zoom" in to the file. + if self.settings.padding_right and not self.pager.visible and self.is_collapsed: + right_end = self.columns[-1].x - 1 + if right_end < left_start: + right_end = self.wid - 1 + + + # Draw the vertical lines in the middle + for child in self.columns[:-1]: + if not child.has_preview(): + continue + if child.main_column and self.pager.visible: + # If we "zoom in" with the pager, we have to + # skip the between main_column and pager. + break + x = child.x + child.wid + y = self.hei - 1 + try: + # pylint: disable=no-member + win.vline(1, x, curses.ACS_VLINE, y - 1) + self.addch(0, x, curses.ACS_VLINE, 0) + self.addch(y, x, curses.ACS_VLINE, 0) + # pylint: enable=no-member + except curses.error: + # in case it's off the boundaries + pass + + def _collapse(self): # Should the last column be cut off? (Because there is no preview) if not self.settings.collapse_preview or not self.preview \ -- cgit 1.4.1-2-gfad0 From ab34ebb150b0741f52f7f84df08c10c3a2201f51 Mon Sep 17 00:00:00 2001 From: squigz Date: Thu, 4 Jan 2018 07:17:42 -0500 Subject: Add 'draw_separators' option to rc.conf --- ranger/config/rc.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index 6bb8f0d0..b6d4702c 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -126,6 +126,9 @@ set draw_progress_bar_in_status_bar true # Draw borders around columns? set draw_borders false +# Draw veritcal separators between columns? +set draw_borders false + # Display the directory name in tabs? set dirname_in_tabs false -- cgit 1.4.1-2-gfad0 From efbbdac00f1ca71615ae83e4f3a9899620454d07 Mon Sep 17 00:00:00 2001 From: squigz Date: Thu, 4 Jan 2018 07:19:44 -0500 Subject: Update manpage with 'draw_separator' setting --- doc/ranger.1 | 5 ++++- doc/ranger.pod | 4 ++++ doc/rifle.1 | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/ranger.1 b/doc/ranger.1 index bb7114a2..39a9c051 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -.TH RANGER 1 "ranger-1.9.0b6" "12/07/2017" "ranger manual" +.TH RANGER 1 "ranger-1.9.0b6" "01/04/2018" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -769,6 +769,9 @@ Display tags in all columns? .IP "draw_borders [bool]" 4 .IX Item "draw_borders [bool]" Draw borders around columns? +.IP "draw_separators [bool]" 4 +.IX Item "draw_separators [bool]" +Draw vertical separators between columns? .IP "draw_progress_bar_in_status_bar [bool]" 4 .IX Item "draw_progress_bar_in_status_bar [bool]" Draw a progress bar in the status bar which displays the average state of all diff --git a/doc/ranger.pod b/doc/ranger.pod index 43926f46..76d879d4 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -759,6 +759,10 @@ Display tags in all columns? Draw borders around columns? +=item draw_separators [bool] + +Draw vertical separators between columns? + =item draw_progress_bar_in_status_bar [bool] Draw a progress bar in the status bar which displays the average state of all diff --git a/doc/rifle.1 b/doc/rifle.1 index 8531d69c..753b3c3c 100644 --- a/doc/rifle.1 +++ b/doc/rifle.1 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "RIFLE 1" -.TH RIFLE 1 "rifle-1.9.0b6" "12/07/2017" "rifle manual" +.TH RIFLE 1 "rifle-1.9.0b6" "01/04/2018" "rifle manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l -- cgit 1.4.1-2-gfad0 From f8e37d8bc41b172d8d845cc7cca7a2d85109061c Mon Sep 17 00:00:00 2001 From: squigz Date: Thu, 4 Jan 2018 14:28:02 -0500 Subject: Fix draw_separators setting in rc.conf --- ranger/config/rc.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index b6d4702c..d5c4ba66 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -127,7 +127,7 @@ set draw_progress_bar_in_status_bar true set draw_borders false # Draw veritcal separators between columns? -set draw_borders false +set draw_separators false # Display the directory name in tabs? set dirname_in_tabs false -- cgit 1.4.1-2-gfad0 From 08fbe46b0237137d7c5aadead2882d6a826cddf7 Mon Sep 17 00:00:00 2001 From: squigz Date: Thu, 4 Jan 2018 14:36:22 -0500 Subject: Remove _draw_separators and integrate with _draw_borders with the `separators_only` argument --- ranger/gui/widgets/view_miller.py | 90 +++++++++++---------------------------- 1 file changed, 26 insertions(+), 64 deletions(-) diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index 209978ec..721f2d1f 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -101,7 +101,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta if self.settings.draw_borders: self._draw_borders() if self.settings.draw_separators: - self._draw_separators() + self._draw_borders(separators_only=True) if self.draw_bookmarks: self._draw_bookmarks() elif self.draw_hints: @@ -109,9 +109,10 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta elif self.draw_info: self._draw_info(self.draw_info) - def _draw_borders(self): + def _draw_borders(self, separators_only=False): win = self.win self.color('in_browser', 'border') + separators = separators_only left_start = 0 right_end = self.wid - 1 @@ -131,14 +132,15 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta right_end = self.wid - 1 # Draw horizontal lines and the leftmost vertical line - try: - # pylint: disable=no-member - win.hline(0, left_start, curses.ACS_HLINE, right_end - left_start) - win.hline(self.hei - 1, left_start, curses.ACS_HLINE, right_end - left_start) - win.vline(1, left_start, curses.ACS_VLINE, self.hei - 2) - # pylint: enable=no-member - except curses.error: - pass + if not separators: + try: + # pylint: disable=no-member + win.hline(0, left_start, curses.ACS_HLINE, right_end - left_start) + win.hline(self.hei - 1, left_start, curses.ACS_HLINE, right_end - left_start) + win.vline(1, left_start, curses.ACS_VLINE, self.hei - 2) + # pylint: enable=no-member + except curses.error: + pass # Draw the vertical lines in the middle for child in self.columns[:-1]: @@ -153,71 +155,31 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta try: # pylint: disable=no-member win.vline(1, x, curses.ACS_VLINE, y - 1) - self.addch(0, x, curses.ACS_TTEE, 0) - self.addch(y, x, curses.ACS_BTEE, 0) + char = curses.ACS_TTEE if not separators else curses.ACS_VLINE + self.addch(0, x, char, 0) + char = curses.ACS_BTEE if not separators else curses.ACS_VLINE + self.addch(y, x, char, 0) # pylint: enable=no-member except curses.error: # in case it's off the boundaries pass - # Draw the last vertical line - try: - # pylint: disable=no-member - win.vline(1, right_end, curses.ACS_VLINE, self.hei - 2) - # pylint: enable=no-member - except curses.error: - pass - - # pylint: disable=no-member - self.addch(0, left_start, curses.ACS_ULCORNER) - self.addch(self.hei - 1, left_start, curses.ACS_LLCORNER) - self.addch(0, right_end, curses.ACS_URCORNER) - self.addch(self.hei - 1, right_end, curses.ACS_LRCORNER) - # pylint: enable=no-member - - def _draw_separators(self): - win = self.win - separators = self.settings.draw_separators - self.color('in_browser', 'border') - - left_start = 0 - right_end = self.wid - 1 - - for child in self.columns: - if not child.has_preview(): - left_start = child.x + child.wid - else: - break - - # Shift the rightmost vertical line to the left to create a padding, - # but only when padding_right is on, the preview column is collapsed - # and we did not open the pager to "zoom" in to the file. - if self.settings.padding_right and not self.pager.visible and self.is_collapsed: - right_end = self.columns[-1].x - 1 - if right_end < left_start: - right_end = self.wid - 1 - - - # Draw the vertical lines in the middle - for child in self.columns[:-1]: - if not child.has_preview(): - continue - if child.main_column and self.pager.visible: - # If we "zoom in" with the pager, we have to - # skip the between main_column and pager. - break - x = child.x + child.wid - y = self.hei - 1 + if not separators: + # Draw the last vertical line try: # pylint: disable=no-member - win.vline(1, x, curses.ACS_VLINE, y - 1) - self.addch(0, x, curses.ACS_VLINE, 0) - self.addch(y, x, curses.ACS_VLINE, 0) + win.vline(1, right_end, curses.ACS_VLINE, self.hei - 2) # pylint: enable=no-member except curses.error: - # in case it's off the boundaries pass + if not separators: + # pylint: disable=no-member + self.addch(0, left_start, curses.ACS_ULCORNER) + self.addch(self.hei - 1, left_start, curses.ACS_LLCORNER) + self.addch(0, right_end, curses.ACS_URCORNER) + self.addch(self.hei - 1, right_end, curses.ACS_LRCORNER) + # pylint: enable=no-member def _collapse(self): # Should the last column be cut off? (Because there is no preview) -- cgit 1.4.1-2-gfad0 From bbb01f5e3e6bb86d4842db1e22f918dc0b06a40f Mon Sep 17 00:00:00 2001 From: squigz Date: Thu, 4 Jan 2018 16:05:44 -0500 Subject: Changes draw_borders setting to a string Allows drawing vertical separators between columns, borders around all the columns, both of the two, or none --- ranger/config/rc.conf | 7 ++--- ranger/container/settings.py | 3 +- ranger/gui/widgets/view_miller.py | 65 ++++++++++++++++++++------------------- 3 files changed, 37 insertions(+), 38 deletions(-) diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index d5c4ba66..5f5f182a 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -123,11 +123,8 @@ set status_bar_on_top false # currently running tasks which support progress bars? set draw_progress_bar_in_status_bar true -# Draw borders around columns? -set draw_borders false - -# Draw veritcal separators between columns? -set draw_separators false +# Draw borders around columns? (separators, borders, both, or none. Separators are vertical lines between columsn. Borders are around the entire columns. Both combines the two) +set draw_borders none # Display the directory name in tabs? set dirname_in_tabs false diff --git a/ranger/container/settings.py b/ranger/container/settings.py index 1dc61046..583616b5 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -39,7 +39,7 @@ ALLOWED_SETTINGS = { 'display_size_in_main_column': bool, 'display_size_in_status_bar': bool, 'display_tags_in_all_columns': bool, - 'draw_borders': bool, + 'draw_borders': str, 'draw_separators': bool, 'draw_progress_bar_in_status_bar': bool, 'flushinput': bool, @@ -97,6 +97,7 @@ ALLOWED_SETTINGS = { ALLOWED_VALUES = { 'cd_tab_case': ['sensitive', 'insensitive', 'smart'], 'confirm_on_delete': ['multiple', 'always', 'never'], + 'draw_borders': ['None', 'both', 'outline', 'separators'], 'line_numbers': ['false', 'absolute', 'relative'], 'one_indexed': [False, True], 'preview_images_method': ['w3m', 'iterm2', 'urxvt', 'urxvt-full'], diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index 721f2d1f..baf014af 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -99,9 +99,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta directory.use() DisplayableContainer.draw(self) if self.settings.draw_borders: - self._draw_borders() - if self.settings.draw_separators: - self._draw_borders(separators_only=True) + self._draw_borders(self.settings.draw_borders) if self.draw_bookmarks: self._draw_bookmarks() elif self.draw_hints: @@ -109,10 +107,13 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta elif self.draw_info: self._draw_info(self.draw_info) - def _draw_borders(self, separators_only=False): + def _draw_borders(self, string): win = self.win + + separators = 1 if string.lower() == "separators" else 0 + borders = 1 if string.lower() == "outline" else 0 + both = 1 if string.lower() == "both" else 0 self.color('in_browser', 'border') - separators = separators_only left_start = 0 right_end = self.wid - 1 @@ -132,7 +133,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta right_end = self.wid - 1 # Draw horizontal lines and the leftmost vertical line - if not separators: + if both or borders: try: # pylint: disable=no-member win.hline(0, left_start, curses.ACS_HLINE, right_end - left_start) @@ -143,28 +144,30 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta pass # Draw the vertical lines in the middle - for child in self.columns[:-1]: - if not child.has_preview(): - continue - if child.main_column and self.pager.visible: - # If we "zoom in" with the pager, we have to - # skip the between main_column and pager. - break - x = child.x + child.wid - y = self.hei - 1 - try: - # pylint: disable=no-member - win.vline(1, x, curses.ACS_VLINE, y - 1) - char = curses.ACS_TTEE if not separators else curses.ACS_VLINE - self.addch(0, x, char, 0) - char = curses.ACS_BTEE if not separators else curses.ACS_VLINE - self.addch(y, x, char, 0) - # pylint: enable=no-member - except curses.error: - # in case it's off the boundaries - pass - - if not separators: + if both or separators: + for child in self.columns[:-1]: + if not child.has_preview(): + continue + if child.main_column and self.pager.visible: + # If we "zoom in" with the pager, we have to + # skip the between main_column and pager. + break + x = child.x + child.wid + y = self.hei - 1 + try: + # pylint: disable=no-member + win.vline(1, x, curses.ACS_VLINE, y - 1) + char = curses.ACS_TTEE if both or borders else curses.ACS_VLINE + char = curses.ACS_TTEE if both or borders else curses.ACS_VLINE + self.addch(0, x, char, 0) + char = curses.ACS_BTEE if both or borders else curses.ACS_VLINE + self.addch(y, x, char, 0) + # pylint: enable=no-member + except curses.error: + # in case it's off the boundaries + pass + + if both or borders: # Draw the last vertical line try: # pylint: disable=no-member @@ -173,7 +176,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta except curses.error: pass - if not separators: + if both or borders: # pylint: disable=no-member self.addch(0, left_start, curses.ACS_ULCORNER) self.addch(self.hei - 1, left_start, curses.ACS_LLCORNER) @@ -203,10 +206,8 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta """Resize all the columns according to the given ratio""" ViewBase.resize(self, y, x, hei, wid) - borders = self.settings.draw_borders - pad = 1 if borders else 0 + pad = 1 if not self.settings.draw_borders.lower() == "none" else 0 left = pad - self.is_collapsed = self._collapse() if self.is_collapsed: generator = enumerate(self.stretch_ratios) -- cgit 1.4.1-2-gfad0 From 11ff0c35a1467e2fca59b9733acbe7b3b82045b8 Mon Sep 17 00:00:00 2001 From: squigz Date: Thu, 4 Jan 2018 16:08:42 -0500 Subject: Remove draw_separators from ALLOWED_SETTINGS --- ranger/container/settings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ranger/container/settings.py b/ranger/container/settings.py index 583616b5..f07c85a6 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -40,7 +40,6 @@ ALLOWED_SETTINGS = { 'display_size_in_status_bar': bool, 'display_tags_in_all_columns': bool, 'draw_borders': str, - 'draw_separators': bool, 'draw_progress_bar_in_status_bar': bool, 'flushinput': bool, 'freeze_files': bool, -- cgit 1.4.1-2-gfad0 From 8de67322c111e6e3c64cc2ddda829589e8c64bf9 Mon Sep 17 00:00:00 2001 From: squigz Date: Thu, 4 Jan 2018 20:09:10 -0500 Subject: Use True/False instead of 1/0 Update padding conditions to not show when draw_borders is set to separators or none --- ranger/gui/widgets/view_miller.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index baf014af..7cec3c21 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -110,9 +110,9 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta def _draw_borders(self, string): win = self.win - separators = 1 if string.lower() == "separators" else 0 - borders = 1 if string.lower() == "outline" else 0 - both = 1 if string.lower() == "both" else 0 + separators = True if string.lower() == "separators" else False + borders = True if string.lower() == "outline" else False + both = True if string.lower() == "both" else False self.color('in_browser', 'border') left_start = 0 @@ -206,7 +206,8 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta """Resize all the columns according to the given ratio""" ViewBase.resize(self, y, x, hei, wid) - pad = 1 if not self.settings.draw_borders.lower() == "none" else 0 + borders = self.settings.draw_borders.lower() + pad = 1 if borders == "outline" or borders == "both" else 0 left = pad self.is_collapsed = self._collapse() if self.is_collapsed: -- cgit 1.4.1-2-gfad0 From 16f6b5203f04e80275a0df717be70de93f1a6fb6 Mon Sep 17 00:00:00 2001 From: squigz Date: Thu, 4 Jan 2018 20:10:50 -0500 Subject: Fix rc.conf --- ranger/config/rc.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index 5f5f182a..3fd46d38 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -123,7 +123,7 @@ set status_bar_on_top false # currently running tasks which support progress bars? set draw_progress_bar_in_status_bar true -# Draw borders around columns? (separators, borders, both, or none. Separators are vertical lines between columsn. Borders are around the entire columns. Both combines the two) +# Draw borders around columns? (separators, outline, both, or none. Separators are vertical lines between columsn. Outline draws a box around all the columns. Both combines the two) set draw_borders none # Display the directory name in tabs? -- cgit 1.4.1-2-gfad0 From de45af6210e55e053504d734e058b9360e74762b Mon Sep 17 00:00:00 2001 From: squigz Date: Thu, 4 Jan 2018 20:16:37 -0500 Subject: Update manpage section on draw_borders --- doc/ranger.1 | 13 ++++++++++--- doc/ranger.pod | 9 +++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/doc/ranger.1 b/doc/ranger.1 index 39a9c051..21665bbf 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -766,9 +766,16 @@ Display the file size in the status bar? .IP "display_tags_in_all_columns [bool]" 4 .IX Item "display_tags_in_all_columns [bool]" Display tags in all columns? -.IP "draw_borders [bool]" 4 -.IX Item "draw_borders [bool]" -Draw borders around columns? +.IP "draw_borders [string]" 4 +.IX Item "draw_borders [string]" +Draw borders around or between the columns? Possible values are: +.Sp +.Vb 4 +\& none no borders of any sort +\& outline draw an outline around all the columns +\& separators draw only vertical lines between columns +\& both both of the above +.Ve .IP "draw_separators [bool]" 4 .IX Item "draw_separators [bool]" Draw vertical separators between columns? diff --git a/doc/ranger.pod b/doc/ranger.pod index 76d879d4..c54b6dfb 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -755,10 +755,15 @@ Display the file size in the status bar? Display tags in all columns? -=item draw_borders [bool] +=item draw_borders [string] -Draw borders around columns? +Draw borders around or between the columns? Possible values are: + none no borders of any sort + outline draw an outline around all the columns + separators draw only vertical lines between columns + both both of the above + =item draw_separators [bool] Draw vertical separators between columns? -- cgit 1.4.1-2-gfad0 From 50410a43f7f8d076bc6963dce0b21f8ce72955e0 Mon Sep 17 00:00:00 2001 From: squigz Date: Thu, 4 Jan 2018 20:18:49 -0500 Subject: Reduce calls to string.lower() --- ranger/gui/widgets/view_miller.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index 7cec3c21..795988cb 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -99,7 +99,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta directory.use() DisplayableContainer.draw(self) if self.settings.draw_borders: - self._draw_borders(self.settings.draw_borders) + self._draw_borders(self.settings.draw_borders.lower()) if self.draw_bookmarks: self._draw_bookmarks() elif self.draw_hints: @@ -110,9 +110,9 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta def _draw_borders(self, string): win = self.win - separators = True if string.lower() == "separators" else False - borders = True if string.lower() == "outline" else False - both = True if string.lower() == "both" else False + separators = True if string == "separators" else False + borders = True if string == "outline" else False + both = True if string == "both" else False self.color('in_browser', 'border') left_start = 0 @@ -158,7 +158,6 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta # pylint: disable=no-member win.vline(1, x, curses.ACS_VLINE, y - 1) char = curses.ACS_TTEE if both or borders else curses.ACS_VLINE - char = curses.ACS_TTEE if both or borders else curses.ACS_VLINE self.addch(0, x, char, 0) char = curses.ACS_BTEE if both or borders else curses.ACS_VLINE self.addch(y, x, char, 0) -- cgit 1.4.1-2-gfad0 From 4a1f382485894cfa9928ae734c93ba21dab888d1 Mon Sep 17 00:00:00 2001 From: squigz Date: Thu, 4 Jan 2018 20:43:48 -0500 Subject: remove unnecessary checks --- ranger/gui/widgets/view_miller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index 795988cb..aa05260d 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -157,9 +157,9 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta try: # pylint: disable=no-member win.vline(1, x, curses.ACS_VLINE, y - 1) - char = curses.ACS_TTEE if both or borders else curses.ACS_VLINE + char = curses.ACS_TTEE if both else curses.ACS_VLINE self.addch(0, x, char, 0) - char = curses.ACS_BTEE if both or borders else curses.ACS_VLINE + char = curses.ACS_BTEE if both else curses.ACS_VLINE self.addch(y, x, char, 0) # pylint: enable=no-member except curses.error: -- cgit 1.4.1-2-gfad0 From 5a70e87c219c415bf9443cdf968e0e760d84ab12 Mon Sep 17 00:00:00 2001 From: squigz Date: Thu, 4 Jan 2018 20:52:06 -0500 Subject: draw_borders: treat true as both for backwards compatibility --- ranger/gui/widgets/view_miller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index aa05260d..39fe938e 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -112,7 +112,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta separators = True if string == "separators" else False borders = True if string == "outline" else False - both = True if string == "both" else False + both = True if string == "both" or string == "true" else False self.color('in_browser', 'border') left_start = 0 -- cgit 1.4.1-2-gfad0 From bb2956e755937b148496691ec746366cf65165be Mon Sep 17 00:00:00 2001 From: Wojciech Siewierski Date: Fri, 5 Jan 2018 02:55:54 +0100 Subject: Clean up the draw_borders code --- ranger/gui/widgets/view_miller.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index 39fe938e..5ee266ae 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -107,12 +107,9 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta elif self.draw_info: self._draw_info(self.draw_info) - def _draw_borders(self, string): + def _draw_borders(self, border_type): win = self.win - separators = True if string == "separators" else False - borders = True if string == "outline" else False - both = True if string == "both" or string == "true" else False self.color('in_browser', 'border') left_start = 0 @@ -133,7 +130,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta right_end = self.wid - 1 # Draw horizontal lines and the leftmost vertical line - if both or borders: + if border_type in ['both', 'outline']: try: # pylint: disable=no-member win.hline(0, left_start, curses.ACS_HLINE, right_end - left_start) @@ -144,7 +141,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta pass # Draw the vertical lines in the middle - if both or separators: + if border_type in ['both', 'separators']: for child in self.columns[:-1]: if not child.has_preview(): continue @@ -157,16 +154,18 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta try: # pylint: disable=no-member win.vline(1, x, curses.ACS_VLINE, y - 1) - char = curses.ACS_TTEE if both else curses.ACS_VLINE - self.addch(0, x, char, 0) - char = curses.ACS_BTEE if both else curses.ACS_VLINE - self.addch(y, x, char, 0) + if border_type == 'both': + self.addch(0, x, curses.ACS_TTEE, 0) + self.addch(y, x, curses.ACS_BTEE, 0) + else: + self.addch(0, x, curses.ACS_VLINE, 0) + self.addch(y, x, curses.ACS_VLINE, 0) # pylint: enable=no-member except curses.error: # in case it's off the boundaries pass - if both or borders: + if border_type in ['both', 'outline']: # Draw the last vertical line try: # pylint: disable=no-member @@ -175,7 +174,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta except curses.error: pass - if both or borders: + if border_type in ['both', 'outline']: # pylint: disable=no-member self.addch(0, left_start, curses.ACS_ULCORNER) self.addch(self.hei - 1, left_start, curses.ACS_LLCORNER) -- cgit 1.4.1-2-gfad0 From b24a2246dc4c144e8589dbff03fd21301721c285 Mon Sep 17 00:00:00 2001 From: Wojciech Siewierski Date: Fri, 5 Jan 2018 03:18:12 +0100 Subject: Further draw_borders refactoring, "both" isn't now a distinct state --- ranger/gui/widgets/view_miller.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index 5ee266ae..e207ab49 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -99,7 +99,12 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta directory.use() DisplayableContainer.draw(self) if self.settings.draw_borders: - self._draw_borders(self.settings.draw_borders.lower()) + draw_borders = self.settings.draw_borders.lower() + if draw_borders in ['both', 'true']: # 'true' for backwards compat. + border_types = ['separators', 'outline'] + else: + border_types = [draw_borders] + self._draw_borders(border_types) if self.draw_bookmarks: self._draw_bookmarks() elif self.draw_hints: @@ -107,7 +112,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta elif self.draw_info: self._draw_info(self.draw_info) - def _draw_borders(self, border_type): + def _draw_borders(self, border_types): win = self.win self.color('in_browser', 'border') @@ -130,7 +135,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta right_end = self.wid - 1 # Draw horizontal lines and the leftmost vertical line - if border_type in ['both', 'outline']: + if 'outline' in border_types: try: # pylint: disable=no-member win.hline(0, left_start, curses.ACS_HLINE, right_end - left_start) @@ -141,7 +146,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta pass # Draw the vertical lines in the middle - if border_type in ['both', 'separators']: + if 'separators' in border_types: for child in self.columns[:-1]: if not child.has_preview(): continue @@ -154,7 +159,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta try: # pylint: disable=no-member win.vline(1, x, curses.ACS_VLINE, y - 1) - if border_type == 'both': + if 'outline' in border_types: self.addch(0, x, curses.ACS_TTEE, 0) self.addch(y, x, curses.ACS_BTEE, 0) else: @@ -165,7 +170,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta # in case it's off the boundaries pass - if border_type in ['both', 'outline']: + if 'outline' in border_types: # Draw the last vertical line try: # pylint: disable=no-member @@ -174,7 +179,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta except curses.error: pass - if border_type in ['both', 'outline']: + if 'outline' in border_types: # pylint: disable=no-member self.addch(0, left_start, curses.ACS_ULCORNER) self.addch(self.hei - 1, left_start, curses.ACS_LLCORNER) @@ -204,8 +209,11 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta """Resize all the columns according to the given ratio""" ViewBase.resize(self, y, x, hei, wid) - borders = self.settings.draw_borders.lower() - pad = 1 if borders == "outline" or borders == "both" else 0 + border_type = self.settings.draw_borders.lower() + if border_type in ['outline', 'both', 'true']: + pad = 1 + else: + pad = 0 left = pad self.is_collapsed = self._collapse() if self.is_collapsed: -- cgit 1.4.1-2-gfad0 From 520e76e13f619715175b6ce83e22ad0e3e65b057 Mon Sep 17 00:00:00 2001 From: squigz Date: Fri, 5 Jan 2018 08:01:28 -0500 Subject: Disable pylint too-many-branches for _draw_borders --- ranger/gui/widgets/view_miller.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index e207ab49..0c3c47ba 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -113,6 +113,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta self._draw_info(self.draw_info) def _draw_borders(self, border_types): + # pylint: disable=too-many-branches win = self.win self.color('in_browser', 'border') -- cgit 1.4.1-2-gfad0 From 4e74225ee94b57524e5f8211419e4e8ce68ed694 Mon Sep 17 00:00:00 2001 From: squigz Date: Fri, 5 Jan 2018 08:14:36 -0500 Subject: Another pylint fix (2 spaces before in-line comment) --- ranger/gui/widgets/view_miller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index 0c3c47ba..54750e17 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -100,7 +100,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta DisplayableContainer.draw(self) if self.settings.draw_borders: draw_borders = self.settings.draw_borders.lower() - if draw_borders in ['both', 'true']: # 'true' for backwards compat. + if draw_borders in ['both', 'true']: # 'true' for backwards compat. border_types = ['separators', 'outline'] else: border_types = [draw_borders] -- cgit 1.4.1-2-gfad0 From d0afe4be708708d66d6505cbf10b271b0759bda2 Mon Sep 17 00:00:00 2001 From: squigz Date: Fri, 5 Jan 2018 08:18:38 -0500 Subject: Fix commit 520e76e --- ranger/gui/widgets/view_miller.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index 54750e17..ea2d26d6 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -112,8 +112,7 @@ class ViewMiller(ViewBase): # pylint: disable=too-many-ancestors,too-many-insta elif self.draw_info: self._draw_info(self.draw_info) - def _draw_borders(self, border_types): - # pylint: disable=too-many-branches + def _draw_borders(self, border_types): # pylint: disable=too-many-branches win = self.win self.color('in_browser', 'border') -- cgit 1.4.1-2-gfad0 From d9a8bb1cea1f42f694ef65877db73e1d80409846 Mon Sep 17 00:00:00 2001 From: toonn Date: Sat, 8 Sep 2018 14:37:46 +0200 Subject: Fix documentation Remove a setting that no longer exists from the man page. Reformat the comment in `rc.conf`. Use lower case `'none'` for consistency --- doc/ranger.1 | 31 ++++++++++++++++--------------- doc/ranger.pod | 4 ---- ranger/config/rc.conf | 5 ++++- ranger/container/settings.py | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/doc/ranger.1 b/doc/ranger.1 index 21665bbf..052f06e9 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) +.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== @@ -54,16 +54,20 @@ .\" Avoid warning from groff about undefined register 'F'. .de IX .. -.if !\nF .nr F 0 -.if \nF>0 \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. -. if !\nF==2 \{\ -. nr % 0 -. nr F 2 +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} . \} .\} +.rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -129,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -.TH RANGER 1 "ranger-1.9.0b6" "01/04/2018" "ranger manual" +.TH RANGER 1 "ranger-1.9.0b6" "2018-09-08" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -169,7 +173,7 @@ plugins, sample configuration files and some programs for integrating ranger with other software. They are usually installed to \&\fI/usr/share/doc/ranger/examples\fR. .PP -The man page of \fIrifle\fR\|(1) describes the functions of the file opener +The man page of \fBrifle\fR\|(1) describes the functions of the file opener .PP The section \fI\s-1LINKS\s0\fR of this man page contains further resources. .SH "OPTIONS" @@ -599,7 +603,7 @@ Toggle the mark-status of all files .IP "V" 14 .IX Item "V" Starts the visual mode, which selects all files between the starting point and -the cursor until you press \s-1ESC. \s0 To unselect files in the same way, use \*(L"uV\*(R". +the cursor until you press \s-1ESC.\s0 To unselect files in the same way, use \*(L"uV\*(R". .IP "/" 14 Search for files in the current directory. .IP ":" 14 @@ -776,9 +780,6 @@ Draw borders around or between the columns? Possible values are: \& separators draw only vertical lines between columns \& both both of the above .Ve -.IP "draw_separators [bool]" 4 -.IX Item "draw_separators [bool]" -Draw vertical separators between columns? .IP "draw_progress_bar_in_status_bar [bool]" 4 .IX Item "draw_progress_bar_in_status_bar [bool]" Draw a progress bar in the status bar which displays the average state of all @@ -1524,7 +1525,7 @@ copy, run: .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" -\&\fIrifle\fR\|(1) +\&\fBrifle\fR\|(1) .SH "BUGS" .IX Header "BUGS" Report bugs here: diff --git a/doc/ranger.pod b/doc/ranger.pod index c54b6dfb..ff042fc7 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -764,10 +764,6 @@ Draw borders around or between the columns? Possible values are: separators draw only vertical lines between columns both both of the above -=item draw_separators [bool] - -Draw vertical separators between columns? - =item draw_progress_bar_in_status_bar [bool] Draw a progress bar in the status bar which displays the average state of all diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index 3fd46d38..cd0ac45b 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -123,7 +123,10 @@ set status_bar_on_top false # currently running tasks which support progress bars? set draw_progress_bar_in_status_bar true -# Draw borders around columns? (separators, outline, both, or none. Separators are vertical lines between columsn. Outline draws a box around all the columns. Both combines the two) +# Draw borders around columns? (separators, outline, both, or none) +# Separators are vertical lines between columns. +# Outline draws a box around all the columns. +# Both combines the two. set draw_borders none # Display the directory name in tabs? diff --git a/ranger/container/settings.py b/ranger/container/settings.py index f07c85a6..3e742926 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -96,7 +96,7 @@ ALLOWED_SETTINGS = { ALLOWED_VALUES = { 'cd_tab_case': ['sensitive', 'insensitive', 'smart'], 'confirm_on_delete': ['multiple', 'always', 'never'], - 'draw_borders': ['None', 'both', 'outline', 'separators'], + 'draw_borders': ['none', 'both', 'outline', 'separators'], 'line_numbers': ['false', 'absolute', 'relative'], 'one_indexed': [False, True], 'preview_images_method': ['w3m', 'iterm2', 'urxvt', 'urxvt-full'], -- cgit 1.4.1-2-gfad0