fixes
This commit is contained in:
@@ -54,10 +54,18 @@ def run_case(char_by_char):
|
||||
# and nothing leaked to the screen
|
||||
assert screen.buffer[0][0].data == " ", (tag, screen.buffer[0][0])
|
||||
|
||||
# modifyOtherKeys must not corrupt SGR state
|
||||
# modifyOtherKeys: the level is tracked (pi enables it and reads shift+enter
|
||||
# no other way), and the sequence must not corrupt SGR state
|
||||
proc, screen, stream = make()
|
||||
assert screen.modify_other_keys == 0, tag
|
||||
feed(stream, "\x1b[>4;2mhello", char_by_char)
|
||||
assert screen.modify_other_keys == 2, (tag, screen.modify_other_keys)
|
||||
assert screen.buffer[0][0].data == "h" and not screen.buffer[0][0].underscore, tag
|
||||
feed(stream, "\x1b[>4;0m", char_by_char)
|
||||
assert screen.modify_other_keys == 0, (tag, screen.modify_other_keys)
|
||||
# another resource, and the bare form, leave it alone
|
||||
feed(stream, "\x1b[>4;2m\x1b[>1;2m\x1b[>m", char_by_char)
|
||||
assert screen.modify_other_keys == 2, (tag, screen.modify_other_keys)
|
||||
|
||||
# OSC 11 color query answered; OSC 0 sets title; OSC 133 dropped
|
||||
proc, screen, stream = make()
|
||||
|
||||
@@ -52,6 +52,15 @@ for char in string.ascii_letters + string.digits + string.punctuation:
|
||||
assert produced == char, "{!r} would send {!r}".format(char, produced)
|
||||
|
||||
assert get_key_code(key="space") == " ", "space must send a space"
|
||||
|
||||
# legacy encodings by default; while the app has modifyOtherKeys on, the keys
|
||||
# whose modified form is ambiguous take the CSI 27 form instead. pi reads a
|
||||
# bare ESC CR as alt+enter and submits on it
|
||||
assert get_key_code(key="enter", shift=True) == "\x1b\r"
|
||||
assert get_key_code(key="enter", shift=True, modify_other_keys=2) == "\x1b[27;2;13~"
|
||||
assert get_key_code(key="space", ctrl=True, modify_other_keys=2) == "\x1b[27;5;32~"
|
||||
assert get_key_code(key="enter", modify_other_keys=2) == "\r", "unmodified keys stay legacy"
|
||||
assert get_key_code(key="c", ctrl=True, modify_other_keys=2) == "\x03", "ctrl+c stays a control byte"
|
||||
load_sublime_json("Default (OSX).sublime-mousemap")
|
||||
|
||||
# scheme manager produces scopes and rules
|
||||
|
||||
@@ -519,10 +519,26 @@ assert not terminal._trackpad_engaged
|
||||
assert terminal.view.viewport == (0, ANCHOR - extent), "browsing must not snap"
|
||||
assert displace(-30) == "", "still browsing"
|
||||
terminal.view.viewport = (0, ANCHOR)
|
||||
tick() # back at the anchor: re-engage
|
||||
tick() # back at the anchor, but still gliding: nothing may pin it yet
|
||||
assert not terminal._trackpad_engaged
|
||||
tick() # at rest on the anchor: re-engage
|
||||
assert terminal._trackpad_engaged
|
||||
assert displace(20) == "\x1b[<65;1;3M"
|
||||
|
||||
# momentum carrying past the anchor must glide unpinned — pinning it mid-glide
|
||||
# is the shake — and be corrected in one step once it stops, without a report
|
||||
assert displace(-extent) == ""
|
||||
assert not terminal._trackpad_engaged
|
||||
terminal.process.written = ""
|
||||
terminal.view.viewport = (0, ANCHOR + 40)
|
||||
tick()
|
||||
assert terminal.view.viewport == (0, ANCHOR + 40), "gliding must not snap"
|
||||
assert not terminal._trackpad_engaged
|
||||
tick()
|
||||
assert terminal._trackpad_engaged
|
||||
assert terminal.view.viewport == (0, ANCHOR), terminal.view.viewport
|
||||
assert terminal.process.written == "", repr(terminal.process.written)
|
||||
|
||||
# on the alt screen without tracking the same displacement turns into arrows
|
||||
stream.feed("\x1b[?1002l\x1b[?1006l\x1b[?1049h")
|
||||
terminal._sync_wheel_flag()
|
||||
@@ -537,7 +553,7 @@ tick()
|
||||
assert not terminal._trackpad_running
|
||||
assert sublime._timeouts == [], sublime._timeouts
|
||||
|
||||
print("trackpad tests passed (displacement harvested, fractions kept, jumps browse, poller unhooks)")
|
||||
print("trackpad tests passed (displacement harvested, fractions kept, jumps browse, momentum settles, poller unhooks)")
|
||||
|
||||
|
||||
# with the configured modifier PgUp/PgDn page the view and Up/Down move it one
|
||||
@@ -641,6 +657,25 @@ plugin_settings.set("scroll_modifier", "shift")
|
||||
print("view scroll tests passed (a screen or a row per press, clamped to the anchor, configurable modifier)")
|
||||
|
||||
|
||||
# shift+enter through the whole keypress path: ESC CR by default, and the CSI 27
|
||||
# form once the app turned modifyOtherKeys on. pi enables it (its kitty probe
|
||||
# gets no flags from us) and reads a bare ESC CR as alt+enter, which submits
|
||||
press(key="enter", shift=True)
|
||||
assert terminal.process.written == "\x1b\r", repr(terminal.process.written)
|
||||
stream.feed("\x1b[>4;2m")
|
||||
press(key="enter", shift=True)
|
||||
assert terminal.process.written == "\x1b[27;2;13~", repr(terminal.process.written)
|
||||
press(key="enter")
|
||||
assert terminal.process.written == "\r", "unmodified enter still submits"
|
||||
press(key="c", ctrl=True)
|
||||
assert terminal.process.written == "\x03", "ctrl+c stays a control byte"
|
||||
stream.feed("\x1b[>4;0m")
|
||||
press(key="enter", shift=True)
|
||||
assert terminal.process.written == "\x1b\r", repr(terminal.process.written)
|
||||
|
||||
print("modifyOtherKeys tests passed (shift+enter as CSI 27 while the app asks for it)")
|
||||
|
||||
|
||||
# a click in an unfocused group must focus the tab instead of reporting: we
|
||||
# replaced drag_select, which is what sublime focuses the group from
|
||||
class FakeWindow:
|
||||
|
||||
Reference in New Issue
Block a user