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.
This commit is contained in:
parent
ec79d60fbd
commit
6a7ec9732b
2 changed files with 3 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue