-
-
Notifications
You must be signed in to change notification settings - Fork 50
Support Windows UNC path #245
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,18 @@ | ||
| function! fern#internal#command#do#command(mods, fargs) abort | ||
| function! fern#internal#command#do#command(mods, qargs) abort | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function interface must not be changed while the function itself is OK. |
||
| let winid_saved = win_getid() | ||
| try | ||
| let stay = fern#internal#args#pop(a:fargs, 'stay', v:false) | ||
| let drawer = fern#internal#args#pop(a:fargs, 'drawer', v:false) | ||
| let fargs = fern#internal#args#split(a:qargs) | ||
| let stay = fern#internal#args#pop(fargs, 'stay', v:false) | ||
| let drawer = fern#internal#args#pop(fargs, 'drawer', v:false) | ||
|
|
||
| if len(a:fargs) is# 0 | ||
| if len(fargs) is# 0 | ||
| \ || type(stay) isnot# v:t_bool | ||
| \ || type(drawer) isnot# v:t_bool | ||
| throw 'Usage: FernDo {expr...} [-drawer] [-stay]' | ||
| endif | ||
|
|
||
| " Does all options are handled? | ||
| call fern#internal#args#throw_if_dirty(a:fargs) | ||
| call fern#internal#args#throw_if_dirty(fargs) | ||
|
|
||
| let found = fern#internal#window#find( | ||
| \ funcref('s:predicator', [drawer]), | ||
|
|
@@ -21,7 +22,7 @@ function! fern#internal#command#do#command(mods, fargs) abort | |
| return | ||
| endif | ||
| call win_gotoid(win_getid(found)) | ||
| execute join([a:mods] + a:fargs, ' ') | ||
| execute join([a:mods] + fargs, ' ') | ||
| catch | ||
| echohl ErrorMsg | ||
| echo v:exception | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,14 @@ function! fern#internal#filepath#is_absolute(path) abort | |
| \ : s:is_absolute_unix(a:path) | ||
| endfunction | ||
|
|
||
| function! fern#internal#filepath#is_unc_compat() abort | ||
| return g:fern#internal#filepath#is_windows | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If Neovim 0.4.4 does not support the UNC path, we should check it here, right? Additionally, it would be nice to make an issue on the Neovim side and put the issue URL here to explain why we need to exclude Neovim. |
||
| endfunction | ||
|
|
||
| function! fern#internal#filepath#is_uncpath(path) abort | ||
| return g:fern#internal#filepath#is_windows && s:is_uncpath(a:path) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should NOT check |
||
| endfunction | ||
|
|
||
| function! fern#internal#filepath#join(paths) abort | ||
| let paths = map( | ||
| \ copy(a:paths), | ||
|
|
@@ -59,8 +67,12 @@ function! s:from_slash_windows(path) abort | |
| return path[:2] =~# '^\w:$' ? path . '\' : path | ||
| endfunction | ||
|
|
||
| function! s:is_uncpath(path) abort | ||
| return a:path =~# '^\\\\[^\\]\+' | ||
| endfunction | ||
|
|
||
| function! s:is_absolute_windows(path) abort | ||
| return a:path ==# '' || a:path[:2] =~# '^\w:\\$' | ||
| return a:path ==# '' || a:path[:2] =~# '^\w:\\$' || s:is_uncpath(a:path) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess it's not correct. It just checks if the |
||
| endfunction | ||
|
|
||
| function! s:is_absolute_unix(path) abort | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why you need to apply changes to
fern#fri#parse().Supporting the Windows UNC path should not touch FRI itself or let me know the reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix authority and path parsing.
Changed result of 'foo://bar/' below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. So this is kinda bug fix, right? It would be nice if you separate it to a different PR.