From 6a7ec9732b8f6964f07e112b27eda8b4fa6920f7 Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Thu, 19 Mar 2026 00:45:07 -0400 Subject: [PATCH] tui: fix cursor position calculation The cursor index is into self.input, but the rendered buffer contains the prompt prepended to the first line. Need to add prompt.len() to get the correct character position when scanning the buffer. --- poc-agent/src/tui.rs | 3 ++- scripts/provision-vllm.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/poc-agent/src/tui.rs b/poc-agent/src/tui.rs index 4d69034..6f6c90b 100644 --- a/poc-agent/src/tui.rs +++ b/poc-agent/src/tui.rs @@ -821,6 +821,7 @@ impl App { // Cursor position: scan the rendered buffer to find where the cursor should be. // This matches ratatui's actual word wrapping instead of trying to simulate it. let buffer = frame.buffer_mut(); + let cursor_char = prompt.len() + self.cursor; // Total chars from start (prompt + input) let mut char_count = 0usize; let mut cursor_x = input_area.x; let mut cursor_y = input_area.y; @@ -833,7 +834,7 @@ impl App { // Count visible characters (skip zero-width and empty) if !symbol.is_empty() { let width = symbol.width(); - if char_count + width > self.cursor { + if char_count + width > cursor_char { // Found the cursor position cursor_x = x; cursor_y = y; diff --git a/scripts/provision-vllm.sh b/scripts/provision-vllm.sh index ee35670..e5702ed 100755 --- a/scripts/provision-vllm.sh +++ b/scripts/provision-vllm.sh @@ -51,7 +51,7 @@ exec vllm serve "$MODEL" \ --max-model-len "$MAX_MODEL_LEN" \ --gpu-memory-utilization "$GPU_MEMORY_UTILIZATION" \ --enable-prefix-caching \ - --tool-call-parser qwen3_xml \ + --tool-call-parser hermes \ --enable-auto-tool-choice \ --reasoning-parser=qwen3 \ --uvicorn-log-level warning