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:
parent
dbb94fc1ff
commit
ed0239a556
@ -21,6 +21,10 @@ Changelog
|
||||
- Implement changing the font size for individual top level (OS) windows
|
||||
(:iss:`408`)
|
||||
|
||||
- When viewing the scrollback in less using :sc:`show_scrollback` and kitty
|
||||
is currently scrolled, position the scrollback in less to match kitty's
|
||||
scroll position. (:iss:`148`)
|
||||
|
||||
- ssh kitten: Support all SSH options. It can now be aliased directly to ssh
|
||||
for convenience. (:pull:`591`)
|
||||
|
||||
|
||||
@ -528,12 +528,12 @@ class Boss:
|
||||
for window_id in tuple(w.id for w in self.window_id_map.values() if getattr(w, 'os_window_id', None) == os_window_id):
|
||||
self.window_id_map.pop(window_id, None)
|
||||
|
||||
def display_scrollback(self, window, data):
|
||||
def display_scrollback(self, window, data, cmd):
|
||||
tab = self.active_tab
|
||||
if tab is not None and window.overlay_for is None:
|
||||
tab.new_special_window(
|
||||
SpecialWindow(
|
||||
self.opts.scrollback_pager, data, _('History'), overlay_for=window.id))
|
||||
cmd, data, _('History'), overlay_for=window.id))
|
||||
|
||||
def edit_config_file(self, *a):
|
||||
confpath = prepare_config_file_for_editing()
|
||||
|
||||
@ -275,10 +275,12 @@ o('scrollback_lines', 2000, option_type=positive_int, long_text=_('''
|
||||
Number of lines of history to keep in memory for scrolling back. Memory is allocated
|
||||
on demand.'''))
|
||||
|
||||
o('scrollback_pager', 'less +G -R', option_type=to_cmdline, long_text=_('''
|
||||
o('scrollback_pager', 'less --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER', option_type=to_cmdline, long_text=_('''
|
||||
Program with which to view scrollback in a new window. The scrollback buffer is
|
||||
passed as STDIN to this program. If you change it, make sure the program you
|
||||
use can handle ANSI escape sequences for colors and text formatting.'''))
|
||||
use can handle ANSI escape sequences for colors and text formatting.
|
||||
INPUT_LINE_NUMBER in the command line above will be replaced by an integer
|
||||
representing which line should be at the top of the screen.'''))
|
||||
|
||||
o('wheel_scroll_multiplier', 5.0, long_text=_('''
|
||||
Modify the amount scrolled by the mouse wheel or touchpad. Use
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user