ZyX_I avatar ZyX_I committed 4d7525e

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

Comments (0)

Files changed (7)

aurum-addon-info.txt

         "test/parjobssetup.zsh",
         "test/regression-sav-cache.in",
         "test/regression-sav-cache.ok",
+        "test/regression-utils-run.in",
+        "test/regression-utils-run.ok",
+        "test/regression-utils-run.vim",
         "test/regression-vimdiff-nodiffoff.in",
         "test/regression-vimdiff-nodiffoff.ok",
         "test/runtime.tar.xz",

autoload/aurum/drivers/common/utils.vim

         "     some cases?
         let savedlazyredraw=&lazyredraw
         let savedeventignore=&eventignore
+        let savedbufhidden=&l:bufhidden
         set eventignore=all
         set lazyredraw
+        set bufhidden=hide
+        let prevbufnr=bufnr('%')
         try
-            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)
             endif
             " 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!
         finally
+            execute 'silent buffer!' prevbufnr
+            call setbufvar(prevbufnr, 'bufhidden', savedbufhidden)
             let &lazyredraw=savedlazyredraw
             let &eventignore=savedeventignore
         endtry

autoload/aurum/edit.vim

                 let &eventignore=savedei
             endtry
             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
             endif

test/gentests-setuptestrepos.zsh

 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
 do
     ln -s util-add-modified-repo.zsh $test.pre
 done

test/regression-utils-run.in

+:source `=g:curtest.'.vim'`

test/regression-utils-run.ok

+1
+[['abc'], 0]
+1
+cba
+fed

test/regression-utils-run.vim

+execute frawor#Setup('0.0', {'@%aurum/drivers/common/utils': '1.0'})
+edit abc
+call setline(1, 'cba')
+tabedit def
+call setline(1, 'fed')
+tabprevious
+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))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.