mirror of
https://github.com/tpope/vim-rhubarb.git
synced 2025-12-09 05:24:51 +08:00
Sanity check line number fields
This commit is contained in:
@@ -274,9 +274,9 @@ function! rhubarb#FugitiveUrl(...) abort
|
|||||||
elseif get(opts, 'type', '') ==# 'blob' || opts.path =~# '[^/]$'
|
elseif get(opts, 'type', '') ==# 'blob' || opts.path =~# '[^/]$'
|
||||||
let escaped_commit = substitute(commit, '#', '%23', 'g')
|
let escaped_commit = substitute(commit, '#', '%23', 'g')
|
||||||
let url = root . '/blob/' . escaped_commit . '/' . path
|
let url = root . '/blob/' . escaped_commit . '/' . path
|
||||||
if get(opts, 'line2') && opts.line1 == opts.line2
|
if get(opts, 'line2') > 0 && get(opts, 'line1') == opts.line2
|
||||||
let url .= '#L' . opts.line1
|
let url .= '#L' . opts.line1
|
||||||
elseif get(opts, 'line2')
|
elseif get(opts, 'line1') > 0 && get(opts, 'line2') > 0
|
||||||
let url .= '#L' . opts.line1 . '-L' . opts.line2
|
let url .= '#L' . opts.line1 . '-L' . opts.line2
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user