[patch] several problems with drawing overlong lines

45 views
Skip to first unread message

Christian Brabandt

unread,
Sep 29, 2014, 4:51:49 PM9/29/14
to vim...@vim.org
Hi,
I noticed some problems with Vim displaying lines, that are longer than
the actual screen size.

For one, if the precedes listchar option is set, this will be drawn even
when 'showbreak' is set and the list option is not. The easy fix is:

diff --git a/src/screen.c b/src/screen.c
--- a/src/screen.c
+++ b/src/screen.c
@@ -4892,7 +4892,7 @@ win_line(wp, lnum, startrow, endrow, noc
* character of the line and the user wants us to show us a
* special character (via 'listchars' option "precedes:<char>".
*/
- if (lcs_prec_todo != NUL
+ if (lcs_prec_todo != NUL && wp->w_p_list
&& (wp->w_p_wrap ? wp->w_skipcol > 0 : wp->w_leftcol > 0)
#ifdef FEAT_DIFF
&& filler_todo <= 0

2) When 'nu' or 'rnu' is set (or a sign column is displayed or the
foldcolumn is set) and 'sbr' value is displayed, then moving the cursor
is off (e.g. there is a difference between what ga outputs and where the
cursor is positioned) (This is very irritating if you are searching for
a regex and wonder why the cursor stops at the current position although
the RE doesn't match). I think, this patch fixes this as well (not sure,
this is the right approach):

diff --git a/src/charset.c b/src/charset.c
--- a/src/charset.c
+++ b/src/charset.c
@@ -1186,6 +1186,8 @@ win_lbr_chartabsize(wp, line, s, col, he
numberextra = W_WIDTH(wp) - (numberextra - win_col_off2(wp));
if (numberextra > 0)
col = col % numberextra;
+ if (*p_sbr != NUL && col >= STRLEN(p_sbr))
+ col -= STRLEN(p_sbr);
}
if (col == 0 || col + size > (colnr_T)W_WIDTH(wp))
{



Best
Christian
--
Die Wahrheit bedarf nicht viele Worte, die Lüge kann nie genug haben.
-- Anonym

Bram Moolenaar

unread,
Sep 30, 2014, 11:22:55 AM9/30/14
to Christian Brabandt, vim...@vim.org

Christian wrote:

> I noticed some problems with Vim displaying lines, that are longer than
> the actual screen size.
>
> For one, if the precedes listchar option is set, this will be drawn even
> when 'showbreak' is set and the list option is not. The easy fix is:

[...]

> 2) When 'nu' or 'rnu' is set (or a sign column is displayed or the
> foldcolumn is set) and 'sbr' value is displayed, then moving the cursor
> is off (e.g. there is a difference between what ga outputs and where the
> cursor is positioned) (This is very irritating if you are searching for
> a regex and wonder why the cursor stops at the current position although
> the RE doesn't match). I think, this patch fixes this as well (not sure,
> this is the right approach):

Thanks, I'll put them on the todo list.

--
hundred-and-one symptoms of being an internet addict:
206. You religiously respond immediately to e-mail, while ignoring
your growing pile of snail mail.

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages