fix(compatibility): do not crash when padding before wide char (#540)
* fix(compatibility): do not crash when padding before wide char * style(clippy): make less clear because clippy
This commit is contained in:
parent
774858f240
commit
12709e3e48
1 changed files with 2 additions and 0 deletions
|
|
@ -1769,6 +1769,8 @@ impl Row {
|
||||||
let mut replace_with = vec![terminal_character; to + width_of_current_character];
|
let mut replace_with = vec![terminal_character; to + width_of_current_character];
|
||||||
if to_position_accounting_for_widechars > self.columns.len() {
|
if to_position_accounting_for_widechars > self.columns.len() {
|
||||||
self.columns.clear();
|
self.columns.clear();
|
||||||
|
} else if to_position_accounting_for_widechars >= self.columns.len() {
|
||||||
|
drop(self.columns.drain(0..to_position_accounting_for_widechars));
|
||||||
} else {
|
} else {
|
||||||
drop(self.columns.drain(0..=to_position_accounting_for_widechars));
|
drop(self.columns.drain(0..=to_position_accounting_for_widechars));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue