Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
The functions trims surrounding `'`, `"`, `(` and `)` before opening the path.

The `current_word` selection was inverted so that now it works from both the first and last characters of the word.
  • Loading branch information
dariooddenino committed Oct 19, 2022
1 parent 418a622 commit 8c3cd81
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1031,9 +1031,9 @@ fn goto_file_impl(cx: &mut Context, action: Action) {
.collect();
let primary = selections.primary();
if selections.len() == 1 && primary.to() - primary.from() == 1 {
let current_word = movement::move_next_long_word_start(
let current_word = movement::move_prev_long_word_start(
text.slice(..),
movement::move_prev_long_word_start(text.slice(..), primary, 1),
movement::move_next_long_word_start(text.slice(..), primary, 1),
1,
);
paths.clear();
Expand All @@ -1043,7 +1043,8 @@ fn goto_file_impl(cx: &mut Context, action: Action) {
);
}
for sel in paths {
let p = sel.trim();
let surrounding_chars: &[_] = &['\'', '"', '(', ')'];
let p = sel.trim().trim_matches(surrounding_chars);
if !p.is_empty() {
if let Err(e) = cx.editor.open(&PathBuf::from(p), action) {
cx.editor.set_error(format!("Open file failed: {:?}", e));
Expand Down

0 comments on commit 8c3cd81

Please sign in to comment.