Re: setpos() behaves erratically at times
@ Christian Thanks for your reply. I know that the mode cannot be possibly guessed from the positions used with setpos() (although some rough guesses could be made). That's why I proposed to have an extra parameter to setpos() or visualmode() (instead of calling e.g. execute "normal v\") some posts before. Also, I think this whole topic should be clarified in the docs (unless it's already there and I was just unable to find it :-) -- -- 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: setpos() behaves erratically at times
Hi Axel! On Di, 27 Sep 2016, Axel Bender wrote: > There's no direct connection. It was however the origin of my > "troubles". The main problem - meanwhile - is the behavior of > setpos()/getpos(). When setting "'<" and "'>" vim takes into > consideration the last Visual mode, which is not what I would have > expected (and haven't found any documentation about, for that matter). > Instead, I would have thought, that setting the positions with > setpos() would sharply define my selection area (regardless of what > Visual mode was active before). Therefore my suggestion. That doesn't work, because how should gv "know" whether you wanted linewise, charwise or block mode? That cannot be guessed from setting only the positions of the visual mode. You always need to set the mode first. That is no bug. Best, Christian -- Es ist das Priveleg der Intellektuellen, sich zwischen alle Stühle zu setzen. -- Max Bense -- -- 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: setpos() behaves erratically at times
There's no direct connection. It was however the origin of my "troubles". The main problem - meanwhile - is the behavior of setpos()/getpos(). When setting "'<" and "'>" vim takes into consideration the last Visual mode, which is not what I would have expected (and haven't found any documentation about, for that matter). Instead, I would have thought, that setting the positions with setpos() would sharply define my selection area (regardless of what Visual mode was active before). Therefore my suggestion. -- -- 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: setpos() behaves erratically at times
Hi Axel! On Di, 27 Sep 2016, Axel Bender wrote: > Thanks for your reply. > > From my point of view this a joint problem of getpos()/setpos() - > unless the docs state it's not (I haven't found any info on that > though; I found something (inofficial) here however: > http://learnvimscriptthehardway.stevelosh.com/chapters/15.html). > > Maybe there should be an additional parameter to setpos() or > visualmode() allowing us to set the type of the Visual mode?! I don't follow. Where is the connection to operator pending mode and the mentioned documentation about being in charactervise visual mode? Perhaps you should explicitly state, when you problem does occur and show some example when you see this. Best, Christian -- Ihr könnt machen was ihr wollt - ABER NICHT SO! -- -- 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: setpos() behaves erratically at times
Thanks for your reply. >From my point of view this a joint problem of getpos()/setpos() - unless the >docs state it's not (I haven't found any info on that though; I found >something (inofficial) here however: >http://learnvimscriptthehardway.stevelosh.com/chapters/15.html). Maybe there should be an additional parameter to setpos() or visualmode() allowing us to set the type of the Visual mode?! -- -- 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: setpos() behaves erratically at times
Hi, Axel Bender schrieb am 25.09.2016 um 12:36: > IS the conclusion I made in my previous post correct? > > Can we generally NOT assume to start in CHARWISE Visual mode when entering > operator-pending mode? > > If so, where would that be described in the docs? I'm not sure, but you are probably right. I don't see an inherent connection between visual mode -- be it charwise, linewise, or blockwise -- and operator-pending mode, and I could not find anything in the help suggesting such a connection. Where did you see this? Actually, setpos() does set the position correctly. It's getpos() that reports the first and last column differently if the last visual mode was linewise. You can call visualmode() with a non-zero number or a non-empty string to clear the visual mode. Further calls of visualmode() will than return an empty string. But this does not seem to clear the internal flag that is used by getpos("'>") or gv, for example. This might be a bug, but I'm not sure about this. Probably the best solution for your problem is to mark the relevant text by selecting it in visual mode, or to use setpos() after entering and leaving charwise visual mode to reset the blockwise flag. Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) -- -- 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: setpos() behaves erratically at times
IS the conclusion I made in my previous post correct? Can we generally NOT assume to start in CHARWISE Visual mode when entering operator-pending mode? If so, where would that be described in the docs? -- -- 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: setpos() behaves erratically at times
Addendum 2: The problem also shows up when the setpos() is fed with the correct List (i.e. four elements). @Jürgen It seems that this is the trigger, you're right. However, as I take it from the docs, the mode - when entering operator-pending mode - should be charwise Visual mode. That said, the "error" might be caused by line 103 in function setmark_pos() in mark.c. Accordingly we either cannot generally assume to be in charwise Visual mode (=> clarify this in the docs), or the said function should undergo a change. -- -- 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: setpos() behaves erratically at times
Hi, Axel Bender schrieb am 22.09.2016 um 16:03: > The following image shows an erratical behavior of setpos() that I > cannot explain. When calling setpos("'<", ...), setpos("'>", ...) for > that matter, the behavior is OK for the first calls to setpos(). > However, from a certain number of calls (cannot specify), or triggered > by some event (that I do not know), setpos() behaves like shown in the > attached image. > > Any clues? could it be that the last visual mode before issuing these commands was VISUAL LINE mode? Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) -- -- 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: setpos() behaves erratically at times
Addendum: Looking into the code, I found that a possible location for this to happen might be list_find_nr() in list.c. I have to add that, revising my use of setpos(), I called the function like this: setpos("'<", [0, 532, 83]), i.e. I left out the "off" list member. As this did not result in an error, I believed, there would be an internal default covering this situation. Also, the call worked OK several times (as I said: not always reproducible). But, as soon as the error showed up, even the above mentioned call with all list members (i.e. setpos("'<", [0, 532, 83, 0])) would expose the error. For now I changed my code to the correct form (haven't been able to reproduce it so far - but...). In any way, I think there should be an error message if this list (or any other) is missing some members; the docs state (RTFM): "{list} must be a List with four or five members:..." -- -- 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: setpos() behaves erratically at times
A line like this (the parens are in the right position): --- cut here --- When you're trying to think about how to define a new operator- () movement, you can think of it like this: --- cut here --- The function was called in operator-pending mode via "cib" (replacement function for the standard functionality). When the error occurs - not always reproducible - the function could be called several times before w/o showing the error. -- -- 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: setpos() behaves erratically at times
2016-09-22 19:24 GMT+03:00 Axel Bender: > Cannot confirm this. Please look at the two setpos() statements - both > returning 0 (green = successfull). The statements were given in a debug > session; no cursor movement in between. The desired positions were not set > (yellow and blue). The '< register is set to the first column, the '> > register is set to the last column. What is there on the line 532? Also what is visual region type (visualmode())? > > -- > -- > 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. -- -- 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: setpos() behaves erratically at times
Cannot confirm this. Please look at the two setpos() statements - both returning 0 (green = successfull). The statements were given in a debug session; no cursor movement in between. The desired positions were not set (yellow and blue). The '< register is set to the first column, the '> register is set to the last column. -- -- 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: setpos() behaves erratically at times
Hi Axel! On Do, 22 Sep 2016, Axel Bender wrote: > The following image shows an erratical behavior of setpos() that I > cannot explain. When calling setpos("'<", ...), setpos("'>", ...) for > that matter, the behavior is OK for the first calls to setpos(). > However, from a certain number of calls (cannot specify), or triggered > by some event (that I do not know), setpos() behaves like shown in the > attached image. > > Any clues? [getpos returning 21474833647 as column] That happens, when you press e.g. '$' to make sure the cursor will be in the last column. That is not a bug, but an implementation detail, that happens to be visible to the user. Best, Christian -- In der Bibel steht, daß wir 6 Tage Arbeiten und am 7. Ruhen sollen. Wo aber steht, daß wir am 8. Tag wieder anfangen sollen zu arbeiten? -- -- 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.
setpos() behaves erratically at times
The following image shows an erratical behavior of setpos() that I cannot explain. When calling setpos("'<", ...), setpos("'>", ...) for that matter, the behavior is OK for the first calls to setpos(). However, from a certain number of calls (cannot specify), or triggered by some event (that I do not know), setpos() behaves like shown in the attached image. Any clues? -- -- 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.