Skip to content

Commit

Permalink
reducing nested blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
TornaxO7 committed Feb 24, 2024
1 parent f8063bb commit 7fbcbc0
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,18 +1192,15 @@ fn goto_file_impl(cx: &mut Context, action: Action) {
valid_chars.contains(c) || c.is_alphabetic()
};

let start_pos = {
let cursor_pos = primary.cursor(text.slice(..));
let pre_cursor_pos = cursor_pos.saturating_sub(1);
let post_cursor_pos = cursor_pos.saturating_add(1);

if is_valid_path_char(&text.char(cursor_pos)) {
cursor_pos
} else if is_valid_path_char(&text.char(pre_cursor_pos)) {
pre_cursor_pos
} else {
post_cursor_pos
}
let cursor_pos = primary.cursor(text.slice(..));
let pre_cursor_pos = cursor_pos.saturating_sub(1);
let post_cursor_pos = cursor_pos.saturating_add(1);
let start_pos = if is_valid_path_char(&text.char(cursor_pos)) {
cursor_pos
} else if is_valid_path_char(&text.char(pre_cursor_pos)) {
pre_cursor_pos
} else {
post_cursor_pos
};

let prefix_len = text
Expand Down

0 comments on commit 7fbcbc0

Please sign in to comment.