-
Notifications
You must be signed in to change notification settings - Fork 366
Description
Description
When using a textarea component, the cursor can get stuck and stop responding to up/down arrow key navigation. This might be due to off-by-one errors in the boundary condition checks within CursorDown() and CursorUp(). The comparison offset >= nli.CharWidth-1 exits the cursor positioning loop one iteration too early, preventing the cursor from reaching the correct column position on the target line.
Also when the content of a line (including spaces) exactly equals the textarea width, the wrap() function incorrectly creates an extra empty line. The condition >= width triggers a line wrap even when the content fits perfectly within the available width, producing a phantom blank line in the display. You can reach the last character using Ctrl+E, but not using down arrow key.
Setup
- OS: Any
- Shell: Any
- Terminal Emulator: Any
- Terminal Multiplexer: N/A
- Locale: N/A
Steps
- Create a textarea with a specific width (e.g., 20 characters)
- Type a line of text where the total content (text + spaces) adds up to exactly the textarea width
- Observe an unexpected empty line appearing below the text
- Observe the cursor gets stuck and does not move beyond this line
Source Code
Refer the screenshot to see how the issue is recreated in story time example. Once setup, please try moving paste line 3 using down arrow key.
