mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
fix(dashboard): route browser wheel into inner TUI scrolling
This commit is contained in:
parent
8aceef539f
commit
7cbef2bd42
2 changed files with 34 additions and 7 deletions
|
|
@ -366,6 +366,40 @@ export default function ChatPage({ isActive = true }: { isActive?: boolean }) {
|
|||
fitRef.current = fit;
|
||||
term.loadAddon(fit);
|
||||
|
||||
// Single-scroll-system experiment:
|
||||
// keep browser xterm as a display/input bridge only, and let the inner
|
||||
// Hermes TUI own transcript scrolling.
|
||||
//
|
||||
// In practice, the most reliable path here is NOT terminal mouse-wheel
|
||||
// protocol emulation — that can vary by terminal mode and parser path.
|
||||
// The inner TUI already handles keyboard-driven transcript scrolling
|
||||
// correctly (`Shift+Up` / `Shift+Down`, `PageUp` / `PageDown`), so we
|
||||
// translate browser wheel gestures into those known-good key sequences.
|
||||
term.attachCustomWheelEventHandler((ev) => {
|
||||
if (wsRef.current?.readyState !== WebSocket.OPEN) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const delta = ev.deltaY;
|
||||
if (!delta) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Shift+Up / Shift+Down: the TUI maps these to line-by-line
|
||||
// transcript scrolling, which feels much closer to wheel behavior
|
||||
// than PageUp/PageDown's half-page jumps.
|
||||
const step = Math.max(1, Math.round(Math.abs(delta) / 50));
|
||||
const seq = delta > 0 ? "\x1b[1;2B" : "\x1b[1;2A";
|
||||
|
||||
for (let i = 0; i < step; i++) {
|
||||
wsRef.current.send(seq);
|
||||
}
|
||||
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
return false;
|
||||
});
|
||||
|
||||
const unicode11 = new Unicode11Addon();
|
||||
term.loadAddon(unicode11);
|
||||
term.unicode.activeVersion = "11";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue