From 3fe8814b435cff349686d87c7c7afef1bcc1f34d Mon Sep 17 00:00:00 2001 From: toonn Date: Tue, 9 Oct 2018 16:53:15 +0200 Subject: Document w3m_offset in Settings section of manpage --- doc/ranger.1 | 39 ++++++++++++++++++++++----------------- doc/ranger.pod | 6 ++++++ 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/doc/ranger.1 b/doc/ranger.1 index 0cb65d80..02fb8c15 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,11 +133,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -<<<<<<< HEAD -.TH RANGER 1 "ranger-1.9.2" "2018-10-08" "ranger manual" -======= -.TH RANGER 1 "ranger-1.9.2" "10/07/2018" "ranger manual" ->>>>>>> LeLobster-stborderw3mfix +.TH RANGER 1 "ranger-1.9.2" "2018-10-09" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -173,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 "POSITIONAL ARGUMENTS" @@ -342,7 +342,7 @@ To enable this feature, set the option \f(CW\*(C`preview_images_method\*(C'\fR t \fIkitty\fR .IX Subsection "kitty" .PP -This only works on Kitty. It requires \s-1PIL \s0(or pillow) to work. +This only works on Kitty. It requires \s-1PIL\s0 (or pillow) to work. Allows remote image previews, for example in an ssh session. .PP To enable this feature, set the option \f(CW\*(C`preview_images_method\*(C'\fR to kitty. @@ -628,7 +628,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 @@ -1070,6 +1070,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 @@ -1661,7 +1666,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 c68e7246..c319f785 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -1122,6 +1122,12 @@ B 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 -- cgit 1.4.1-2-gfad0 From 22dcaf91e7ad5df0a0177ec5dd5e0b071c3deb51 Mon Sep 17 00:00:00 2001 From: Baranovskiy Konstantin Date: Thu, 25 Oct 2018 16:07:04 +0300 Subject: Restoration of scrolling in pager. Fixes #1347 --- ranger/core/actions.py | 4 ++-- ranger/gui/widgets/browsercolumn.py | 6 ++++-- ranger/gui/widgets/pager.py | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 4e76df65..1b5d0028 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -1004,9 +1004,9 @@ 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 + target_scroll = preview_column.scroll_extra + lines max_scroll = len(preview_column.lines) - preview_column.hei - preview_column.scrollbit = max(0, min(target_scroll, max_scroll)) + preview_column.scroll_extra = max(0, min(target_scroll, max_scroll)) preview_column.request_redraw() # -------------------------- diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 3845dc41..8d2e63eb 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -96,7 +96,9 @@ 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) + target_scroll = self.scroll_extra + direction + max_scroll = len(self.lines) - self.hei + self.scroll_extra = max(0, min(target_scroll, max_scroll)) self.need_redraw = True else: if self.level > 0 and not direction: @@ -157,7 +159,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..3bb52e3f 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: @@ -96,8 +95,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) -- cgit 1.4.1-2-gfad0 From d6ac6d04ee61dffae0df811d9f424508b87580ab Mon Sep 17 00:00:00 2001 From: Baranovskiy Konstantin Date: Thu, 25 Oct 2018 16:07:04 +0300 Subject: Restoration of scrolling in pager. Fixes #1347 --- ranger/core/actions.py | 5 +---- ranger/gui/widgets/browsercolumn.py | 5 +---- ranger/gui/widgets/pager.py | 6 ++++++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 1b5d0028..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.scroll_extra + lines - max_scroll = len(preview_column.lines) - preview_column.hei - preview_column.scroll_extra = max(0, min(target_scroll, max_scroll)) - preview_column.request_redraw() + preview_column.scrollbit(lines) # -------------------------- # -- Previews diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 8d2e63eb..ecc66f44 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -96,10 +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: - target_scroll = self.scroll_extra + direction - max_scroll = len(self.lines) - self.hei - self.scroll_extra = max(0, min(target_scroll, max_scroll)) - self.need_redraw = True + self.scrollbit(direction) else: if self.level > 0 and not direction: self.fm.move(right=0) diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py index 3bb52e3f..c1aa2765 100644 --- a/ranger/gui/widgets/pager.py +++ b/ranger/gui/widgets/pager.py @@ -75,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 -- cgit 1.4.1-2-gfad0 From f9c49f9c2e7ec680f9a06685eba75787e7d2ed7b Mon Sep 17 00:00:00 2001 From: Baranovskiy Konstantin Date: Sat, 20 Oct 2018 20:01:02 +0300 Subject: Broken preview of highlighted text with Python3 ranger/core/loader.py: CommandLoader.generate() gets text for preview panel from scope.sh as the blocks of byrearray (max 512 bytes). This blocks immediately decoded to utf-8. But in case when muli-byte unicode characters is present they may be split and python will can't correctly to decode it. For example: b'abc\xd0', b'\x9a...' b'\xd0\x9a' - is cyrillic letter 'K' and it can't be decoded separately (UnicodeDecodeError occurs). So, received data blocks (bytearrays) must be collected and only after that decoded as one whole byrearray. Fixes #906 Fixes #967 Fixes #1166 --- ranger/core/loader.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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) -- cgit 1.4.1-2-gfad0