To: vim_dev@googlegroups.com Subject: Patch 8.1.2013 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2013 Problem: More functions can be used as methods. Solution: Make various functions usable as a method. Files: runtime/doc/eval.txt, src/evalfunc.c, src/testdir/test_cursor_func.vim, src/testdir/test_execute_func.vim, src/testdir/test_functions.vim, src/testdir/test_listchars.vim, src/testdir/test_timers.vim, src/testdir/test_undo.vim, src/testdir/test_window_cmd.vim, src/testdir/test_window_id.vim *** ../vim-8.1.2012/runtime/doc/eval.txt 2019-09-08 18:58:39.557952948 +0200 --- runtime/doc/eval.txt 2019-09-08 21:46:38.571394544 +0200 *************** *** 9736,9742 **** "callback" the callback "paused" 1 if the timer is paused, 0 otherwise ! {only available when compiled with the |+timers| feature} timer_pause({timer}, {paused}) *timer_pause()* Pause or unpause a timer. A paused timer does not invoke its --- 9750,9759 ---- "callback" the callback "paused" 1 if the timer is paused, 0 otherwise ! Can also be used as a |method|: > ! GetTimer()->timer_info() ! ! < {only available when compiled with the |+timers| feature} timer_pause({timer}, {paused}) *timer_pause()* Pause or unpause a timer. A paused timer does not invoke its *************** *** 9751,9757 **** String, then the timer is paused, otherwise it is unpaused. See |non-zero-arg|. ! {only available when compiled with the |+timers| feature} *timer_start()* *timer* *timers* timer_start({time}, {callback} [, {options}]) --- 9768,9777 ---- String, then the timer is paused, otherwise it is unpaused. See |non-zero-arg|. ! Can also be used as a |method|: > ! GetTimer()->timer_pause(1) ! ! < {only available when compiled with the |+timers| feature} *timer_start()* *timer* *timers* timer_start({time}, {callback} [, {options}]) *************** *** 9784,9790 **** < This will invoke MyHandler() three times at 500 msec intervals. ! Not available in the |sandbox|. {only available when compiled with the |+timers| feature} timer_stop({timer}) *timer_stop()* --- 9804,9813 ---- < This will invoke MyHandler() three times at 500 msec intervals. ! Can also be used as a |method|: > ! GetMsec()->timer_start(callback) ! ! < Not available in the |sandbox|. {only available when compiled with the |+timers| feature} timer_stop({timer}) *timer_stop()* *************** *** 9792,9798 **** {timer} is an ID returned by timer_start(), thus it must be a Number. If {timer} does not exist there is no error. ! {only available when compiled with the |+timers| feature} timer_stopall() *timer_stopall()* Stop all timers. The timer callbacks will no longer be --- 9815,9824 ---- {timer} is an ID returned by timer_start(), thus it must be a Number. If {timer} does not exist there is no error. ! Can also be used as a |method|: > ! GetTimer()->timer_stop() ! ! < {only available when compiled with the |+timers| feature} timer_stopall() *timer_stopall()* Stop all timers. The timer callbacks will no longer be *************** *** 9806,9816 **** --- 9832,9848 ---- characters turned into lowercase (just like applying |gu| to the string). + Can also be used as a |method|: > + GetText()->tolower() + toupper({expr}) *toupper()* The result is a copy of the String given, with all lowercase characters turned into uppercase (just like applying |gU| to the string). + Can also be used as a |method|: > + GetText()->toupper() + tr({src}, {fromstr}, {tostr}) *tr()* The result is a copy of the {src} string with all characters which appear in {fromstr} replaced by the character in that *************** *** 9825,9830 **** --- 9857,9865 ---- echo tr("", "<>", "{}") < returns "{blob}" + Can also be used as a |method|: > + GetText()->tr(from, to) + trim({text} [, {mask}]) *trim()* Return {text} as a String where any character in {mask} is removed from the beginning and end of {text}. *************** *** 9841,9846 **** --- 9876,9884 ---- echo trim("rmX>rrm", "rm<>") < returns "Xrm<>X" (characters in the middle are not removed) + Can also be used as a |method|: > + GetText()->trim() + trunc({expr}) *trunc()* Return the largest integral value with magnitude less than or equal to {expr} as a |Float| (truncate towards zero). *************** *** 9901,9906 **** --- 9939,9947 ---- When compiled without the |+persistent_undo| option this always returns an empty string. + Can also be used as a |method|: > + GetFilename()->undofile() + undotree() *undotree()* Return the current state of the undo tree in a dictionary with the following items: *************** *** 9999,10006 **** all lines: > echo max(map(range(1, line('$')), "virtcol([v:val, '$'])")) ! visualmode([expr]) *visualmode()* The result is a String, which describes the last Visual mode used in the current buffer. Initially it returns an empty string, but once Visual mode has been used, it returns "v", --- 10040,10050 ---- all lines: > echo max(map(range(1, line('$')), "virtcol([v:val, '$'])")) + < Can also be used as a |method|: > + GetPos()->virtcol() ! ! visualmode([{expr}]) *visualmode()* The result is a String, which describes the last Visual mode used in the current buffer. Initially it returns an empty string, but once Visual mode has been used, it returns "v", *************** *** 10014,10020 **** Visual mode that was used. If Visual mode is active, use |mode()| to get the Visual mode (e.g., in a |:vmap|). ! If [expr] is supplied and it evaluates to a non-zero Number or a non-empty String, then the Visual mode will be cleared and the old value is returned. See |non-zero-arg|. --- 10058,10064 ---- Visual mode that was used. If Visual mode is active, use |mode()| to get the Visual mode (e.g., in a |:vmap|). ! If {expr} is supplied and it evaluates to a non-zero Number or a non-empty String, then the Visual mode will be cleared and the old value is returned. See |non-zero-arg|. *************** *** 10043,10052 **** --- 10087,10103 ---- Not all commands are allowed in popup windows. When window {id} does not exist then no error is given. + Can also be used as a |method|, the base is used for the + command: > + GetCommand()->win_execute(winid) + win_findbuf({bufnr}) *win_findbuf()* Returns a list with |window-ID|s for windows that contain buffer {bufnr}. When there is none the list is empty. + Can also be used as a |method|: > + GetBufnr()->win_findbuf() + win_getid([{win} [, {tab}]]) *win_getid()* Get the |window-ID| for the specified window. When {win} is missing use the current window. *************** *** 10056,10075 **** --- 10107,10138 ---- number {tab}. The first tab has number one. Return zero if the window cannot be found. + Can also be used as a |method|: > + GetWinnr()->win_getid() + win_gotoid({expr}) *win_gotoid()* Go to window with ID {expr}. This may also change the current tabpage. Return 1 if successful, 0 if the window cannot be found. + Can also be used as a |method|: > + GetWinid()->win_gotoid() + win_id2tabwin({expr}) *win_id2tabwin()* Return a list with the tab number and window number of window with ID {expr}: [tabnr, winnr]. Return [0, 0] if the window cannot be found. + Can also be used as a |method|: > + GetWinid()->win_id2tabwin() + win_id2win({expr}) *win_id2win()* Return the window number of window with ID {expr}. Return 0 if the window cannot be found in the current tabpage. + Can also be used as a |method|: > + GetWinid()->win_id2win() + win_screenpos({nr}) *win_screenpos()* Return the screen position of window {nr} as a list with two numbers: [row, col]. The first window always has position *************** *** 10078,10083 **** --- 10141,10149 ---- Return [0, 0] if the window cannot be found in the current tabpage. + Can also be used as a |method|: > + GetWinid()->win_screenpos() + < *winbufnr()* winbufnr({nr}) The result is a Number, which is the number of the buffer associated with window {nr}. {nr} can be the window number or *************** *** 10105,10110 **** --- 10171,10179 ---- This excludes any window toolbar line. Examples: > :echo "The current window has " . winheight(0) . " lines." + + < Can also be used as a |method|: > + GetWinid()->winheight() < winlayout([{tabnr}]) *winlayout()* The result is a nested List containing the layout of windows *************** *** 10135,10140 **** --- 10204,10212 ---- ['col', [['leaf', 1002], ['row', ['leaf', 1003], ['leaf', 1001]]], ['leaf', 1000]] < + Can also be used as a |method|: > + GetTabnr()->winlayout() + < *winline()* winline() The result is a Number, which is the screen line of the cursor in the window. This is counting screen lines from the top of *************** *** 10168,10173 **** --- 10240,10248 ---- let window_count = winnr('$') let prev_window = winnr('#') let wnum = winnr('3k') + + < Can also be used as a |method|: > + GetWinval()->winnr() < *winrestcmd()* winrestcmd() Returns a sequence of |:resize| commands that should restore *************** *** 10196,10201 **** --- 10271,10279 ---- If you have changed the values the result is unpredictable. If the window size changed the result won't be the same. + Can also be used as a |method|: > + GetView()->winrestview() + < *winsaveview()* winsaveview() Returns a |Dictionary| that contains information to restore the view of the current window. Use |winrestview()| to *************** *** 10233,10238 **** --- 10311,10319 ---- < For getting the terminal or screen size, see the 'columns' option. + Can also be used as a |method|: > + GetWinid()->winwidth() + wordcount() *wordcount()* The result is a dictionary of byte/chars/word statistics for *************** *** 10294,10299 **** --- 10375,10383 ---- :let fl = readfile("foo", "b") :call writefile(fl, "foocopy", "b") + < Can also be used as a |method|: > + GetText()->writefile("thefile") + xor({expr}, {expr}) *xor()* Bitwise XOR on the two arguments. The arguments are converted *** ../vim-8.1.2012/src/evalfunc.c 2019-09-08 20:55:03.146072987 +0200 --- src/evalfunc.c 2019-09-08 21:47:39.331055709 +0200 *************** *** 822,867 **** #endif {"test_settime", 1, 1, FEARG_1, f_test_settime}, #ifdef FEAT_TIMERS ! {"timer_info", 0, 1, 0, f_timer_info}, ! {"timer_pause", 2, 2, 0, f_timer_pause}, ! {"timer_start", 2, 3, 0, f_timer_start}, ! {"timer_stop", 1, 1, 0, f_timer_stop}, {"timer_stopall", 0, 0, 0, f_timer_stopall}, #endif ! {"tolower", 1, 1, 0, f_tolower}, ! {"toupper", 1, 1, 0, f_toupper}, ! {"tr", 3, 3, 0, f_tr}, ! {"trim", 1, 2, 0, f_trim}, #ifdef FEAT_FLOAT {"trunc", 1, 1, FEARG_1, f_trunc}, #endif {"type", 1, 1, FEARG_1, f_type}, ! {"undofile", 1, 1, 0, f_undofile}, {"undotree", 0, 0, 0, f_undotree}, {"uniq", 1, 3, FEARG_1, f_uniq}, {"values", 1, 1, FEARG_1, f_values}, ! {"virtcol", 1, 1, 0, f_virtcol}, {"visualmode", 0, 1, 0, f_visualmode}, {"wildmenumode", 0, 0, 0, f_wildmenumode}, ! {"win_execute", 2, 3, 0, f_win_execute}, ! {"win_findbuf", 1, 1, 0, f_win_findbuf}, ! {"win_getid", 0, 2, 0, f_win_getid}, ! {"win_gotoid", 1, 1, 0, f_win_gotoid}, ! {"win_id2tabwin", 1, 1, 0, f_win_id2tabwin}, ! {"win_id2win", 1, 1, 0, f_win_id2win}, ! {"win_screenpos", 1, 1, 0, f_win_screenpos}, {"winbufnr", 1, 1, FEARG_1, f_winbufnr}, {"wincol", 0, 0, 0, f_wincol}, ! {"winheight", 1, 1, 0, f_winheight}, ! {"winlayout", 0, 1, 0, f_winlayout}, {"winline", 0, 0, 0, f_winline}, ! {"winnr", 0, 1, 0, f_winnr}, {"winrestcmd", 0, 0, 0, f_winrestcmd}, ! {"winrestview", 1, 1, 0, f_winrestview}, {"winsaveview", 0, 0, 0, f_winsaveview}, ! {"winwidth", 1, 1, 0, f_winwidth}, {"wordcount", 0, 0, 0, f_wordcount}, ! {"writefile", 2, 3, 0, f_writefile}, {"xor", 2, 2, FEARG_1, f_xor}, }; --- 822,867 ---- #endif {"test_settime", 1, 1, FEARG_1, f_test_settime}, #ifdef FEAT_TIMERS ! {"timer_info", 0, 1, FEARG_1, f_timer_info}, ! {"timer_pause", 2, 2, FEARG_1, f_timer_pause}, ! {"timer_start", 2, 3, FEARG_1, f_timer_start}, ! {"timer_stop", 1, 1, FEARG_1, f_timer_stop}, {"timer_stopall", 0, 0, 0, f_timer_stopall}, #endif ! {"tolower", 1, 1, FEARG_1, f_tolower}, ! {"toupper", 1, 1, FEARG_1, f_toupper}, ! {"tr", 3, 3, FEARG_1, f_tr}, ! {"trim", 1, 2, FEARG_1, f_trim}, #ifdef FEAT_FLOAT {"trunc", 1, 1, FEARG_1, f_trunc}, #endif {"type", 1, 1, FEARG_1, f_type}, ! {"undofile", 1, 1, FEARG_1, f_undofile}, {"undotree", 0, 0, 0, f_undotree}, {"uniq", 1, 3, FEARG_1, f_uniq}, {"values", 1, 1, FEARG_1, f_values}, ! {"virtcol", 1, 1, FEARG_1, f_virtcol}, {"visualmode", 0, 1, 0, f_visualmode}, {"wildmenumode", 0, 0, 0, f_wildmenumode}, ! {"win_execute", 2, 3, FEARG_2, f_win_execute}, ! {"win_findbuf", 1, 1, FEARG_1, f_win_findbuf}, ! {"win_getid", 0, 2, FEARG_1, f_win_getid}, ! {"win_gotoid", 1, 1, FEARG_1, f_win_gotoid}, ! {"win_id2tabwin", 1, 1, FEARG_1, f_win_id2tabwin}, ! {"win_id2win", 1, 1, FEARG_1, f_win_id2win}, ! {"win_screenpos", 1, 1, FEARG_1, f_win_screenpos}, {"winbufnr", 1, 1, FEARG_1, f_winbufnr}, {"wincol", 0, 0, 0, f_wincol}, ! {"winheight", 1, 1, FEARG_1, f_winheight}, ! {"winlayout", 0, 1, FEARG_1, f_winlayout}, {"winline", 0, 0, 0, f_winline}, ! {"winnr", 0, 1, FEARG_1, f_winnr}, {"winrestcmd", 0, 0, 0, f_winrestcmd}, ! {"winrestview", 1, 1, FEARG_1, f_winrestview}, {"winsaveview", 0, 0, 0, f_winsaveview}, ! {"winwidth", 1, 1, FEARG_1, f_winwidth}, {"wordcount", 0, 0, 0, f_wordcount}, ! {"writefile", 2, 3, FEARG_1, f_writefile}, {"xor", 2, 2, FEARG_1, f_xor}, }; *** ../vim-8.1.2012/src/testdir/test_cursor_func.vim 2019-09-06 22:45:47.574271573 +0200 --- src/testdir/test_cursor_func.vim 2019-09-08 21:33:47.126576886 +0200 *************** *** 83,89 **** call assert_equal({'row': winrow, \ 'col': wincol + 0, \ 'curscol': wincol + 7, ! \ 'endcol': wincol + 7}, screenpos(winid, 1, 1)) call assert_equal({'row': winrow, \ 'col': wincol + 13, \ 'curscol': wincol + 13, --- 83,89 ---- call assert_equal({'row': winrow, \ 'col': wincol + 0, \ 'curscol': wincol + 7, ! \ 'endcol': wincol + 7}, winid->screenpos(1, 1)) call assert_equal({'row': winrow, \ 'col': wincol + 13, \ 'curscol': wincol + 13, *** ../vim-8.1.2012/src/testdir/test_execute_func.vim 2019-08-09 14:56:19.552349976 +0200 --- src/testdir/test_execute_func.vim 2019-09-08 21:28:08.539687905 +0200 *************** *** 91,97 **** if has('textprop') let popupwin = popup_create('the popup win', {'line': 2, 'col': 3}) redraw ! let line = win_execute(popupwin, 'echo getline(1)') call assert_match('the popup win', line) call popup_close(popupwin) --- 91,97 ---- if has('textprop') let popupwin = popup_create('the popup win', {'line': 2, 'col': 3}) redraw ! let line = 'echo getline(1)'->win_execute(popupwin) call assert_match('the popup win', line) call popup_close(popupwin) *** ../vim-8.1.2012/src/testdir/test_functions.vim 2019-09-07 19:05:02.337280945 +0200 --- src/testdir/test_functions.vim 2019-09-08 21:47:20.491159330 +0200 *************** *** 266,272 **** func s:normalize_fname(fname) let ret = substitute(a:fname, '\', '/', 'g') let ret = substitute(ret, '//', '/', 'g') ! return tolower(ret) endfunc func Test_resolve_win32() --- 266,272 ---- func s:normalize_fname(fname) let ret = substitute(a:fname, '\', '/', 'g') let ret = substitute(ret, '//', '/', 'g') ! return ret->tolower() endfunc func Test_resolve_win32() *************** *** 505,511 **** \ toupper(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~')) " Test with a few lowercase diacritics. ! call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", toupper("aàáâãäåāăąǎǟǡả")) call assert_equal("BḂḆ", toupper("bḃḇ")) call assert_equal("CÇĆĈĊČ", toupper("cçćĉċč")) call assert_equal("DĎĐḊḎḐ", toupper("dďđḋḏḑ")) --- 505,511 ---- \ toupper(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~')) " Test with a few lowercase diacritics. ! call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", "aàáâãäåāăąǎǟǡả"->toupper()) call assert_equal("BḂḆ", toupper("bḃḇ")) call assert_equal("CÇĆĈĊČ", toupper("cçćĉċč")) call assert_equal("DĎĐḊḎḐ", toupper("dďđḋḏḑ")) *************** *** 568,573 **** --- 568,578 ---- call toupper("123\xC0\x80\xC0") endfunc + func Test_tr() + call assert_equal('foo', tr('bar', 'bar', 'foo')) + call assert_equal('zxy', 'cab'->tr('abc', 'xyz')) + endfunc + " Tests for the mode() function let current_modes = '' func Save_mode() *************** *** 1203,1209 **** func Test_trim() call assert_equal("Testing", trim(" \t\r\r\x0BTesting \t\n\r\n\t\x0B\x0B")) ! call assert_equal("Testing", trim(" \t \r\r\n\n\x0BTesting \t\n\r\n\t\x0B\x0B")) call assert_equal("RESERVE", trim("xyz \twwRESERVEzyww \t\t", " wxyz\t")) call assert_equal("wRE \tSERVEzyww", trim("wRE \tSERVEzyww")) call assert_equal("abcd\t xxxx tail", trim(" \tabcd\t xxxx tail")) --- 1208,1214 ---- func Test_trim() call assert_equal("Testing", trim(" \t\r\r\x0BTesting \t\n\r\n\t\x0B\x0B")) ! call assert_equal("Testing", " \t \r\r\n\n\x0BTesting \t\n\r\n\t\x0B\x0B"->trim()) call assert_equal("RESERVE", trim("xyz \twwRESERVEzyww \t\t", " wxyz\t")) call assert_equal("wRE \tSERVEzyww", trim("wRE \tSERVEzyww")) call assert_equal("abcd\t xxxx tail", trim(" \tabcd\t xxxx tail")) *************** *** 1617,1623 **** call assert_equal([''], getbufline(buf, 1, '$')) let curbuf = bufnr('') ! call writefile(['some', 'text'], 'XotherName') let buf = 'XotherName'->bufadd() call assert_notequal(0, buf) eval 'XotherName'->bufexists()->assert_equal(1) --- 1622,1628 ---- call assert_equal([''], getbufline(buf, 1, '$')) let curbuf = bufnr('') ! eval ['some', 'text']->writefile('XotherName') let buf = 'XotherName'->bufadd() call assert_notequal(0, buf) eval 'XotherName'->bufexists()->assert_equal(1) *** ../vim-8.1.2012/src/testdir/test_listchars.vim 2019-08-17 14:10:52.828496043 +0200 --- src/testdir/test_listchars.vim 2019-09-08 21:25:47.684148682 +0200 *************** *** 25,31 **** redraw! for i in range(1, 5) call cursor(i, 1) ! call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$'))) endfor set listchars-=trail:< --- 25,31 ---- redraw! for i in range(1, 5) call cursor(i, 1) ! call assert_equal([expected[i - 1]], ScreenLines(i, '$'->virtcol())) endfor set listchars-=trail:< *** ../vim-8.1.2012/src/testdir/test_timers.vim 2019-09-08 18:58:39.557952948 +0200 --- src/testdir/test_timers.vim 2019-09-08 21:15:44.150104388 +0200 *************** *** 71,77 **** func Test_timer_info() let id = timer_start(1000, 'MyHandler') ! let info = timer_info(id) call assert_equal(id, info[0]['id']) call assert_equal(1000, info[0]['time']) call assert_true(info[0]['remaining'] > 500) --- 71,77 ---- func Test_timer_info() let id = timer_start(1000, 'MyHandler') ! let info = id->timer_info() call assert_equal(id, info[0]['id']) call assert_equal(1000, info[0]['time']) call assert_true(info[0]['remaining'] > 500) *************** *** 109,115 **** let info = timer_info(id) call assert_equal(0, info[0]['paused']) ! call timer_pause(id, 1) let info = timer_info(id) call assert_equal(1, info[0]['paused']) sleep 100m --- 109,115 ---- let info = timer_info(id) call assert_equal(0, info[0]['paused']) ! eval id->timer_pause(1) let info = timer_info(id) call assert_equal(1, info[0]['paused']) sleep 100m *************** *** 149,155 **** endfunc func StopTimer1(timer) ! let g:timer2 = timer_start(10, 'StopTimer2') " avoid maxfuncdepth error call timer_pause(g:timer1, 1) sleep 20m --- 149,155 ---- endfunc func StopTimer1(timer) ! let g:timer2 = 10->timer_start('StopTimer2') " avoid maxfuncdepth error call timer_pause(g:timer1, 1) sleep 20m *************** *** 262,268 **** let intr = timer_start(100, 'Interrupt') let c = getchar() call assert_equal(char2nr('a'), c) ! call timer_stop(intr) endfunc func Test_timer_getchar_zero() --- 262,268 ---- let intr = timer_start(100, 'Interrupt') let c = getchar() call assert_equal(char2nr('a'), c) ! eval intr->timer_stop() endfunc func Test_timer_getchar_zero() *** ../vim-8.1.2012/src/testdir/test_undo.vim 2019-08-04 18:55:32.172860444 +0200 --- src/testdir/test_undo.vim 2019-09-08 21:24:09.692468582 +0200 *************** *** 456,462 **** call delete('Xundodir', 'd') " Test undofile() with 'undodir' set to a non-existing directory. ! call assert_equal('', undofile('Xundofoo')) if isdirectory('/tmp') set undodir=/tmp --- 456,462 ---- call delete('Xundodir', 'd') " Test undofile() with 'undodir' set to a non-existing directory. ! call assert_equal('', 'Xundofoo'->undofile()) if isdirectory('/tmp') set undodir=/tmp *** ../vim-8.1.2012/src/testdir/test_window_cmd.vim 2019-09-08 18:58:39.557952948 +0200 --- src/testdir/test_window_cmd.vim 2019-09-08 21:45:42.607719438 +0200 *************** *** 72,78 **** func Test_window_quit() e Xa split Xb ! call assert_equal(2, winnr('$')) call assert_equal('Xb', bufname(winbufnr(1))) call assert_equal('Xa', bufname(winbufnr(2))) --- 72,78 ---- func Test_window_quit() e Xa split Xb ! call assert_equal(2, '$'->winnr()) call assert_equal('Xb', bufname(winbufnr(1))) call assert_equal('Xa', bufname(winbufnr(2))) *************** *** 88,94 **** 3wincmd s call assert_equal(2, winnr('$')) call assert_equal(3, winheight(0)) ! call assert_equal(winwidth(1), winwidth(2)) call assert_fails('botright topleft wincmd s', 'E442:') bw --- 88,94 ---- 3wincmd s call assert_equal(2, winnr('$')) call assert_equal(3, winheight(0)) ! call assert_equal(winwidth(1), 2->winwidth()) call assert_fails('botright topleft wincmd s', 'E442:') bw *************** *** 300,306 **** wincmd + call assert_equal(wh1, winheight(1)) ! call assert_equal(wh2, winheight(2)) 2wincmd _ call assert_equal(2, winheight(1)) --- 300,306 ---- wincmd + call assert_equal(wh1, winheight(1)) ! call assert_equal(wh2, 2->winheight()) 2wincmd _ call assert_equal(2, winheight(1)) *************** *** 845,848 **** --- 845,860 ---- only | tabonly endfunc + func Test_winrestview() + split runtest.vim + normal 50% + let view = winsaveview() + close + split runtest.vim + eval view->winrestview() + call assert_equal(view, winsaveview()) + + bwipe! + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.1.2012/src/testdir/test_window_id.vim 2018-08-21 16:56:28.367325278 +0200 --- src/testdir/test_window_id.vim 2019-09-08 21:38:25.901660077 +0200 *************** *** 67,73 **** call win_gotoid(id2) call assert_equal("two", expand("%")) ! call win_gotoid(id4) call assert_equal("four", expand("%")) call win_gotoid(id1) call assert_equal("one", expand("%")) --- 67,73 ---- call win_gotoid(id2) call assert_equal("two", expand("%")) ! eval id4->win_gotoid() call assert_equal("four", expand("%")) call win_gotoid(id1) call assert_equal("one", expand("%")) *************** *** 75,91 **** call assert_equal("five", expand("%")) call assert_equal(0, win_id2win(9999)) ! call assert_equal(nr5, win_id2win(id5)) call assert_equal(0, win_id2win(id1)) tabnext call assert_equal(nr1, win_id2win(id1)) call assert_equal([0, 0], win_id2tabwin(9999)) ! call assert_equal([1, nr2], win_id2tabwin(id2)) call assert_equal([2, nr4], win_id2tabwin(id4)) call assert_equal([], win_findbuf(9999)) ! call assert_equal([id2], win_findbuf(bufnr2)) call win_gotoid(id5) split call assert_equal(sort([id5, win_getid()]), sort(win_findbuf(bufnr5))) --- 75,91 ---- call assert_equal("five", expand("%")) call assert_equal(0, win_id2win(9999)) ! call assert_equal(nr5, id5->win_id2win()) call assert_equal(0, win_id2win(id1)) tabnext call assert_equal(nr1, win_id2win(id1)) call assert_equal([0, 0], win_id2tabwin(9999)) ! call assert_equal([1, nr2], id2->win_id2tabwin()) call assert_equal([2, nr4], win_id2tabwin(id4)) call assert_equal([], win_findbuf(9999)) ! call assert_equal([id2], bufnr2->win_findbuf()) call win_gotoid(id5) split call assert_equal(sort([id5, win_getid()]), sort(win_findbuf(bufnr5))) *************** *** 98,104 **** tabfirst copen only ! call assert_equal(win_getid(1), win_getid(1, 1)) tabclose! endfunc --- 98,104 ---- tabfirst copen only ! call assert_equal(win_getid(1), 1->win_getid( 1)) tabclose! endfunc *************** *** 120,123 **** --- 120,130 ---- call assert_equal(['col', [['leaf', w3], ['row', [['leaf', w4], ['leaf', w2]]], ['leaf', w1]]], winlayout()) only! + + let w1 = win_getid() + call assert_equal(['leaf', w1], winlayout(1)) + tabnew + let w2 = win_getid() + call assert_equal(['leaf', w2], 2->winlayout()) + tabclose endfunc *** ../vim-8.1.2012/src/version.c 2019-09-08 20:55:03.146072987 +0200 --- src/version.c 2019-09-08 21:50:33.406151418 +0200 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 2013, /**/ -- If evolution theories are correct, humans will soon grow a third hand for operating the mouse. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///