diff options
author | seebye <seebye@users.noreply.github.com> | 2018-11-06 23:39:08 +0100 |
---|---|---|
committer | seebye <seebye@users.noreply.github.com> | 2018-11-06 23:39:08 +0100 |
commit | 79af649fdfa11099675663c65dc06eaf2eff0f65 (patch) | |
tree | 9c266b8fe69bd2fd93feb08982d39f38d575d033 | |
parent | 8454fc4a67fe5dfacc721161b78bf0924a831958 (diff) | |
parent | 163c758f46d09e74c1da8f2d249fcd40e9b02afb (diff) | |
download | ranger-79af649fdfa11099675663c65dc06eaf2eff0f65.tar.gz |
Merge branch 'master' of https://github.com/seebye/ranger
-rw-r--r-- | doc/ranger.1 | 7 | ||||
-rw-r--r-- | doc/ranger.pod | 6 | ||||
-rw-r--r-- | ranger/core/actions.py | 5 | ||||
-rw-r--r-- | ranger/core/loader.py | 15 | ||||
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 5 | ||||
-rw-r--r-- | ranger/gui/widgets/pager.py | 12 |
6 files changed, 34 insertions, 16 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1 index b7d70ae1..5a159e12 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -.TH RANGER 1 "ranger-1.9.2" "10/14/2018" "ranger manual" +.TH RANGER 1 "ranger-1.9.2" "2018-10-26" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -1073,6 +1073,11 @@ traditional miller column view that shows multiple levels of the hierarchy, or .IX Item "w3m_delay [float]" Delay in seconds before displaying an image with the w3m method. Increase it in case of experiencing display corruption. +.IP "w3m_offset [int]" 4 +.IX Item "w3m_offset [int]" +Offset in pixels for the inner border of the terminal. Some terminals require +the offset to be specified explicitly, among others st and UXterm, some don't +like urxvt. .IP "wrap_scroll [bool]" 4 .IX Item "wrap_scroll [bool]" Enable scroll wrapping \- moving down while on the last item will wrap around to diff --git a/doc/ranger.pod b/doc/ranger.pod index f822df39..8fbc8826 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -1126,6 +1126,12 @@ B<multipane> to use multiple panes (one per tab) similar to midnight-commander. Delay in seconds before displaying an image with the w3m method. Increase it in case of experiencing display corruption. +=item w3m_offset [int] + +Offset in pixels for the inner border of the terminal. Some terminals require +the offset to be specified explicitly, among others st and UXterm, some don't +like urxvt. + =item wrap_scroll [bool] Enable scroll wrapping - moving down while on the last item will wrap around to diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 4e76df65..20a180e9 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -1004,10 +1004,7 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m if preview_column.target and preview_column.target.is_file: if narg is not None: lines = narg - target_scroll = preview_column.scrollbit + lines - max_scroll = len(preview_column.lines) - preview_column.hei - preview_column.scrollbit = max(0, min(target_scroll, max_scroll)) - preview_column.request_redraw() + preview_column.scrollbit(lines) # -------------------------- # -- Previews diff --git a/ranger/core/loader.py b/ranger/core/loader.py index 274dc610..9f32535f 100644 --- a/ranger/core/loader.py +++ b/ranger/core/loader.py @@ -194,6 +194,7 @@ class CommandLoader( # pylint: disable=too-many-instance-attributes selectlist.append(process.stdout) if not self.silent: selectlist.append(process.stderr) + read_stdout = None while process.poll() is None: yield if self.finished: @@ -210,10 +211,11 @@ class CommandLoader( # pylint: disable=too-many-instance-attributes self.fm.notify(read, bad=True) elif robjs == process.stdout: read = robjs.read(512) - if py3: - read = safe_decode(read) if read: - self.stdout_buffer += read + if read_stdout is None: + read_stdout = read + else: + read_stdout += read except select.error: sleep(0.03) if not self.silent: @@ -223,9 +225,12 @@ class CommandLoader( # pylint: disable=too-many-instance-attributes self.fm.notify(line, bad=True) if self.read: read = process.stdout.read() + if read: + read_stdout += read + if read_stdout: if py3: - read = safe_decode(read) - self.stdout_buffer += read + read_stdout = safe_decode(read_stdout) + self.stdout_buffer += read_stdout self.finished = True self.signal_emit('after', process=process, loader=self) diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 3845dc41..ecc66f44 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -96,8 +96,7 @@ class BrowserColumn(Pager): # pylint: disable=too-many-instance-attributes self.fm.thisdir.move_to_obj(clicked_file) self.fm.execute_file(clicked_file) elif self.target.is_file: - self.scrollbit = max(0, self.scrollbit + direction) - self.need_redraw = True + self.scrollbit(direction) else: if self.level > 0 and not direction: self.fm.move(right=0) @@ -157,7 +156,7 @@ class BrowserColumn(Pager): # pylint: disable=too-many-instance-attributes if target != self.old_dir: self.need_redraw = True self.old_dir = target - self.scrollbit = 0 # reset scroll start + self.scroll_extra = 0 # reset scroll start if target: target.use() diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py index c88f5ff0..c1aa2765 100644 --- a/ranger/gui/widgets/pager.py +++ b/ranger/gui/widgets/pager.py @@ -29,18 +29,17 @@ class Pager(Widget): # pylint: disable=too-many-instance-attributes need_clear_image = False need_redraw_image = False max_width = None - scrollbit = 0 def __init__(self, win, embedded=False): Widget.__init__(self, win) self.embedded = embedded self.scroll_begin = 0 + self.scroll_extra = 0 self.startx = 0 self.markup = None self.lines = [] self.image = None self.image_drawn = False - self.scrollbit = 0 def _close_source(self): if self.source and self.source_is_stream: @@ -76,6 +75,12 @@ class Pager(Widget): # pylint: disable=too-many-instance-attributes def finalize(self): self.fm.ui.win.move(self.y, self.x) + def scrollbit(self, lines): + target_scroll = self.scroll_extra + lines + max_scroll = len(self.lines) - self.hei + self.scroll_extra = max(0, min(target_scroll, max_scroll)) + self.need_redraw = True + def draw(self): if self.need_clear_image: self.need_redraw = True @@ -96,8 +101,9 @@ class Pager(Widget): # pylint: disable=too-many-instance-attributes self.clear_image() if not self.image: + scroll_pos = self.scroll_begin + self.scroll_extra line_gen = self._generate_lines( - starty=self.scrollbit, startx=self.startx) + starty=scroll_pos, startx=self.startx) for line, i in zip(line_gen, range(self.hei)): self._draw_line(i, line) |