File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -336,8 +336,13 @@ impl Term {
336336 loop {
337337 match slf. read_key ( ) ? {
338338 Key :: Backspace => {
339- if prefix_len < chars. len ( ) && chars. pop ( ) . is_some ( ) {
340- slf. clear_chars ( 1 ) ?;
339+ if prefix_len < chars. len ( ) {
340+ if let Some ( ch) = chars. pop ( ) {
341+ #[ cfg( feature = "ansi-parsing" ) ]
342+ slf. clear_chars ( crate :: utils:: char_width ( ch) ) ?;
343+ #[ cfg( not( feature = "ansi-parsing" ) ) ]
344+ slf. clear_chars ( 1 ) ?;
345+ }
341346 }
342347 slf. flush ( ) ?;
343348 }
Original file line number Diff line number Diff line change @@ -719,7 +719,7 @@ fn str_width(s: &str) -> usize {
719719}
720720
721721#[ cfg( feature = "ansi-parsing" ) ]
722- fn char_width ( c : char ) -> usize {
722+ pub ( crate ) fn char_width ( c : char ) -> usize {
723723 #[ cfg( feature = "unicode-width" ) ]
724724 {
725725 use unicode_width:: UnicodeWidthChar ;
You canβt perform that action at this time.
0 commit comments