mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-07 02:51:50 +00:00
fix(tui): address review feedback
This commit is contained in:
parent
355e0ae960
commit
381121025e
4 changed files with 13 additions and 5 deletions
|
|
@ -356,6 +356,9 @@ def test_complete_slash_includes_tui_details_command():
|
||||||
|
|
||||||
|
|
||||||
def test_complete_slash_details_args():
|
def test_complete_slash_details_args():
|
||||||
|
resp_root = server.handle_request(
|
||||||
|
{"id": "0", "method": "complete.slash", "params": {"text": "/details"}}
|
||||||
|
)
|
||||||
resp_section = server.handle_request(
|
resp_section = server.handle_request(
|
||||||
{"id": "1", "method": "complete.slash", "params": {"text": "/details t"}}
|
{"id": "1", "method": "complete.slash", "params": {"text": "/details t"}}
|
||||||
)
|
)
|
||||||
|
|
@ -367,6 +370,7 @@ def test_complete_slash_details_args():
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
assert resp_root["result"]["replace_from"] == len("/details")
|
||||||
assert any(item["text"] == "thinking" for item in resp_section["result"]["items"])
|
assert any(item["text"] == "thinking" for item in resp_section["result"]["items"])
|
||||||
assert any(item["text"] == "expanded" for item in resp_mode["result"]["items"])
|
assert any(item["text"] == "expanded" for item in resp_mode["result"]["items"])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3822,7 +3822,10 @@ def _(rid, params: dict) -> dict:
|
||||||
if details_items is not None:
|
if details_items is not None:
|
||||||
return _ok(
|
return _ok(
|
||||||
rid,
|
rid,
|
||||||
{"items": details_items, "replace_from": text.rfind(" ") + 1},
|
{
|
||||||
|
"items": details_items,
|
||||||
|
"replace_from": text.rfind(" ") + 1 if " " in text else len(text),
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
return _ok(
|
return _ok(
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,10 @@ describe('input metrics helpers', () => {
|
||||||
expect(inputVisualHeight('one\ntwo', 40)).toBe(2)
|
expect(inputVisualHeight('one\ntwo', 40)).toBe(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('reserves a stable transcript scrollbar gutter for composer width', () => {
|
it('reserves gutters without exceeding the physical terminal width', () => {
|
||||||
expect(stableComposerColumns(100, 3)).toBe(93)
|
expect(stableComposerColumns(100, 3)).toBe(93)
|
||||||
expect(stableComposerColumns(10, 3)).toBe(20)
|
expect(stableComposerColumns(10, 3)).toBe(3)
|
||||||
|
expect(stableComposerColumns(6, 3)).toBe(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,9 @@ export function inputVisualHeight(value: string, columns: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function stableComposerColumns(totalCols: number, promptWidth: number) {
|
export function stableComposerColumns(totalCols: number, promptWidth: number) {
|
||||||
// totalCols is the terminal width. Reserve:
|
// Physical render/wrap width. Reserve:
|
||||||
// - outer composer paddingX={1}: 2 columns
|
// - outer composer paddingX={1}: 2 columns
|
||||||
// - transcript scrollbar gutter + marginLeft: 2 columns
|
// - transcript scrollbar gutter + marginLeft: 2 columns
|
||||||
// - prompt prefix width
|
// - prompt prefix width
|
||||||
return Math.max(20, totalCols - promptWidth - 4)
|
return Math.max(1, totalCols - promptWidth - 4)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue