Description
If a user deletes text, newText.slice(this.lastInputLength) in source/utils/paste-detection.ts returns garbage characters from the middle of the text instead of early-returning.
Environment
- OS: (e.g., macOS 14.0, Ubuntu 22.04, Windows 11)
- Node version: (run
node --version)
- Nanocoder version: (run
nanocoder --version)
- Provider: (e.g., Ollama, OpenRouter, OpenAI-compatible API)
- Model: (e.g., llama3.2, claude-3.5-sonnet)
Steps to Reproduce
- Delete text in the prompt input.
- Inspect the paste detection event payloads.
Expected Behavior
The logic should early-return if charsAdded <= 0.
Actual Behavior
It processes a negative offset and returns garbage characters.
Logs/Screenshots
N/A
Additional Context
Description
If a user deletes text,
newText.slice(this.lastInputLength)insource/utils/paste-detection.tsreturns garbage characters from the middle of the text instead of early-returning.Environment
node --version)nanocoder --version)Steps to Reproduce
Expected Behavior
The logic should early-return if
charsAdded <= 0.Actual Behavior
It processes a negative offset and returns garbage characters.
Logs/Screenshots
N/A
Additional Context