Describe the bugshow_text_box_popup does not properly position cursor when HOME and END keys are pressed. Instead of positioning at the start of the popup input box, HOME sends the cursor to the start of the line (left edge of terminal). END positions the cursor offset from the start of the line instead of the start of the popup box.
To Reproduce
Steps to reproduce the behavior:
Open a popup text box.
Enter text.
Press HOME key and press END key.
Expected behavior
HOME and END should position the cursor within the bounding box of the popup.
Root Cause
Root cause is that _initial_cursor position of the TextBoxImplementation is always set to 0.
Because the _jump_to_start and _jump_to_end methods in TextBoxImplemenation use the _initial_cursor position to place the cursor, which is currently always set to 0 thus causing the issue.
Describe the bug
show_text_box_popup
does not properly position cursor when HOME and END keys are pressed. Instead of positioning at the start of the popup input box, HOME sends the cursor to the start of the line (left edge of terminal). END positions the cursor offset from the start of the line instead of the start of the popup box.To Reproduce Steps to reproduce the behavior:
Expected behavior HOME and END should position the cursor within the bounding box of the popup.
Root Cause Root cause is that
_initial_cursor
position of theTextBoxImplementation
is always set to0
.https://github.com/jwlodek/py_cui/blob/f1173ca3ad93683dcbbed886260940375272fc8a/py_cui/ui.py#L485
As a workaround, I have to use this hack:
I believe the fix for this is modifying
update_height_width
ofTextBoxPopup
:Because the
_jump_to_start
and_jump_to_end
methods inTextBoxImplemenation
use the_initial_cursor
position to place the cursor, which is currently always set to0
thus causing the issue.https://github.com/jwlodek/py_cui/blob/f1173ca3ad93683dcbbed886260940375272fc8a/py_cui/ui.py#L625-L638
*Environment:*