Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goto_file_vsplit url behavior is unobvious #10621

Closed
l4l opened this issue Apr 28, 2024 · 2 comments · Fixed by #10622
Closed

goto_file_vsplit url behavior is unobvious #10621

l4l opened this issue Apr 28, 2024 · 2 comments · Fixed by #10622
Labels
C-enhancement Category: Improvements

Comments

@l4l
Copy link
Contributor

l4l commented Apr 28, 2024

For all cases steps are:

  1. % # select_all
  2. Alt-s # split_selection_on_newline
  3. Ctrl-W F # goto_file_vsplit

The strange behavior because once URL is found it stops further processing:

if let Ok(url) = Url::parse(p) {
return open_url(cx, url, action);
}

Besides, if the file is a valid URL it could not be opened. Which may be strange yet the behavior differs with the :open command.

Case 0

Input:

a
b
c

Result: opens files a, b, and c.

Case 1

Input:

a
http://example.com

Result: opens file a and the URL once.

Case 2

Input:

http://example.com
a

Result: opens the URL once.

Case 3

Input:

http://example.com
http://example1.com
http://example2.com

Result: opens the URL once.

@l4l l4l added the C-enhancement Category: Improvements label Apr 28, 2024
@pascalkuthe
Copy link
Member

The strange behavior because once URL is found it stops further processing:

yeah that is a good catch we should probably just use continue instead of return in that case.

Besides, if the file is a valid URL it could not be opened. Which may be strange yet the behavior differs with the :open command.

I don't think this is actually something that happens in practice. Nobody names their file https://... and in those rare cases its ok to yank the selection and pase into :open

@l4l
Copy link
Contributor Author

l4l commented Apr 28, 2024

Note, http://xyz.abc after normalization is actually a http: directory with a file xyz.abc, which is still weird though.

UPD: file:// is also handled for url, so it's not really hard to "workaround" that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants