Refactor: simplify word navigation logic, improve line wrapping, and enhance parameter initialization across core and TUI modules.
This commit is contained in:
@@ -305,9 +305,7 @@ pub fn find_word_end(line: &str, col: usize) -> Option<usize> {
|
||||
pos += 1;
|
||||
}
|
||||
// Move back one to be ON the last character
|
||||
if pos > 0 {
|
||||
pos -= 1;
|
||||
}
|
||||
pos = pos.saturating_sub(1);
|
||||
} else {
|
||||
// Skip non-word characters
|
||||
while pos < chars.len() && !is_word_char(chars[pos]) {
|
||||
@@ -317,9 +315,7 @@ pub fn find_word_end(line: &str, col: usize) -> Option<usize> {
|
||||
while pos < chars.len() && is_word_char(chars[pos]) {
|
||||
pos += 1;
|
||||
}
|
||||
if pos > 0 {
|
||||
pos -= 1;
|
||||
}
|
||||
pos = pos.saturating_sub(1);
|
||||
}
|
||||
|
||||
Some(pos)
|
||||
@@ -336,9 +332,7 @@ pub fn find_prev_word_boundary(line: &str, col: usize) -> Option<usize> {
|
||||
let is_word_char = |c: char| c.is_alphanumeric() || c == '_';
|
||||
|
||||
// Move back one position first
|
||||
if pos > 0 {
|
||||
pos -= 1;
|
||||
}
|
||||
pos = pos.saturating_sub(1);
|
||||
|
||||
// Skip non-word characters
|
||||
while pos > 0 && !is_word_char(chars[pos]) {
|
||||
|
||||
Reference in New Issue
Block a user