Pass key events mapped to scroll actions to the program running in the terminal when the terminal is in alternate screen mode
Fixes #5839
This commit is contained in:
parent
c76bbeabd6
commit
4f9ed6546a
@ -27,6 +27,11 @@ Browse scrollback in less :sc:`show_scrollback`
|
|||||||
Browse last cmd output :sc:`show_last_command_output` (see :ref:`shell_integration`)
|
Browse last cmd output :sc:`show_last_command_output` (see :ref:`shell_integration`)
|
||||||
========================= =======================
|
========================= =======================
|
||||||
|
|
||||||
|
The scroll actions only take effect when the terminal is in the main screen.
|
||||||
|
When the alternate screen is active (for example when using a full screen
|
||||||
|
program like an editor) the key events are instead passed to program running in the
|
||||||
|
terminal.
|
||||||
|
|
||||||
Tabs
|
Tabs
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,8 @@ Detailed list of changes
|
|||||||
|
|
||||||
- Allow using the cwd of the original process for :option:`launch --cwd` (:iss:`5672`)
|
- Allow using the cwd of the original process for :option:`launch --cwd` (:iss:`5672`)
|
||||||
|
|
||||||
|
- Pass key events mapped to scroll actions to the program running in the terminal when the terminal is in alternate screen mode (:iss:`5839`)
|
||||||
|
|
||||||
- Implement :ref:`edit-in-kitty <edit_file>` using the new ``kitty-tool`` static executable (:iss:`5546`, :iss:`5630`)
|
- Implement :ref:`edit-in-kitty <edit_file>` using the new ``kitty-tool`` static executable (:iss:`5546`, :iss:`5630`)
|
||||||
|
|
||||||
- Add an option :opt:`background_tint_gaps` to control background image tinting for window gaps (:iss:`5596`)
|
- Add an option :opt:`background_tint_gaps` to control background image tinting for window gaps (:iss:`5596`)
|
||||||
|
|||||||
@ -1517,35 +1517,47 @@ class Window:
|
|||||||
def clear_selection(self) -> None:
|
def clear_selection(self) -> None:
|
||||||
self.screen.clear_selection()
|
self.screen.clear_selection()
|
||||||
|
|
||||||
@ac('sc', 'Scroll up by one line')
|
@ac('sc', 'Scroll up by one line when in main screen')
|
||||||
def scroll_line_up(self) -> None:
|
def scroll_line_up(self) -> Optional[bool]:
|
||||||
if self.screen.is_main_linebuf():
|
if self.screen.is_main_linebuf():
|
||||||
self.screen.scroll(SCROLL_LINE, True)
|
self.screen.scroll(SCROLL_LINE, True)
|
||||||
|
return None
|
||||||
|
return True
|
||||||
|
|
||||||
@ac('sc', 'Scroll down by one line')
|
@ac('sc', 'Scroll down by one line when in main screen')
|
||||||
def scroll_line_down(self) -> None:
|
def scroll_line_down(self) -> Optional[bool]:
|
||||||
if self.screen.is_main_linebuf():
|
if self.screen.is_main_linebuf():
|
||||||
self.screen.scroll(SCROLL_LINE, False)
|
self.screen.scroll(SCROLL_LINE, False)
|
||||||
|
return None
|
||||||
|
return True
|
||||||
|
|
||||||
@ac('sc', 'Scroll up by one page')
|
@ac('sc', 'Scroll up by one page when in main screen')
|
||||||
def scroll_page_up(self) -> None:
|
def scroll_page_up(self) -> Optional[bool]:
|
||||||
if self.screen.is_main_linebuf():
|
if self.screen.is_main_linebuf():
|
||||||
self.screen.scroll(SCROLL_PAGE, True)
|
self.screen.scroll(SCROLL_PAGE, True)
|
||||||
|
return None
|
||||||
|
return True
|
||||||
|
|
||||||
@ac('sc', 'Scroll down by one page')
|
@ac('sc', 'Scroll down by one page when in main screen')
|
||||||
def scroll_page_down(self) -> None:
|
def scroll_page_down(self) -> Optional[bool]:
|
||||||
if self.screen.is_main_linebuf():
|
if self.screen.is_main_linebuf():
|
||||||
self.screen.scroll(SCROLL_PAGE, False)
|
self.screen.scroll(SCROLL_PAGE, False)
|
||||||
|
return None
|
||||||
|
return True
|
||||||
|
|
||||||
@ac('sc', 'Scroll to the top of the scrollback buffer')
|
@ac('sc', 'Scroll to the top of the scrollback buffer when in main screen')
|
||||||
def scroll_home(self) -> None:
|
def scroll_home(self) -> Optional[bool]:
|
||||||
if self.screen.is_main_linebuf():
|
if self.screen.is_main_linebuf():
|
||||||
self.screen.scroll(SCROLL_FULL, True)
|
self.screen.scroll(SCROLL_FULL, True)
|
||||||
|
return None
|
||||||
|
return True
|
||||||
|
|
||||||
@ac('sc', 'Scroll to the bottom of the scrollback buffer')
|
@ac('sc', 'Scroll to the bottom of the scrollback buffer when in main screen')
|
||||||
def scroll_end(self) -> None:
|
def scroll_end(self) -> Optional[bool]:
|
||||||
if self.screen.is_main_linebuf():
|
if self.screen.is_main_linebuf():
|
||||||
self.screen.scroll(SCROLL_FULL, False)
|
self.screen.scroll(SCROLL_FULL, False)
|
||||||
|
return None
|
||||||
|
return True
|
||||||
|
|
||||||
@ac('sc', '''
|
@ac('sc', '''
|
||||||
Scroll to the previous/next shell command prompt
|
Scroll to the previous/next shell command prompt
|
||||||
@ -1559,23 +1571,29 @@ class Window:
|
|||||||
map ctrl+n scroll_to_prompt 1 # jump to next
|
map ctrl+n scroll_to_prompt 1 # jump to next
|
||||||
map ctrl+o scroll_to_prompt 0 # jump to last visited
|
map ctrl+o scroll_to_prompt 0 # jump to last visited
|
||||||
''')
|
''')
|
||||||
def scroll_to_prompt(self, num_of_prompts: int = -1) -> None:
|
def scroll_to_prompt(self, num_of_prompts: int = -1) -> Optional[bool]:
|
||||||
if self.screen.is_main_linebuf():
|
if self.screen.is_main_linebuf():
|
||||||
self.screen.scroll_to_prompt(num_of_prompts)
|
self.screen.scroll_to_prompt(num_of_prompts)
|
||||||
|
return None
|
||||||
|
return True
|
||||||
|
|
||||||
@ac('sc', 'Scroll prompt to the top of the screen, filling screen with empty lines')
|
@ac('sc', 'Scroll prompt to the top of the screen, filling screen with empty lines, when in main screen')
|
||||||
def scroll_prompt_to_top(self, clear_scrollback: bool = False) -> None:
|
def scroll_prompt_to_top(self, clear_scrollback: bool = False) -> Optional[bool]:
|
||||||
if self.screen.is_main_linebuf():
|
if self.screen.is_main_linebuf():
|
||||||
self.screen.scroll_until_cursor_prompt()
|
self.screen.scroll_until_cursor_prompt()
|
||||||
if clear_scrollback:
|
if clear_scrollback:
|
||||||
self.screen.clear_scrollback()
|
self.screen.clear_scrollback()
|
||||||
elif self.screen.scrolled_by > 0:
|
elif self.screen.scrolled_by > 0:
|
||||||
self.screen.scroll(SCROLL_FULL, False)
|
self.screen.scroll(SCROLL_FULL, False)
|
||||||
|
return None
|
||||||
|
return True
|
||||||
|
|
||||||
@ac('sc', 'Scroll prompt to the bottom of the screen, filling in extra lines from the scrollback buffer')
|
@ac('sc', 'Scroll prompt to the bottom of the screen, filling in extra lines from the scrollback buffer, when in main screen')
|
||||||
def scroll_prompt_to_bottom(self) -> None:
|
def scroll_prompt_to_bottom(self) -> Optional[bool]:
|
||||||
if self.screen.is_main_linebuf():
|
if self.screen.is_main_linebuf():
|
||||||
self.screen.scroll_prompt_to_bottom()
|
self.screen.scroll_prompt_to_bottom()
|
||||||
|
return None
|
||||||
|
return True
|
||||||
|
|
||||||
@ac('mk', 'Toggle the current marker on/off')
|
@ac('mk', 'Toggle the current marker on/off')
|
||||||
def toggle_marker(self, ftype: str, spec: Union[str, Tuple[Tuple[int, str], ...]], flags: int) -> None:
|
def toggle_marker(self, ftype: str, spec: Union[str, Tuple[Tuple[int, str], ...]], flags: int) -> None:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user