Compare commits
No commits in common. "1c1b9c15102339ba103eda17f57dc8da0bbe0269" and "6256501b7d027a0e8620c180219bd9c6bfc23559" have entirely different histories.
1c1b9c1510
...
6256501b7d
@ -10,7 +10,6 @@ import os
|
||||
import config
|
||||
from .agent import log
|
||||
from tools.coder import set_current_workspace
|
||||
from . import keycodes
|
||||
|
||||
|
||||
def _build_visual(buffer, max_chars):
|
||||
@ -243,7 +242,7 @@ def model_selector_popup(app, stdscr):
|
||||
pass
|
||||
|
||||
win.refresh()
|
||||
key = keycodes.read_key(stdscr, -1)
|
||||
key = win.getch()
|
||||
|
||||
if key in (27, ord("q"), ord("Q")):
|
||||
break
|
||||
@ -346,7 +345,7 @@ def session_browser_popup(app, stdscr):
|
||||
win.addstr(y, 2, display.ljust(pw - 4), attr)
|
||||
|
||||
win.refresh()
|
||||
key = keycodes.read_key(stdscr, -1)
|
||||
key = win.getch()
|
||||
|
||||
if key in (27, ord("q"), ord("Q")):
|
||||
break
|
||||
@ -445,7 +444,7 @@ def session_search_popup(app, stdscr):
|
||||
win.addstr(y, 2, f" {label}"[:pw - 4].ljust(pw - 4), attr)
|
||||
|
||||
win.refresh()
|
||||
key = keycodes.read_key(stdscr, -1)
|
||||
key = win.getch()
|
||||
|
||||
if key in (27, ord("q"), ord("Q")):
|
||||
break
|
||||
|
||||
@ -94,12 +94,6 @@ _CSI_NAV = {
|
||||
"5~": KEY_PPAGE, "6~": KEY_NPAGE,
|
||||
}
|
||||
|
||||
# F1-F4 bentuk huruf (kitty protocol aktif): CSI P/Q/S = F1/F2/F4.
|
||||
# F3 (huruf R) dihapus dari spec (bentrok Cursor Position Report) → pakai [13~.
|
||||
_CSI_LETTER_F = {
|
||||
"P": KEY_F1, "Q": KEY_F2, "S": KEY_F4,
|
||||
}
|
||||
|
||||
|
||||
def _csi_mod(mod_str: str) -> int:
|
||||
# Modifier CSI-u: 1=default, 2=Shift, 3=Alt, 4=Shift+Alt, 5=Ctrl,
|
||||
@ -145,11 +139,6 @@ def _parse_csi(data: bytes) -> int:
|
||||
m2 = re.match(r"^\[(?:\d+;)?(\d*)([ABCDHF])$", text)
|
||||
if m2 and m2.group(2) in _CSI_NAV:
|
||||
return _CSI_NAV[m2.group(2)]
|
||||
# F1/F2/F4 bentuk huruf (kitty protocol aktif): \x1b[P / \x1b[Q / \x1b[S.
|
||||
# Modifier boleh ada (misal [1;2Q = Shift+F2); kode huruf tetap jadi patokan.
|
||||
mF = re.match(r"^\[(?:\d+;)*(\d*)([PQRS])$", text)
|
||||
if mF and mF.group(2) in _CSI_LETTER_F:
|
||||
return _CSI_LETTER_F[mF.group(2)]
|
||||
return KEY_ESC
|
||||
code = int(m27.group(2))
|
||||
mod = _csi_mod(m27.group(1))
|
||||
@ -225,23 +214,6 @@ def read_key(stdscr, timeout_ms: int = -1) -> int:
|
||||
break
|
||||
return _parse_csi(bytes(seq))
|
||||
|
||||
if nxt == ord("O"):
|
||||
# SS3 (application keypad): F1-F4 = \x1bOP..\x1bOS,
|
||||
# panah = \x1bOA..\x1bOD, Home/End = \x1bOH/\x1bOF.
|
||||
stdscr.timeout(ESC_PEEK_MS)
|
||||
try:
|
||||
c = stdscr.getch()
|
||||
finally:
|
||||
stdscr.timeout(timeout_ms)
|
||||
ss3 = {
|
||||
"P": KEY_F1, "Q": KEY_F2, "R": KEY_F3, "S": KEY_F4,
|
||||
"A": KEY_UP, "B": KEY_DOWN, "C": KEY_RIGHT, "D": KEY_LEFT,
|
||||
"H": KEY_HOME, "F": KEY_END,
|
||||
}
|
||||
if c != -1 and chr(c) in ss3:
|
||||
return ss3[chr(c)]
|
||||
return KEY_ALT("O") # Alt+Shift+O (bukan SS3)
|
||||
|
||||
if 32 <= nxt <= 126:
|
||||
return KEY_ALT(chr(nxt)) # Alt+<huruf> = "\x1b <huruf>"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user