summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorsquigz <squigglezworth@gmail.com>2018-01-04 16:05:44 -0500
committersquigz <squigglezworth@gmail.com>2018-01-04 16:05:44 -0500
commitbbb01f5e3e6bb86d4842db1e22f918dc0b06a40f (patch)
tree5515dc6ff62d74ef7324f12ad3dd21d7671856aa
parent08fbe46b0237137d7c5aadead2882d6a826cddf7 (diff)
downloadranger-bbb01f5e3e6bb86d4842db1e22f918dc0b06a40f.tar.gz
Changes draw_borders setting to a string
Allows drawing vertical separators between columns, borders around all
the columns, both of the two, or none
-rw-r--r--ranger/config/rc.conf7
-rw-r--r--ranger/container/settings.py3
-rw-r--r--ranger/gui/widgets/view_miller.py65
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)