1. ZyX_I
  2. aurum


ZyX_I  committed 4d7525e

Fix s:utils.run function in case it is run not in the last tab

  • Participants
  • Parent commits 50f99ad
  • Branches default

Comments (0)

Files changed (7)

File aurum-addon-info.txt

View file
  • Ignore whitespace
+        "test/regression-utils-run.in",
+        "test/regression-utils-run.ok",
+        "test/regression-utils-run.vim",

File autoload/aurum/drivers/common/utils.vim

View file
  • Ignore whitespace
         "     some cases?
         let savedlazyredraw=&lazyredraw
         let savedeventignore=&eventignore
+        let savedbufhidden=&l:bufhidden
         set eventignore=all
         set lazyredraw
+        set bufhidden=hide
+        let prevbufnr=bufnr('%')
-            try
-                tabnew
-            catch /^Vim(tabnew):E523:/
-                let r=s:utils.run(a:cmd, 2, a:cdpath)
-                if empty(r[-1])
-                    call remove(r, -1)
-                endif
-                return r
-            endtry
-            setlocal buftype=nofile modifiable noreadonly
+            enew
+            let newbufnr=bufnr('%')
+            setlocal buftype=nofile modifiable noreadonly bufhidden=wipe
             if !empty(a:cdpath)
                 execute 'lcd' fnameescape(a:cdpath)
             " without trailing newline, and also is “smart” about lineendings
             silent execute '%!'.join(map(copy(a:cmd), 'shellescape(v:val, 1)'))
             let r=getline(1, '$')
-            bwipeout!
+            execute 'silent buffer!' prevbufnr
+            call setbufvar(prevbufnr, 'bufhidden', savedbufhidden)
             let &lazyredraw=savedlazyredraw
             let &eventignore=savedeventignore

File autoload/aurum/edit.vim

View file
  • Ignore whitespace
                 let &eventignore=savedei
             setlocal modifiable noreadonly
-            silent call s:F.runcmd(s:commands[a:command], file, [0, a:repo]+args)
+            silent call s:F.runcmd(s:commands[a:command], file, [0,a:repo]+args)
             if bufexists(prevbuf)
                 let s:_r.bufvars[bufnr('%')].prevbuf=prevbuf

File test/gentests-setuptestrepos.zsh

View file
  • Ignore whitespace
 for test in cmd-annotate-buffers cmd+maps-commit cmd-record cmd-status \
             maps-status cmd+maps-vimdiff cmd-diff cmd-update opts-remembermsg \
             opts-vimdiffusewin cmd-vimdiff-full cmdaus maps-record-undo \
-            maps-commit-diff
+            maps-commit-diff regression-commit-tabs
     ln -s util-add-modified-repo.zsh $test.pre

File test/regression-utils-run.in

View file
  • Ignore whitespace
+:source `=g:curtest.'.vim'`

File test/regression-utils-run.ok

View file
  • Ignore whitespace
+[['abc'], 0]

File test/regression-utils-run.vim

View file
  • Ignore whitespace
+execute frawor#Setup('0.0', {'@%aurum/drivers/common/utils': '1.0'})
+edit abc
+call setline(1, 'cba')
+tabedit def
+call setline(1, 'fed')
+call WriteFile(tabpagenr())
+call WriteFile(string(s:_r.utils.run(['echo', 'abc'], 1, 0)))
+call WriteFile(tabpagenr())
+call WriteFile(getline(1))
+call WriteFile(getbufline(2, 1))