I think here is another problem with concealing. This is part of my csv
filetype help file (attached):
#v+
chrisbra:~$ cat -A vim_help.txt
*ft-csv.txt*^IFor Vim version 7.3^ILast Change: Thu, 06 Oct 2011$
vim:tw=78:ts=8:ft=help:norl$
chrisbra:~$ vim -u NONE -U NONE -N -i NONE --cmd 'filetype plugin on|syntax on' -c 'norm! fC' vim_help.txt
#v-
Notice that the cursor jumps to the t for "Last Change" and not to the
"C" as requested. Note, that the cursor is only drawn on the wrong char.
If you do something at that position, it will happen to the correct
character (e.g. rT will change the "C" to a "T", ga will report the
correct ascii value for the C). Also $ won't jump to the last character.
This happens with latest Vim 7.3.333
Doing a bisect, this seems to have been introduced by patch 7.3.274:
#v+
chrisbra@~/code/vim/src$ hg log -v -p -r 3004
�nderung: 3004:1bb6776fa8c4
Marke: v7-3-274
Nutzer: Bram Moolenaar <br...@vim.org>
Datum: Wed Aug 10 14:32:39 2011 +0200
Dateien: src/screen.c src/version.c
Beschreibung:
updated for version 7.3.274
Problem: With concealed characters tabs do not have the right size.
Solution: Use VCOL_HLC instead of vcol. (Eiichi Sato)
diff --git a/src/screen.c b/src/screen.c
--- a/src/screen.c
+++ b/src/screen.c
@@ -4252,7 +4252,7 @@
{
/* tab amount depends on current column */
n_extra = (int)wp->w_buffer->b_p_ts
- - vcol % (int)wp->w_buffer->b_p_ts - 1;
+ - VCOL_HLC % (int)wp->w_buffer->b_p_ts - 1;
#ifdef FEAT_MBYTE
mb_utf8 = FALSE; /* don't draw as UTF-8 */
#v-
Here is a patch, that I have hacked around quickly. But I don't really
understand concealing very well, so it may as well break something.
#v+
chrisbra@~/code/vim/src$ hg diff
diff --git a/src/screen.c b/src/screen.c
--- a/src/screen.c
+++ b/src/screen.c
@@ -2679,6 +2679,7 @@
int screen_row; /* row on the screen, incl w_winrow */
char_u extra[18]; /* "%ld" and 'fdc' must fit in here */
+ int did_tab = 0;
int n_extra = 0; /* number of extra chars */
char_u *p_extra = NULL; /* string of extra chars, plus NUL */
int c_extra = NUL; /* extra chars, all the same */
@@ -4250,9 +4251,11 @@
*/
if (c == TAB && (!wp->w_p_list || lcs_tab1))
{
+ did_tab=TRUE;
/* tab amount depends on current column */
n_extra = (int)wp->w_buffer->b_p_ts
- VCOL_HLC % (int)wp->w_buffer->b_p_ts - 1;
+
#ifdef FEAT_MBYTE
mb_utf8 = FALSE; /* don't draw as UTF-8 */
#endif
@@ -4502,7 +4505,7 @@
if (!did_wcol && draw_state == WL_LINE
&& wp == curwin && lnum == wp->w_cursor.lnum
&& conceal_cursor_line(wp)
- && (int)wp->w_virtcol <= vcol + n_skip)
+ && (int)wp->w_virtcol <= vcol + n_skip && !did_tab)
{
wp->w_wcol = col - boguscols;
wp->w_wrow = row;
#v-
Attached is the patch and as well the testcase. I think, I can also
create a test for this as well, but currently I don't have much time
right now, but next week I can look into it.
regards,
Christian