On Do, 28 Aug 2014, Nazri Ramliy wrote:
> Here's how to reproduce it in an 80-column terminal:
>
> $ vi --version|head -2
> VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 27 2014 13:10:11)
> Included patches: 1-417
> $ echo $COLUMNS
> 80
> $ vi -u NONE -U NONE -c 'exec "normal 6i\<tab>\<esc>31Aa\<esc>A a"' -c
> 'set breakindent showbreak=\> ' -c 'normal ^'
>
> The cursor is now placed on the first "a" character on the first line,
> preceeded with 6 tabs, and we can see that the last "a" character is
> breakindent-ed with ">" showbreak character on the "virtual" line due
> to the breakindent. So far so good.
>
> Here's the bug: Pressing "gj" in normal mode should move the cursor to
> the virtual line below but in this case the cursors jumps to the end
> of the first line instead.
Looks like a breakindent bug, but also isn't ;)
you can also trigger the bug in a 80 column terminal with something like
this:
:let &sbr=repeat('>', 49)
Here is a patch:
diff --git a/src/normal.c b/src/normal.c
--- a/src/normal.c
+++ b/src/normal.c
@@ -4515,7 +4515,8 @@ nv_screengo(oap, dir, dist)
* screenline or move two screenlines.
*/
validate_virtcol();
- if (curwin->w_virtcol > curwin->w_curswant
+ if ((curwin->w_virtcol - (*p_sbr != NUL ? vim_strsize(p_sbr) : 0))
+ > curwin->w_curswant
&& (curwin->w_curswant < (colnr_T)width1
? (curwin->w_curswant > (colnr_T)width1 / 2)
: ((curwin->w_curswant - width1) % width2
I have to admit, I do not understand the comment right above it:
,----
| * Check for landing on a character that got split at the end of the
| * last line. We want to advance a screenline, not end up in the same
| * screenline or move two screenlines.
| */
`----
I am not sure, what kind of characters can be split at the end of a line
(screen line I guess)?
BTW: I just noticed, there is a similar bug in gj/gk and listmode
In this window:
,----------------------------------------
| 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>
| --bbb
`----------------------------------------
And the cursor on the second a of line 1, pressing gj will move the
cursor the <Tab> at the last screen column in that window.
(To reproduce, in a 75 column terminal: vim -u NONE -N -c 'call
setline(1, repeat("a",73)."\tBBB")' -c ':set list listchars=tab:>-' -c
':norm! gj'
Ah, I just noticed this happens, because when listmode is off, the
cursor is always displayed at the end of a tab char, while when list
mode is on and there is a 'tab:' lcs-setting, the cursor will always be
drawn at the start of the tab. I didn't know that, so this should at
least be documented.
Best,
Christian
--
Man errät die Menschen am besten, wenn man sie bei Erzählungen um ihre
Vermutungen der unerzählten Zukunft fragt.
-- Jean Paul
--
--
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/d/optout.