mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-03 02:11:48 +00:00
Merge pull request #17701 from NousResearch/bb/mouse-mode-self-heal
fix(cli): recover leaked mouse tracking terminal state
This commit is contained in:
commit
285e9efb3f
5 changed files with 210 additions and 10 deletions
|
|
@ -55,3 +55,27 @@ class TestStripLeakedTerminalResponses:
|
|||
def test_preserves_multiline_content(self):
|
||||
text = "line 1\n\x1b[53;1Rline 2"
|
||||
assert _strip_leaked_terminal_responses(text) == "line 1\nline 2"
|
||||
|
||||
def test_strips_sgr_mouse_report_esc_form(self):
|
||||
text = "abc\x1b[<65;1;49Mdef"
|
||||
assert _strip_leaked_terminal_responses(text) == "abcdef"
|
||||
|
||||
def test_strips_sgr_mouse_report_visible_form(self):
|
||||
text = "abc^[[<65;1;49Mdef"
|
||||
assert _strip_leaked_terminal_responses(text) == "abcdef"
|
||||
|
||||
def test_strips_sgr_mouse_report_bare_form(self):
|
||||
text = "abc<65;1;49Mdef"
|
||||
assert _strip_leaked_terminal_responses(text) == "abcdef"
|
||||
|
||||
def test_strips_sgr_mouse_report_with_large_coordinates(self):
|
||||
text = "abc\x1b[<10000;12345;98765Mdef"
|
||||
assert _strip_leaked_terminal_responses(text) == "abcdef"
|
||||
|
||||
def test_strips_multiple_concatenated_sgr_mouse_reports(self):
|
||||
text = "<65;1;49M<35;1;42Mhello<64;1;40m"
|
||||
assert _strip_leaked_terminal_responses(text) == "hello"
|
||||
|
||||
def test_does_not_strip_regular_angle_bracket_text(self):
|
||||
text = "render <div class='hero'> literal"
|
||||
assert _strip_leaked_terminal_responses(text) == text
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue