1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-21 11:50:42 +03:00

fix(wezterm-gui): Move word able to jump next line

This commit is contained in:
gzliew 2023-01-14 10:37:21 +08:00 committed by Wez Furlong
parent aadc8224e9
commit 20c8135fc5

View File

@ -837,28 +837,23 @@ impl CopyRenderable {
if let Some(word) = words.next() {
self.cursor.x += unicode_column_width(word, None);
if !is_whitespace_word(word) {
// We were part-way through a word, so look
// at the next word
if let Some(word) = words.next() {
if is_whitespace_word(word) {
self.cursor.x += unicode_column_width(word, None);
// If we advance off the RHS, move to the start of the word on the
// next line, if any!
if self.cursor.x >= width {
let dims = self.delegate.get_dimensions();
let max_row = dims.scrollback_top + dims.scrollback_rows as isize;
if self.cursor.y + 1 < max_row {
self.cursor.y += 1;
return self.move_to_start_of_line_content();
}
}
}
}
} else {
// We were in whitespace and advancing
// has put us at the start of the next word
}
}
if self.cursor.x >= width {
let dims = self.delegate.get_dimensions();
let max_row = dims.scrollback_top + dims.scrollback_rows as isize;
if self.cursor.y + 1 < max_row {
self.cursor.y += 1;
return self.move_to_start_of_line_content();
}
}
}
self.select_to_cursor_pos();
}