File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -288,18 +288,21 @@ def insert_char(self, char):
288288 def handle_move_start (self ):
289289 """Move cursor to beginning (Ctrl+A)."""
290290 self .cursor_pos = 0
291+ self .refresh_display ()
291292
292293 def handle_move_end (self ):
293294 """Move cursor to end (Ctrl+E)."""
294295 self .cursor_pos = len (self .password )
296+ self .refresh_display ()
295297
296298 def handle_erase (self ):
297299 """Delete character before cursor (Backspace/DEL)."""
298- if self .cursor_pos < = 0 :
300+ if self .cursor_pos = = 0 :
299301 return
300- prev_len = len (self .password )
301- del self .password [self .cursor_pos - 1 ]
302+ assert self .cursor_pos > 0
302303 self .cursor_pos -= 1
304+ prev_len = len (self .password )
305+ del self .password [self .cursor_pos ]
303306 self .refresh_display (prev_len )
304307
305308 def handle_kill_line (self ):
@@ -340,6 +343,7 @@ def handle(self, char):
340343 def readline (self , input ):
341344 """Read a line of password input with echo character support."""
342345 while True :
346+ assert self .cursor_pos >= 0
343347 char = input .read (1 )
344348
345349 # Check for line terminators
You can’t perform that action at this time.
0 commit comments