To: vim_dev@googlegroups.com Subject: Patch 7.3.487 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.3.487 Problem: When setting 'timeoutlen' or 'ttimeoutlen' the column for vertical movement is reset unnecessarily. Solution: Do not set w_set_curswant for every option. Add a test for this. (Kana Natsuno) Add the P_CURSWANT flag for options. Files: src/option.c, src/testdir/test84.in, src/testdir/test84.ok, src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak, src/testdir/Make_ming.mak, src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, src/testdir/Makefile *** ../vim-7.3.486/src/option.c 2012-03-23 16:25:13.000000000 +0100 --- src/option.c 2012-03-28 19:57:46.000000000 +0200 *************** *** 433,449 **** #define P_RCLR 0x7000 /* clear and redraw all */ #define P_COMMA 0x8000 /* comma separated list */ ! #define P_NODUP 0x10000L/* don't allow duplicate strings */ ! #define P_FLAGLIST 0x20000L/* list of single-char flags */ ! #define P_SECURE 0x40000L/* cannot change in modeline or secure mode */ ! #define P_GETTEXT 0x80000L/* expand default value with _() */ ! #define P_NOGLOB 0x100000L/* do not use local value for global vimrc */ ! #define P_NFNAME 0x200000L/* only normal file name chars allowed */ ! #define P_INSECURE 0x400000L/* option was set from a modeline */ ! #define P_PRI_MKRC 0x800000L/* priority for :mkvimrc (setting option has side effects) */ ! #define P_NO_ML 0x1000000L/* not allowed in modeline */ #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255" --- 433,451 ---- #define P_RCLR 0x7000 /* clear and redraw all */ #define P_COMMA 0x8000 /* comma separated list */ ! #define P_NODUP 0x10000L /* don't allow duplicate strings */ ! #define P_FLAGLIST 0x20000L /* list of single-char flags */ ! #define P_SECURE 0x40000L /* cannot change in modeline or secure mode */ ! #define P_GETTEXT 0x80000L /* expand default value with _() */ ! #define P_NOGLOB 0x100000L /* do not use local value for global vimrc */ ! #define P_NFNAME 0x200000L /* only normal file name chars allowed */ ! #define P_INSECURE 0x400000L /* option was set from a modeline */ ! #define P_PRI_MKRC 0x800000L /* priority for :mkvimrc (setting option has side effects) */ ! #define P_NO_ML 0x1000000L /* not allowed in modeline */ ! #define P_CURSWANT 0x2000000L /* update curswant required; not needed when ! * there is a redraw flag */ #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255" *************** *** 479,485 **** #endif options[] = { ! {"aleph", "al", P_NUM|P_VI_DEF, #ifdef FEAT_RIGHTLEFT (char_u *)&p_aleph, PV_NONE, #else --- 481,487 ---- #endif options[] = { ! {"aleph", "al", P_NUM|P_VI_DEF|P_CURSWANT, #ifdef FEAT_RIGHTLEFT (char_u *)&p_aleph, PV_NONE, #else *************** *** 501,507 **** {(char_u *)FALSE, (char_u *)FALSE} #endif SCRIPTID_INIT}, ! {"arabic", "arab", P_BOOL|P_VI_DEF|P_VIM, #ifdef FEAT_ARABIC (char_u *)VAR_WIN, PV_ARAB, #else --- 503,509 ---- {(char_u *)FALSE, (char_u *)FALSE} #endif SCRIPTID_INIT}, ! {"arabic", "arab", P_BOOL|P_VI_DEF|P_VIM|P_CURSWANT, #ifdef FEAT_ARABIC (char_u *)VAR_WIN, PV_ARAB, #else *************** *** 778,784 **** {"columns", "co", P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR, (char_u *)&Columns, PV_NONE, {(char_u *)80L, (char_u *)0L} SCRIPTID_INIT}, ! {"comments", "com", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, #ifdef FEAT_COMMENTS (char_u *)&p_com, PV_COM, {(char_u *)"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-", --- 780,786 ---- {"columns", "co", P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR, (char_u *)&Columns, PV_NONE, {(char_u *)80L, (char_u *)0L} SCRIPTID_INIT}, ! {"comments", "com", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP|P_CURSWANT, #ifdef FEAT_COMMENTS (char_u *)&p_com, PV_COM, {(char_u *)"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-", *************** *** 788,794 **** {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, ! {"commentstring", "cms", P_STRING|P_ALLOCED|P_VI_DEF, #ifdef FEAT_FOLDING (char_u *)&p_cms, PV_CMS, {(char_u *)"/*%s*/", (char_u *)0L} --- 790,796 ---- {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, ! {"commentstring", "cms", P_STRING|P_ALLOCED|P_VI_DEF|P_CURSWANT, #ifdef FEAT_FOLDING (char_u *)&p_cms, PV_CMS, {(char_u *)"/*%s*/", (char_u *)0L} *************** *** 953,959 **** {"debug", NULL, P_STRING|P_VI_DEF, (char_u *)&p_debug, PV_NONE, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, ! {"define", "def", P_STRING|P_ALLOCED|P_VI_DEF, #ifdef FEAT_FIND_ID (char_u *)&p_def, PV_DEF, {(char_u *)"^\\s*#\\s*define", (char_u *)0L} --- 955,961 ---- {"debug", NULL, P_STRING|P_VI_DEF, (char_u *)&p_debug, PV_NONE, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, ! {"define", "def", P_STRING|P_ALLOCED|P_VI_DEF|P_CURSWANT, #ifdef FEAT_FIND_ID (char_u *)&p_def, PV_DEF, {(char_u *)"^\\s*#\\s*define", (char_u *)0L} *************** *** 983,989 **** (char_u *)NULL, PV_NONE, #endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, ! {"diffexpr", "dex", P_STRING|P_VI_DEF|P_SECURE, #if defined(FEAT_DIFF) && defined(FEAT_EVAL) (char_u *)&p_dex, PV_NONE, {(char_u *)"", (char_u *)0L} --- 985,991 ---- (char_u *)NULL, PV_NONE, #endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, ! {"diffexpr", "dex", P_STRING|P_VI_DEF|P_SECURE|P_CURSWANT, #if defined(FEAT_DIFF) && defined(FEAT_EVAL) (char_u *)&p_dex, PV_NONE, {(char_u *)"", (char_u *)0L} *************** *** 1099,1105 **** {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, ! {"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC, (char_u *)&p_ff, PV_FF, {(char_u *)DFLT_FF, (char_u *)0L} SCRIPTID_INIT}, {"fileformats", "ffs", P_STRING|P_VIM|P_COMMA|P_NODUP, --- 1101,1107 ---- {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, ! {"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC|P_CURSWANT, (char_u *)&p_ff, PV_FF, {(char_u *)DFLT_FF, (char_u *)0L} SCRIPTID_INIT}, {"fileformats", "ffs", P_STRING|P_VIM|P_COMMA|P_NODUP, *************** *** 1159,1165 **** {"foldlevel", "fdl", P_NUM|P_VI_DEF|P_RWIN, (char_u *)VAR_WIN, PV_FDL, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, ! {"foldlevelstart","fdls", P_NUM|P_VI_DEF, (char_u *)&p_fdls, PV_NONE, {(char_u *)-1L, (char_u *)0L} SCRIPTID_INIT}, {"foldmarker", "fmr", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF| --- 1161,1167 ---- {"foldlevel", "fdl", P_NUM|P_VI_DEF|P_RWIN, (char_u *)VAR_WIN, PV_FDL, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, ! {"foldlevelstart","fdls", P_NUM|P_VI_DEF|P_CURSWANT, (char_u *)&p_fdls, PV_NONE, {(char_u *)-1L, (char_u *)0L} SCRIPTID_INIT}, {"foldmarker", "fmr", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF| *************** *** 1176,1182 **** {"foldnestmax", "fdn", P_NUM|P_VI_DEF|P_RWIN, (char_u *)VAR_WIN, PV_FDN, {(char_u *)20L, (char_u *)0L} SCRIPTID_INIT}, ! {"foldopen", "fdo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, (char_u *)&p_fdo, PV_NONE, {(char_u *)"block,hor,mark,percent,quickfix,search,tag,undo", (char_u *)0L} SCRIPTID_INIT}, --- 1178,1184 ---- {"foldnestmax", "fdn", P_NUM|P_VI_DEF|P_RWIN, (char_u *)VAR_WIN, PV_FDN, {(char_u *)20L, (char_u *)0L} SCRIPTID_INIT}, ! {"foldopen", "fdo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_CURSWANT, (char_u *)&p_fdo, PV_NONE, {(char_u *)"block,hor,mark,percent,quickfix,search,tag,undo", (char_u *)0L} SCRIPTID_INIT}, *************** *** 1741,1747 **** {"matchtime", "mat", P_NUM|P_VI_DEF, (char_u *)&p_mat, PV_NONE, {(char_u *)5L, (char_u *)0L} SCRIPTID_INIT}, ! {"maxcombine", "mco", P_NUM|P_VI_DEF, #ifdef FEAT_MBYTE (char_u *)&p_mco, PV_NONE, #else --- 1743,1749 ---- {"matchtime", "mat", P_NUM|P_VI_DEF, (char_u *)&p_mat, PV_NONE, {(char_u *)5L, (char_u *)0L} SCRIPTID_INIT}, ! {"maxcombine", "mco", P_NUM|P_VI_DEF|P_CURSWANT, #ifdef FEAT_MBYTE (char_u *)&p_mco, PV_NONE, #else *************** *** 2710,2716 **** {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, ! {"virtualedit", "ve", P_STRING|P_COMMA|P_NODUP|P_VI_DEF|P_VIM, #ifdef FEAT_VIRTUALEDIT (char_u *)&p_ve, PV_NONE, {(char_u *)"", (char_u *)""} --- 2712,2718 ---- {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, ! {"virtualedit", "ve", P_STRING|P_COMMA|P_NODUP|P_VI_DEF|P_VIM|P_CURSWANT, #ifdef FEAT_VIRTUALEDIT (char_u *)&p_ve, PV_NONE, {(char_u *)"", (char_u *)""} *************** *** 7064,7071 **** } #endif ! if (curwin->w_curswant != MAXCOL) ! curwin->w_set_curswant = TRUE; /* in case 'showbreak' changed */ #ifdef FEAT_GUI /* check redraw when it's not a GUI option or the GUI is active. */ if (!redraw_gui_only || gui.in_use) --- 7066,7075 ---- } #endif ! if (curwin->w_curswant != MAXCOL ! && (options[opt_idx].flags & (P_CURSWANT | P_RCLR)) != 0) ! curwin->w_set_curswant = TRUE; ! #ifdef FEAT_GUI /* check redraw when it's not a GUI option or the GUI is active. */ if (!redraw_gui_only || gui.in_use) *************** *** 7587,7595 **** || (int *)varp == &curwin->w_p_nu || (int *)varp == &curwin->w_p_rnu) { - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; - /* If 'number' is set, reset 'relativenumber'. */ /* If 'relativenumber' is set, reset 'number'. */ if ((int *)varp == &curwin->w_p_nu && curwin->w_p_nu) --- 7591,7596 ---- *************** *** 7834,7841 **** { if (curwin->w_p_wrap) curwin->w_leftcol = 0; - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; } #ifdef FEAT_WINDOWS --- 7835,7840 ---- *************** *** 8062,8092 **** curbuf->b_p_imsearch = B_IMODE_USE_INSERT; # endif } - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; } - else if ((int *)varp == &p_arshape) - { - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; - } - #endif - - #ifdef FEAT_LINEBREAK - if ((int *)varp == &curwin->w_p_lbr) - { - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; - } - #endif - - #ifdef FEAT_RIGHTLEFT - if ((int *)varp == &curwin->w_p_rl) - { - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; - } #endif /* --- 8061,8068 ---- *************** *** 8096,8102 **** options[opt_idx].flags |= P_WAS_SET; comp_col(); /* in case 'ruler' or 'showcmd' changed */ ! check_redraw(options[opt_idx].flags); return NULL; --- 8072,8080 ---- options[opt_idx].flags |= P_WAS_SET; comp_col(); /* in case 'ruler' or 'showcmd' changed */ ! if (curwin->w_curswant != MAXCOL ! && (options[opt_idx].flags & (P_CURSWANT | P_RCLR)) != 0) ! curwin->w_set_curswant = TRUE; check_redraw(options[opt_idx].flags); return NULL; *************** *** 8611,8618 **** options[opt_idx].flags |= P_WAS_SET; comp_col(); /* in case 'columns' or 'ls' changed */ ! if (curwin->w_curswant != MAXCOL) ! curwin->w_set_curswant = TRUE; /* in case 'tabstop' changed */ check_redraw(options[opt_idx].flags); return errmsg; --- 8589,8597 ---- options[opt_idx].flags |= P_WAS_SET; comp_col(); /* in case 'columns' or 'ls' changed */ ! if (curwin->w_curswant != MAXCOL ! && (options[opt_idx].flags & (P_CURSWANT | P_RCLR)) != 0) ! curwin->w_set_curswant = TRUE; check_redraw(options[opt_idx].flags); return errmsg; *** ../vim-7.3.486/src/testdir/test84.in 2012-03-28 19:55:12.000000000 +0200 --- src/testdir/test84.in 2012-03-28 19:46:53.000000000 +0200 *************** *** 0 **** --- 1,35 ---- + Tests for curswant not changing when setting an option + + STARTTEST + :so small.vim + :/^start target options$/+1,/^end target options$/-1 yank + :let target_option_names = split(@0) + :function TestCurswant(option_name) + : normal! ggf8j + : let curswant_before = winsaveview().curswant + : execute 'let' '&'.a:option_name '=' '&'.a:option_name + : let curswant_after = winsaveview().curswant + : return [a:option_name, curswant_before, curswant_after] + :endfunction + : + :new + :put =['1234567890', '12345'] + :1 delete _ + :let result = [] + :for option_name in target_option_names + : call add(result, TestCurswant(option_name)) + :endfor + : + :new + :put =map(copy(result), 'join(v:val, '' '')') + :1 delete _ + :write test.out + : + :qall! + ENDTEST + + start target options + tabstop + timeoutlen + ttimeoutlen + end target options *** ../vim-7.3.486/src/testdir/test84.ok 2012-03-28 19:55:12.000000000 +0200 --- src/testdir/test84.ok 2012-03-28 19:48:36.000000000 +0200 *************** *** 0 **** --- 1,3 ---- + tabstop 7 4 + timeoutlen 7 7 + ttimeoutlen 7 7 *** ../vim-7.3.486/src/testdir/Make_amiga.mak 2011-10-12 19:53:31.000000000 +0200 --- src/testdir/Make_amiga.mak 2012-03-28 18:14:08.000000000 +0200 *************** *** 29,35 **** test66.out test67.out test68.out test69.out test70.out \ test71.out test72.out test73.out test74.out test75.out \ test76.out test77.out test78.out test79.out test80.out \ ! test81.out test82.out test83.out .SUFFIXES: .in .out --- 29,35 ---- test66.out test67.out test68.out test69.out test70.out \ test71.out test72.out test73.out test74.out test75.out \ test76.out test77.out test78.out test79.out test80.out \ ! test81.out test82.out test83.out test84.out .SUFFIXES: .in .out *************** *** 132,134 **** --- 132,135 ---- test81.out: test81.in test82.out: test82.in test83.out: test83.in + test84.out: test84.in *** ../vim-7.3.486/src/testdir/Make_dos.mak 2011-10-12 19:53:31.000000000 +0200 --- src/testdir/Make_dos.mak 2012-03-28 18:14:41.000000000 +0200 *************** *** 29,35 **** test42.out test52.out test65.out test66.out test67.out \ test68.out test69.out test71.out test72.out test73.out \ test74.out test75.out test76.out test77.out test78.out \ ! test79.out test80.out test81.out test82.out test83.out SCRIPTS32 = test50.out test70.out --- 29,36 ---- test42.out test52.out test65.out test66.out test67.out \ test68.out test69.out test71.out test72.out test73.out \ test74.out test75.out test76.out test77.out test78.out \ ! test79.out test80.out test81.out test82.out test83.out \ ! test84.out SCRIPTS32 = test50.out test70.out *** ../vim-7.3.486/src/testdir/Make_ming.mak 2011-10-12 19:53:31.000000000 +0200 --- src/testdir/Make_ming.mak 2012-03-28 18:14:46.000000000 +0200 *************** *** 49,55 **** test42.out test52.out test65.out test66.out test67.out \ test68.out test69.out test71.out test72.out test73.out \ test74.out test75.out test76.out test77.out test78.out \ ! test79.out test80.out test81.out test82.out test83.out SCRIPTS32 = test50.out test70.out --- 49,56 ---- test42.out test52.out test65.out test66.out test67.out \ test68.out test69.out test71.out test72.out test73.out \ test74.out test75.out test76.out test77.out test78.out \ ! test79.out test80.out test81.out test82.out test83.out \ ! test84.out SCRIPTS32 = test50.out test70.out *** ../vim-7.3.486/src/testdir/Make_os2.mak 2011-10-12 19:53:31.000000000 +0200 --- src/testdir/Make_os2.mak 2012-03-28 18:15:00.000000000 +0200 *************** *** 29,35 **** test66.out test67.out test68.out test69.out test70.out \ test71.out test72.out test73.out test74.out test75.out \ test76.out test77.out test78.out test79.out test80.out \ ! test81.out test82.out test83.out .SUFFIXES: .in .out --- 29,35 ---- test66.out test67.out test68.out test69.out test70.out \ test71.out test72.out test73.out test74.out test75.out \ test76.out test77.out test78.out test79.out test80.out \ ! test81.out test82.out test83.out test84.out .SUFFIXES: .in .out *** ../vim-7.3.486/src/testdir/Make_vms.mms 2011-10-12 19:53:31.000000000 +0200 --- src/testdir/Make_vms.mms 2012-03-28 18:15:15.000000000 +0200 *************** *** 4,10 **** # Authors: Zoltan Arpadffy, # Sandor Kopanyi, # ! # Last change: 2011 Jul 15 # # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64. # Edit the lines in the Configuration section below to select. --- 4,10 ---- # Authors: Zoltan Arpadffy, # Sandor Kopanyi, # ! # Last change: 2012 Mar 28 # # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64. # Edit the lines in the Configuration section below to select. *************** *** 76,82 **** test66.out test67.out test68.out test69.out \ test71.out test72.out test74.out test75.out test76.out \ test77.out test78.out test79.out test80.out test81.out \ ! test82.out test83.out # Known problems: # Test 30: a problem around mac format - unknown reason --- 76,82 ---- test66.out test67.out test68.out test69.out \ test71.out test72.out test74.out test75.out test76.out \ test77.out test78.out test79.out test80.out test81.out \ ! test82.out test83.out test84.out # Known problems: # Test 30: a problem around mac format - unknown reason *** ../vim-7.3.486/src/testdir/Makefile 2011-10-12 19:53:31.000000000 +0200 --- src/testdir/Makefile 2012-03-28 18:15:29.000000000 +0200 *************** *** 26,32 **** test64.out test65.out test66.out test67.out test68.out \ test69.out test70.out test71.out test72.out test73.out \ test74.out test75.out test76.out test77.out test78.out \ ! test79.out test80.out test81.out test82.out test83.out SCRIPTS_GUI = test16.out --- 26,33 ---- test64.out test65.out test66.out test67.out test68.out \ test69.out test70.out test71.out test72.out test73.out \ test74.out test75.out test76.out test77.out test78.out \ ! test79.out test80.out test81.out test82.out test83.out \ ! test84.out SCRIPTS_GUI = test16.out *** ../vim-7.3.486/src/version.c 2012-03-28 17:43:06.000000000 +0200 --- src/version.c 2012-03-28 19:49:41.000000000 +0200 *************** *** 716,717 **** --- 716,719 ---- { /* Add new patch number below this line */ + /**/ + 487, /**/ -- "Time flies like an arrow". So I put an arrow on my desk, now awaiting one of these time flies showing up. /// 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 ///