Skip to content

Commit 82f91d7

Browse files
committed
Improve placement of new +Errors win yet again
1 parent 9ac5b5d commit 82f91d7

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

plugin/acme.vim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ function s:JobStart(cmd, outb, ctxb, opts, inp)
228228
endif
229229
endfunc
230230

231+
function s:InDir(path, dir)
232+
let n = len(a:dir)
233+
return a:path[:n-1] == a:dir && a:path[n:] =~ '\v^(/|$)' ? n : 0
234+
endfunc
235+
231236
function s:ErrorSplitPos(name)
232237
let [w, match, mod, rel] = [0, 0, '', '']
233238
let dir = fnamemodify(s:Path(a:name), ':h')
@@ -237,8 +242,8 @@ function s:ErrorSplitPos(name)
237242
let isdir = isdirectory(p)
238243
let d = isdir ? p : fnamemodify(p, ':h')
239244
let f = isdir ? '' : fnamemodify(p, ':t')
240-
let n = len(d)
241-
if n > match && dir[:n-1] == d && dir[n:] =~ '\v^(/|$)'
245+
let n = max([s:InDir(d, dir), s:InDir(dir, d)])
246+
if n > match
242247
let [w, match] = [i, n]
243248
let [mod, rel] = f == 'guide' || f == '+Errors'
244249
\ ? ['abo', '>'] : ['bel', '=']

0 commit comments

Comments
 (0)