diff options
-rw-r--r-- | ranger/gui/widgets/browserview.py | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/ranger/gui/widgets/browserview.py b/ranger/gui/widgets/browserview.py index e0a2275e..bfdf9ea9 100644 --- a/ranger/gui/widgets/browserview.py +++ b/ranger/gui/widgets/browserview.py @@ -131,15 +131,17 @@ class BrowserView(Widget, DisplayableContainer): left_start = child.x + child.wid else: break - if not self.pager.visible: - for child in reversed(self.columns): - if not child.has_preview(): - right_end = child.x - 1 - 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 horizontal lines and the leftmost vertical line try: win.hline(0, left_start, curses.ACS_HLINE, right_end - left_start) win.hline(self.hei - 1, left_start, curses.ACS_HLINE, @@ -148,11 +150,13 @@ class BrowserView(Widget, DisplayableContainer): except _curses.error: pass - for child in self.columns: + # 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: - win.vline(1, right_end, curses.ACS_VLINE, self.hei - 2) + # 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 @@ -164,6 +168,12 @@ class BrowserView(Widget, DisplayableContainer): # in case it's off the boundaries pass + # Draw the last vertical line + try: + win.vline(1, right_end, curses.ACS_VLINE, self.hei - 2) + except _curses.error: + pass + 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) |