You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
password input cursor advances every 2 characters instead of 1 #163
when connecting to a new WiFi network, the program prompts for input using an input box. the cursor movement however isn't correct. instead of advancing after each character it advances after each two characters.
this bug is purely visual, it doesn't affect correctness.
After thinking about this, i initially thought this can't be solved as long as text remains centered in the input box: centered text has to snap to terminal cells, text can't shift by a half a cell to stay centered on odd lengths, so it instead shifts a whole cell every other character. so since it takes two characters for the text cells to shift, the cursor has to also advance every other character to stay in sync.
i wasn't wrong, it's true that the cursor would have to move every other character. But i realized that the issues isn't really that "the cursor advances every 2 characters instead of 1", that is completely fine. The user (me) doesn't really notice changes in the absolute position of the cursor. what the user notices is the position of the cursor relative to the text he/she is typing, they expect the interaction between text and cursor to be familiar !
The solution is simple: text and cursor should take turns shifting, that way the text does shift every other character and the cursor does shift every other character (necessary constraints of centering).
Whenever the user types a character, the text shifts or stays where it is. if the text shift, the cursor stays in place, if the text doesn't shift then the cursor shifts to covey movement.
I am reopening the issue because the cursor is still broken when the terminal width is under 79 cells and is even.
The fix in #164 was a workaroud. it didn't fix the underlying problem. #165 did cursor calculation correctly, i rebased it on latest main and patched it to match the behavior you intended in #164, however because github doesn't track commits into a branch of a closed pull request, i had to reopen the branch as a new pull request #167
Activity
adem482p commentedon Oct 3, 2026
I believe this is the relevant code:
impala/src/mode/station/auth/psk.rs
Lines 150 to 160 in 7587092
Per my quick printf debugging:
let pad_left = if inner_width > pass_len { inner_width.saturating_sub(pass_len) / 2 } else { 0 }; let visual_cursor = self.passphrase.visual_cursor().min(pass_len); let x_in_inner = pad_left + visual_cursor; let cursor_x = passkey_area.x + 1 + x_in_inner as u16; +log::debug!("pass_len: {pass_len}"); +log::debug!("pad_left: {pad_left}"); +log::debug!("visual_cursor: {visual_cursor}"); +log::debug!("x_in_inner: {x_in_inner}"); +log::debug!("cursor_x: {cursor_x}"); +log::debug!("");adem482p commentedon Oct 3, 2026
After thinking about this, i initially thought this can't be solved as long as text remains centered in the input box: centered text has to snap to terminal cells, text can't shift by a half a cell to stay centered on odd lengths, so it instead shifts a whole cell every other character. so since it takes two characters for the text cells to shift, the cursor has to also advance every other character to stay in sync.
i wasn't wrong, it's true that the cursor would have to move every other character. But i realized that the issues isn't really that "the cursor advances every 2 characters instead of 1", that is completely fine. The user (me) doesn't really notice changes in the absolute position of the cursor. what the user notices is the position of the cursor relative to the text he/she is typing, they expect the interaction between text and cursor to be familiar !
The solution is simple: text and cursor should take turns shifting, that way the text does shift every other character and the cursor does shift every other character (necessary constraints of centering).
Whenever the user types a character, the text shifts or stays where it is. if the text shift, the cursor stays in place, if the text doesn't shift then the cursor shifts to covey movement.
Old behavior
video.mp4
New behaviour
video.mp4
pythops commentedon Oct 3, 2026
this PR should fix it #164
can you give it a try 🙏 ?
adem482p commentedon Oct 3, 2026
my bad ! i saw that the issue tracker is empty and i assumed the bug wasn't being worked on.
yup that fixes it!
fix cursor position in the password popup
Fix PSK cursor centering to ride last character
adem482p commentedon Oct 4, 2026
I am reopening the issue because the cursor is still broken when the terminal width is under 79 cells and is even.
The fix in #164 was a workaroud. it didn't fix the underlying problem. #165 did cursor calculation correctly, i rebased it on latest main and patched it to match the behavior you intended in #164, however because github doesn't track commits into a branch of a closed pull request, i had to reopen the branch as a new pull request #167
Fix PSK cursor centering to ride last character (pythops#167)