When viewing the scrollback in less and kitty is currently scrolled, position the scrollback in less to match kitty's scroll position.

Fixes #148
This commit is contained in:
Kovid Goyal
2018-06-07 13:25:37 +05:30
parent dbb94fc1ff
commit ed0239a556
4 changed files with 16 additions and 5 deletions

View File

@@ -418,7 +418,12 @@ class Window:
# actions {{{
def show_scrollback(self):
get_boss().display_scrollback(self, self.as_text(as_ansi=True, add_history=True).encode('utf-8'))
data = self.as_text(as_ansi=True, add_history=True, add_wrap_markers=True)
data = data.replace('\r\n', '\n').replace('\r', '\n')
lines = data.count('\n')
input_line_number = (lines - (self.screen.lines - 1) - self.screen.scrolled_by)
cmd = [x.replace('INPUT_LINE_NUMBER', str(input_line_number)) for x in self.opts.scrollback_pager]
get_boss().display_scrollback(self, data, cmd)
def paste(self, text):
if text and not self.destroyed: