On 16-Jul-2013 17:21 +0200, Bram Moolenaar wrote: > Ingo Karkat wrote: > >> On 16-Jul-2013 16:21 +0200, glts wrote: >> >>> On Tue, Jul 16, 2013 at 4:17 PM, Ingo Karkat <[email protected]> wrote: >>>> Hello Vim developers, >>>> >>>> This was first reported on Stack Overflow: >>>> >>>> http://stackoverflow.com/questions/16710886/why-does-3dd-not-work-from-the-last-line-in-vim >>>> >>>> vim -N -u NONE -c "for i in range(1,3)|call setline(i,i)|endfor" >>>> :normal! 3G3dd >>>> " BUG: This just beeps, nothing gets deleted. Expected: Current last line >>>> gets deleted. >>>> :normal! 2G3dd >>>> " OK: This deletes lines 2 and 3, as expected, even though the count is >>>> larger than the number of lines. >>>> :undo >>>> :3delete 3 >>>> " OK: The equivalent Ex command correctly deletes the last line. >>>> >>>> Reproducible on Vim 7.4a.24 on Linux/x64, and also on ancient Vim 7.0.000 >>>> on Windows/x86. >>> >>> Did you see this? >>> https://groups.google.com/d/msg/vim_dev/3T6qX8qXu20/QNEoteWEDzAJ >> >> To quote Bram: >> This is intentionally implemented this way in cursor_down(). >> It doesn't say so, but it is most likely to be Vi compatible. >> >> Then isn't this a case for 'cpoptions', as with all the other Vi >> peculiarities?! >> >> There are now at least 4 people (the submitter on SO, one who answered, >> myself, and Nikolay from the linked thread) who consider this to be a >> bug. If the group of people where this doesn't fit their mental model is >> way larger than those who know about this (without diving into the >> source code), and there are no convincing reasons for keeping the >> peculiarity, and the probability of someone actually relying on the >> behavior goes against zero, that's a strong case for fixing it (when in >> :set nocompatible). > > Maybe it's a bug that when you tell Vim to delete lines that don't exist > it doesn't beep and do nothing.
The worst in my eyes is the inconsistency: Only in the last line does Vim reject a count that doesn't fit, whereas in previous ones it silently truncates to what's available. > But it's always been that way and there is no reason why it's more of > a problem now then 10 years ago. That's because it's an obscure corner case. I probably would have never noticed, just repeated my command without the count, and never reflected what happened. But some people do notice (even take the time to inquire about this), and also for me, it subconsciously throws me "out of rhythm" when this happens. > So let's just leave it. Well, all I'm asking is to put it on the endless TODO list, where it will probably stay for a long time until someone volunteers a patch :-( Sure, this could be "just documented", but wouldn't a fix (that almost noone will notice) be cleaner and more satisfying, because it's The Right Thing?! -- regards, ingo -- -- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
