Use an overlay window for browsing the scrollback buffer in less

This commit is contained in:
Kovid Goyal 2018-02-03 14:58:34 +05:30
parent 647b95631f
commit 561e63ee2d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 12 additions and 26 deletions

View File

@ -244,14 +244,13 @@ feature is best illustrated with a link:remote-control.asciidoc[tutorial].
kitty supports scrolling back to view history, just like most terminals. You
can use either the <<scrolling-shortcuts,keyboard shortcuts>> or the mouse
scroll wheel to do so. However, kitty has an extra, neat feature. Sometimes you
need to explore the scrollback buffer in more detail, maybe search for some
scroll wheel to do so. However, kitty has an extra, neat feature. Sometimes
you need to explore the scrollback buffer in more detail, maybe search for some
text or refer to it side-by-side while typing in a follow-up command. kitty
allows you to do this by pressing the {sc_show_scrollback} key-combination,
which will open the scrollback buffer in a new window, using your favorite
pager program (which is `less` by default). You can then explore the scrollback
buffer using whatever program you normally use. Colors and text formatting are
preserved.
which will open the scrollback buffer in your favorite pager program (which is
`less` by default). Colors and text formatting are preserved. You can explore
the scrollback pager comfortably within the pager.
== Miscellaneous features

View File

@ -359,15 +359,12 @@ def on_os_window_closed(self, os_window_id, viewport_width, viewport_height):
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, data):
if self.opts.scrollback_in_new_tab:
self.display_scrollback_in_new_tab(data)
else:
tab = self.active_tab
if tab is not None:
tab.new_special_window(
SpecialWindow(
self.opts.scrollback_pager, data, _('History')))
def display_scrollback(self, window, data):
tab = self.active_tab
if tab is not None:
tab.new_special_window(
SpecialWindow(
self.opts.scrollback_pager, data, _('History'), overlay_for=window.id))
def switch_focus_to(self, window_idx):
tab = self.active_tab
@ -506,9 +503,3 @@ def move_tab_backward(self):
tm = self.active_tab_manager
if tm is not None:
tm.move_tab(-1)
def display_scrollback_in_new_tab(self, data):
tm = self.active_tab_manager
if tm is not None:
tm.new_tab(special_window=SpecialWindow(
self.opts.scrollback_pager, data, _('History')))

View File

@ -251,7 +251,6 @@ def url_style(x):
'adjust_column_width': adjust_line_height,
'scrollback_lines': positive_int,
'scrollback_pager': shlex.split,
'scrollback_in_new_tab': to_bool,
'font_size': to_font_size,
'font_size_delta': positive_float,
'focus_follows_mouse': to_bool,

View File

@ -90,9 +90,6 @@ scrollback_lines 2000
# handle ANSI escape sequences for colors and text formatting.
scrollback_pager less +G -R
# When viewing scrollback in a new window, put it in a new tab as well
scrollback_in_new_tab no
# Wheel scroll multiplier (modify the amount scrolled by the mouse wheel). Use negative
# numbers to change scroll direction.
wheel_scroll_multiplier 5.0

View File

@ -332,7 +332,7 @@ def buffer_as_text(self, add_history=True):
# actions {{{
def show_scrollback(self):
get_boss().display_scrollback(self.buffer_as_ansi().encode('utf-8'))
get_boss().display_scrollback(self, self.buffer_as_ansi().encode('utf-8'))
def paste(self, text):
if text and not self.destroyed: