comparison src/testdir/test_cmdline.vim @ 18463:18d7337b6837 v8.1.2225

patch 8.1.2225: the "last used" info of a buffer is under used Commit: https://github.com/vim/vim/commit/52410575be50d5c40bbe6380159df48cfc382ceb Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 27 05:12:45 2019 +0100 patch 8.1.2225: the "last used" info of a buffer is under used Problem: The "last used" info of a buffer is under used. Solution: Add "lastused" to getbufinfo(). List buffers sorted by last-used field. (Andi Massimino, closes #4722)
author Bram Moolenaar <Bram@vim.org>
date Sun, 27 Oct 2019 05:15:06 +0100
parents b0b37bd807ba
children 99fc29219b3e
comparison
equal deleted inserted replaced
18462:395349479800 18463:18d7337b6837
765 call feedkeys("q::call win_gotoid(" .. winid .. ")\<CR>:q\<CR>", 'x!') 765 call feedkeys("q::call win_gotoid(" .. winid .. ")\<CR>:q\<CR>", 'x!')
766 catch /^Vim\%((\a\+)\)\=:E11/ 766 catch /^Vim\%((\a\+)\)\=:E11/
767 endtry 767 endtry
768 bw! 768 bw!
769 endfunc 769 endfunc
770
771 func Test_buffers_lastused()
772 " check that buffers are sorted by time when wildmode has lastused
773 call test_settime(1550020000) " middle
774 edit bufa
775 enew
776 call test_settime(1550030000) " newest
777 edit bufb
778 enew
779 call test_settime(1550010000) " oldest
780 edit bufc
781 enew
782 call test_settime(0)
783 enew
784
785 call assert_equal(['bufa', 'bufb', 'bufc'],
786 \ getcompletion('', 'buffer'))
787
788 let save_wildmode = &wildmode
789 set wildmode=full:lastused
790
791 let cap = "\<c-r>=execute('let X=getcmdline()')\<cr>"
792 call feedkeys(":b \<tab>" .. cap .. "\<esc>", 'xt')
793 call assert_equal('b bufb', X)
794 call feedkeys(":b \<tab>\<tab>" .. cap .. "\<esc>", 'xt')
795 call assert_equal('b bufa', X)
796 call feedkeys(":b \<tab>\<tab>\<tab>" .. cap .. "\<esc>", 'xt')
797 call assert_equal('b bufc', X)
798 enew
799
800 edit other
801 call feedkeys(":b \<tab>" .. cap .. "\<esc>", 'xt')
802 call assert_equal('b bufb', X)
803 call feedkeys(":b \<tab>\<tab>" .. cap .. "\<esc>", 'xt')
804 call assert_equal('b bufa', X)
805 call feedkeys(":b \<tab>\<tab>\<tab>" .. cap .. "\<esc>", 'xt')
806 call assert_equal('b bufc', X)
807 enew
808
809 let &wildmode = save_wildmode
810
811 bwipeout bufa
812 bwipeout bufb
813 bwipeout bufc
814 endfunc