fix for vim glitch
This commit is contained in:
@@ -202,6 +202,24 @@ command.trim_history(None, terminal)
|
||||
assert "row 0" in terminal.view.text and "row 7" in terminal.view.text, \
|
||||
terminal.view.text
|
||||
|
||||
# nor may its blank rows be trimmed: an app that blanks and refills its last
|
||||
# row (vim's showcmd corner) would resize the view under a pinned viewport
|
||||
terminal, stream = make_terminal(rows=4)
|
||||
stream.feed("\x1b[?1049h")
|
||||
terminal.view = FakeView("top\nrow\n\n")
|
||||
command = make_command(terminal.view)
|
||||
before = terminal.view.text
|
||||
command.trim_trailing_spaces(None, terminal)
|
||||
assert terminal.view.text == before, \
|
||||
"alt screen blank tail was trimmed: {!r}".format(terminal.view.text)
|
||||
|
||||
# on the primary screen the blank tail below the cursor still goes
|
||||
terminal, stream = make_terminal(rows=4)
|
||||
terminal.view = FakeView("top\nrow\n\n")
|
||||
command = make_command(terminal.view)
|
||||
command.trim_trailing_spaces(None, terminal)
|
||||
assert terminal.view.text == "top\nrow", terminal.view.text
|
||||
|
||||
print("render tests passed (alt screen keeps its view, cap honoured)")
|
||||
|
||||
|
||||
|
||||
@@ -105,8 +105,7 @@ def _modifier_code(ctrl, alt, shift):
|
||||
return 1 + (1 if shift else 0) + (2 if alt else 0) + (4 if ctrl else 0)
|
||||
|
||||
|
||||
def get_key_code(key, ctrl=False, alt=False, shift=False, application_mode=False, new_line_mode=False,
|
||||
modify_other_keys=0):
|
||||
def get_key_code(key, ctrl=False, alt=False, shift=False, application_mode=False, new_line_mode=False, modify_other_keys=0):
|
||||
"""Escape sequence for a key name and its modifiers, honouring the app's active modes"""
|
||||
key_lo = key.lower() if len(key) > 1 else key
|
||||
|
||||
|
||||
@@ -410,9 +410,16 @@ class VtermRenderCommand(sublime_plugin.TextCommand):
|
||||
|
||||
Without this the view keeps a full screen of blank rows below a short
|
||||
prompt, and the scrollbar reflects them.
|
||||
|
||||
Both are skipped on the alternate screen, where the app owns every row:
|
||||
one that blanks and refills - vim's showcmd corner, on every keypress -
|
||||
would resize the view under a viewport pinned to its bottom, and the
|
||||
whole screen shifts by the part of a row the viewport leaves over.
|
||||
"""
|
||||
view = self.view
|
||||
screen = terminal.screen
|
||||
if screen.alternate_buffer_mode:
|
||||
return
|
||||
cursor = screen.cursor
|
||||
cursor_row = terminal.offset + cursor.y
|
||||
lastrow = view.rowcol(view.size())[0]
|
||||
|
||||
Reference in New Issue
Block a user