From 1c36bf8668e329b51f8baf752c4ffe42f8d524ab Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 4 Apr 2021 20:35:22 -0400 Subject: [PATCH] Sanity check line number fields --- autoload/rhubarb.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/rhubarb.vim b/autoload/rhubarb.vim index 26f52bc..fd216a6 100644 --- a/autoload/rhubarb.vim +++ b/autoload/rhubarb.vim @@ -274,9 +274,9 @@ function! rhubarb#FugitiveUrl(...) abort elseif get(opts, 'type', '') ==# 'blob' || opts.path =~# '[^/]$' let escaped_commit = substitute(commit, '#', '%23', 'g') 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 - elseif get(opts, 'line2') + elseif get(opts, 'line1') > 0 && get(opts, 'line2') > 0 let url .= '#L' . opts.line1 . '-L' . opts.line2 endif else