Re: Buffer position not preserved when resizing window (7.4.307)
It is a test that is an error in the patch before. It does not result in an error in the patch after. The correctness of meaning, there is no confidence. If there is a better way, that would be better. Thanks. Nobuhiro Takasaki -- -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups vim_dev group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. test107.in Description: Binary data test107.ok Description: Binary data
BUG: j motion doesn't use position set by setpos('.'), but that of the last insert
Hello Vim developers, I have a custom surround function that basically does this: let save_cursor = getpos('.') execute normal! eaXY\Esc call setpos('.', save_cursor) And this correctly restores the cursor to the original position. But when I move down a line (with j, same with k btw.) immediately after triggering this, the cursor jumps to the column of the last insert (the Y in the example above). This does not happen when: - a (no-op) move within the same line is performed (e.g. l followed by h) before the j - cursor() is used instead of setpos('.') I can reproduce this down to Vim version 7.0. Interestingly, in Vim 7.0.000, the cursor() function is also affected, but that starts working in Vim 7.1.000. I see this in the latest Vim 7.4.307 (HUGE build) on Linux/x64, as well as Vim 7.4.264 on Windows/x64. You can reproduce this with the attached scriptlet: $ vim -N -u NONE -S bug-cursor-j.vim Or by executing this in the middle of some text: let save_cursor = getpos('.')|execute normal! eaXY\Esc|call setpos('.', save_cursor)|normal! j The problematic call incorrectly positions the cursor (represented by |) on the last insert column, instead of the column of the B where the function was triggered: QuickBrownFoxJumpsOverMe |he he Quick|BrownFoxJumpsOverMe he he -- regards, ingo -- -- Ingo Karkat -- /^-- /^-- /^-- /^-- /^-- http://ingo-karkat.de/ -- -- http://vim.sourceforge.net/account/profile.php?user_id=9713 -- -- -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups vim_dev group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. bug-cursor-j.vim Description: application/octetstream
Re: BUG: j motion doesn't use position set by setpos('.'), but that of the last insert
Hi Ingo! On Mo, 26 Mai 2014, Ingo Karkat wrote: Hello Vim developers, I have a custom surround function that basically does this: let save_cursor = getpos('.') execute normal! eaXY\Esc call setpos('.', save_cursor) And this correctly restores the cursor to the original position. But when I move down a line (with j, same with k btw.) immediately after triggering this, the cursor jumps to the column of the last insert (the Y in the example above). This does not happen when: - a (no-op) move within the same line is performed (e.g. l followed by h) before the j - cursor() is used instead of setpos('.') I can reproduce this down to Vim version 7.0. Interestingly, in Vim 7.0.000, the cursor() function is also affected, but that starts working in Vim 7.1.000. I see this in the latest Vim 7.4.307 (HUGE build) on Linux/x64, as well as Vim 7.4.264 on Windows/x64. You can reproduce this with the attached scriptlet: $ vim -N -u NONE -S bug-cursor-j.vim Or by executing this in the middle of some text: let save_cursor = getpos('.')|execute normal! eaXY\Esc|call setpos('.', save_cursor)|normal! j The problematic call incorrectly positions the cursor (represented by |) on the last insert column, instead of the column of the B where the function was triggered: QuickBrownFoxJumpsOverMe |he he Quick|BrownFoxJumpsOverMe he he This has been discussed before: https://groups.google.com/d/msg/vim_dev/xTa0kHWkY_o/ZXDq-HCifWsJ https://groups.google.com/d/msg/vim_dev/o9GRXaJMwHg/9g8INNnNB9YJ As suggested by ZyX in one of the threads, here is a patch, that allows to explicitly set curswant by enhancing the winrestview() function call. This means, you have to add an additional call to winrestview() like this: :call winrestview({'curswant':5}) to make Vim request to stay in column *6* on vertical movement. Yes, there is a difference between the column number getpos() and winsaveview() returns. Best, Christian -- -- -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups vim_dev group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -6395,6 +6395,16 @@ winrestcmd() Returns a sequence of |:res winrestview({dict}) Uses the |Dictionary| returned by |winsaveview()| to restore the view of the current window. + Note: The {dict} does not have to contain all values, that are + returned by |winsaveview()|. If values are missing, those + settings won't be restored. So you can use: + :call winrestview({'curswant': 4}) + + This will only set the curswant value (the column the cursor + wants to move on vertical movements) of the cursor to column 5 + (yes, that is 5), while all other settings will remain the + same. This is useful, if you set the cursor position manually. + If you have changed the values the result is unpredictable. If the window size changed the result won't be the same. @@ -6409,7 +6419,9 @@ winsaveview() Returns a |Dictionary| tha not opened when moving around. The return value includes: lnum cursor line number - col cursor column + col cursor column (Note: the first column + zero, as opposed to what getpos() + returns) coladd cursor column offset for 'virtualedit' curswant column for vertical movement topline first line in the window diff --git a/src/eval.c b/src/eval.c --- a/src/eval.c +++ b/src/eval.c @@ -19229,20 +19229,30 @@ f_winrestview(argvars, rettv) EMSG(_(e_invarg)); else { - curwin-w_cursor.lnum = get_dict_number(dict, (char_u *)lnum); - curwin-w_cursor.col = get_dict_number(dict, (char_u *)col); + if (dict_find(dict, (char_u *)lnum, -1) != NULL) + curwin-w_cursor.lnum = get_dict_number(dict, (char_u *)lnum); + if (dict_find(dict, (char_u *)col, -1) != NULL) + curwin-w_cursor.col = get_dict_number(dict, (char_u *)col); #ifdef FEAT_VIRTUALEDIT - curwin-w_cursor.coladd = get_dict_number(dict, (char_u *)coladd); -#endif - curwin-w_curswant = get_dict_number(dict, (char_u *)curswant); - curwin-w_set_curswant = FALSE; - - set_topline(curwin, get_dict_number(dict, (char_u *)topline)); + if (dict_find(dict, (char_u *)coladd, -1) != NULL) + curwin-w_cursor.coladd = get_dict_number(dict, (char_u *)coladd); +#endif + if (dict_find(dict, (char_u *)curswant, -1) != NULL) + { + curwin-w_curswant = get_dict_number(dict, (char_u *)curswant); + curwin-w_set_curswant = FALSE; + } + + if (dict_find(dict, (char_u *)topline, -1) != NULL) + set_topline(curwin, get_dict_number(dict, (char_u *)topline));
Re: SIGBUS highlighting in C
Marek Zaffy wrote: Vim has nice syntax highlighting for all signals, except SIGBUS... why ? I fixed this by altering the c.vim file but I think it'd be much better if vim highlights the keywork SIGBUS by default. Looks like the newer Posix signals are missing. My man page says they are for Posix 2001. Let's add this then: POSIX 2001 syn keyword cConstant SIGBUS SIGPOLL SIGPROF SIGSYS SIGURG syn keyword cConstant SIGVTALRM SIGXCPU SIGXFSZ -- hundred-and-one symptoms of being an internet addict: 211. Your husband leaves you...taking the computer with him and you call him crying, and beg him to bring the computer back. /// Bram Moolenaar -- b...@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/// -- -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups vim_dev group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: BUG: j motion doesn't use position set by setpos('.'), but that of the last insert
Christian Brabandt wrote: Hi Ingo! On Mo, 26 Mai 2014, Ingo Karkat wrote: Hello Vim developers, I have a custom surround function that basically does this: let save_cursor = getpos('.') execute normal! eaXY\Esc call setpos('.', save_cursor) And this correctly restores the cursor to the original position. But when I move down a line (with j, same with k btw.) immediately after triggering this, the cursor jumps to the column of the last insert (the Y in the example above). This does not happen when: - a (no-op) move within the same line is performed (e.g. l followed by h) before the j - cursor() is used instead of setpos('.') I can reproduce this down to Vim version 7.0. Interestingly, in Vim 7.0.000, the cursor() function is also affected, but that starts working in Vim 7.1.000. I see this in the latest Vim 7.4.307 (HUGE build) on Linux/x64, as well as Vim 7.4.264 on Windows/x64. You can reproduce this with the attached scriptlet: $ vim -N -u NONE -S bug-cursor-j.vim Or by executing this in the middle of some text: let save_cursor = getpos('.')|execute normal! eaXY\Esc|call setpos('.', save_cursor)|normal! j The problematic call incorrectly positions the cursor (represented by |) on the last insert column, instead of the column of the B where the function was triggered: QuickBrownFoxJumpsOverMe |he he Quick|BrownFoxJumpsOverMe he he This has been discussed before: https://groups.google.com/d/msg/vim_dev/xTa0kHWkY_o/ZXDq-HCifWsJ https://groups.google.com/d/msg/vim_dev/o9GRXaJMwHg/9g8INNnNB9YJ As suggested by ZyX in one of the threads, here is a patch, that allows to explicitly set curswant by enhancing the winrestview() function call. This means, you have to add an additional call to winrestview() like this: :call winrestview({'curswant':5}) to make Vim request to stay in column *6* on vertical movement. Yes, there is a difference between the column number getpos() and winsaveview() returns. This patch has drifted way down in the todo list. I'll move it up. -- hundred-and-one symptoms of being an internet addict: 210. When you get a divorce, you don't care about who gets the children, but discuss endlessly who can use the email address. /// Bram Moolenaar -- b...@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/// -- -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups vim_dev group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: delete just left netrw buffer after opening file
Enno wrote: Le vendredi 23 mai 2014 10:42:55 UTC+2, Enno a écrit : Can one configure netrw so that when opening a file in netrw the just left netrw buffer is automatically deleted? For example type :e ., navigate to a file, hit CR. Then there is the netrw buffer, created by :e . that we just left, and has done its service. Is there an autocmd to delete it? Naive attempts under Gvim 7.4.282 and Windows 7 64 bit failed. This is, under netrw 1.53b. Another curiosity is that, inside a netrw buffer, the :bprevious is without effect, but :bnext works as expected. Please try netrw this way: (simple.netrw is attached) vim -u simple.netrw some-directory-here You'll need to hit the i key a few times to get your preferred tree listing. Regards, Chip Campbell -- -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups vim_dev group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. set nocp so .vim/plugin/netrwPlugin.vim