diff options
Diffstat (limited to 'ranger/gui/widgets/view_miller.py')
-rw-r--r-- | ranger/gui/widgets/view_miller.py | 90 |
1 files 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) |