@@ -299,7 +299,7 @@ selected_choice(void)
299
299
}
300
300
301
301
tty_putp (cursor_invisible , 0 );
302
- tty_putp (carriage_return , 1 ); /* move cursor to first column */
302
+ tty_putp (carriage_return , 1 ); /* move cursor to first column */
303
303
if (cursor_position >= tty_columns )
304
304
xscroll = cursor_position - tty_columns + 1 ;
305
305
else
@@ -310,7 +310,7 @@ selected_choice(void)
310
310
yscroll = selection - choices_lines + 1 ;
311
311
choices_count = print_choices (yscroll , selection );
312
312
}
313
- tty_putp (carriage_return , 1 ); /* move cursor to first column */
313
+ tty_putp (carriage_return , 1 ); /* move cursor to first column */
314
314
for (i = j = 0 ; i < cursor_position ; j ++ )
315
315
while (isu8cont (query [++ i ]))
316
316
continue ;
@@ -463,10 +463,11 @@ selected_choice(void)
463
463
err (1 , NULL );
464
464
}
465
465
466
- if (cursor_position < query_length )
466
+ if (cursor_position < query_length ) {
467
467
memmove (query + cursor_position + length ,
468
468
query + cursor_position ,
469
469
query_length - cursor_position );
470
+ }
470
471
471
472
memcpy (query + cursor_position , buf , length );
472
473
cursor_position += length ;
@@ -834,10 +835,11 @@ print_choices(size_t offset, size_t selection)
834
835
if (choice -> score == 0 && query_length > 0 )
835
836
break ;
836
837
837
- if (i - offset < choices_lines )
838
+ if (i - offset < choices_lines ) {
838
839
print_line (choice -> string , choice -> length ,
839
840
i == selection , choice -> match_start ,
840
841
choice -> match_end );
842
+ }
841
843
}
842
844
843
845
if (i - offset < choices .length && i - offset < choices_lines ) {
0 commit comments