[patch] redraw bug with 'foldcolumn' and 'conceallevel'

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch] redraw bug with 'foldcolumn' and 'conceallevel'

Dominique Pellé
Hi

I notice a bug with conceal feature: the content of
the fold column is not displayed correctly when using
'conceallevel' with a value >= 1.

Steps to reproduce:

1) Enter this command:

$ yes foo | head -10 | \
  vim --noplugin -u NONE \
      -c 'set foldcolumn=4 conceallevel=1' \
      -c ':3,6fold' \
      -c 'norm zR' -

2) press  j  in normal mode a couple of times to
move cursor down and observe that when cursor
goes inside the open fold, information in the
fold column becomes blank. Pressing CTRL-L to
redraw works around the bug.

Now if you do the same with the slightly different
command...

$ yes foo | head -10 | \
  vim --noplugin -u NONE \
     -c 'set foldcolumn=4 conceallevel=1' \
     -c ':3,$fold' \
     -c 'norm zR' -

You'll notice that when pressing  j  the foldcolumn is
not deleted but it gets filled with '|' even where there
is no fold.

Bug does not happen when setting 'relativenumber' or
'cursorline'.

Attached patch fixes it.  However, I think it may not
be the optimal solution (more redraws than strictly
necessary?).

The same patch also happen to fix several other redraw
issues with conceal items not properly updated when
using the following motion commands in normal mode...

 )
 ]]
 <PageUp>
 <PageDown>
 CTRL-F
 CTRL-B
 CTRL-U
 CTRL-E  (when cursor is on the top line, causing scrolling)
 CTRL-Y  (when cursor is on the bottom line, causing scrolling)
 CTRL-O
 CTRL-I
 [count]go
 [count]g;

and it also fixes conceal item redraw issues with following Ex command:

 :[range]
 :go [count]

Cheers
-- Dominique

--
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

fixed-redraw-foldcolumn-conceallevel-move.c-7.3a.patch (524 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [patch] redraw bug with 'foldcolumn' and 'conceallevel'

Dominique Pellé
Dominique Pellé wrote:

> Hi
>
> I notice a bug with conceal feature: the content of
> the fold column is not displayed correctly when using
> 'conceallevel' with a value >= 1.
>
> Steps to reproduce:
>
> 1) Enter this command:
>
> $ yes foo | head -10 | \
>  vim --noplugin -u NONE \
>      -c 'set foldcolumn=4 conceallevel=1' \
>      -c ':3,6fold' \
>      -c 'norm zR' -
>
> 2) press  j  in normal mode a couple of times to
> move cursor down and observe that when cursor
> goes inside the open fold, information in the
> fold column becomes blank. Pressing CTRL-L to
> redraw works around the bug.
Thinking about it further, this second attached patch
also fixes the fold column redraw bug with less redraws
than patch in previous email.

However, unlike previous patch, it does not fix the
redraw glitches with moving commands )  ]] CTRL-F  (etc)
so they require specific fixes.

-- Dominique

--
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

fixed-redraw-foldcolumn-conceallevel-screen.c-7.3a.patch (578 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [patch] redraw bug with 'foldcolumn' and 'conceallevel'

Bram Moolenaar
In reply to this post by Dominique Pellé

Dominique Pelle wrote:

> Hi
>
> I notice a bug with conceal feature: the content of
> the fold column is not displayed correctly when using
> 'conceallevel' with a value >= 1.
>
> Steps to reproduce:
>
> 1) Enter this command:
>
> $ yes foo | head -10 | \
>   vim --noplugin -u NONE \
>       -c 'set foldcolumn=4 conceallevel=1' \
>       -c ':3,6fold' \
>       -c 'norm zR' -
>
> 2) press  j  in normal mode a couple of times to
> move cursor down and observe that when cursor
> goes inside the open fold, information in the
> fold column becomes blank. Pressing CTRL-L to
> redraw works around the bug.
>
> Now if you do the same with the slightly different
> command...
>
> $ yes foo | head -10 | \
>   vim --noplugin -u NONE \
>      -c 'set foldcolumn=4 conceallevel=1' \
>      -c ':3,$fold' \
>      -c 'norm zR' -
>
> You'll notice that when pressing  j  the foldcolumn is
> not deleted but it gets filled with '|' even where there
> is no fold.
>
> Bug does not happen when setting 'relativenumber' or
> 'cursorline'.
>
> Attached patch fixes it.  However, I think it may not
> be the optimal solution (more redraws than strictly
> necessary?).
>
> The same patch also happen to fix several other redraw
> issues with conceal items not properly updated when
> using the following motion commands in normal mode...
>
>  )
>  ]]
>  <PageUp>
>  <PageDown>
>  CTRL-F
>  CTRL-B
>  CTRL-U
>  CTRL-E  (when cursor is on the top line, causing scrolling)
>  CTRL-Y  (when cursor is on the bottom line, causing scrolling)
>  CTRL-O
>  CTRL-I
>  [count]go
>  [count]g;
>
> and it also fixes conceal item redraw issues with following Ex command:
>
>  :[range]
>  :go [count]

Thanks.  Perhaps Vince knows how to fix this more efficiently?

--
hundred-and-one symptoms of being an internet addict:
184. You no longer ask prospective dates what their sign is, instead
     your line is "Hi, what's your URL?"

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
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
Reply | Threaded
Open this post in threaded view
|

RE: [patch] redraw bug with 'foldcolumn' and 'conceallevel'

Vince Negri-4
From: Bram Moolenaar [mailto:[hidden email]]
> Thanks.  Perhaps Vince knows how to fix this more efficiently?

I'll have a look at the patch and see if there is a simpler way.

Vince

--
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
Reply | Threaded
Open this post in threaded view
|

RE: [patch] redraw bug with 'foldcolumn' and 'conceallevel'

Vince Negri-4
In reply to this post by Dominique Pellé
From: Dominique Pellé [mailto:[hidden email]]

> Thinking about it further, this second attached patch
> also fixes the fold column redraw bug with less redraws
> than patch in previous email.

> However, unlike previous patch, it does not fix the
> redraw glitches with moving commands )  ]] CTRL-F  (etc)
> so they require specific fixes.

I think this patch is the right way to go about it, as we shouldn't
be redrawing unnecessarily (esp since Vim is often run over remote connections.)

That does mean that explicit fixes need to be added for a number of movement
commands, but I'd rather sort them out as they are discovered.

Dominque, you so far have a list of these movement commands needing treatment:

 )
 ]]
 <PageUp>
 <PageDown>
 CTRL-F
 CTRL-B
 CTRL-U
 CTRL-E  (when cursor is on the top line, causing scrolling)
 CTRL-Y  (when cursor is on the bottom line, causing scrolling)
 CTRL-O
 CTRL-I
 [count]go
 [count]g;

 :[range]
 :go [count]


..have you found any others since? It would be good if I could try to sort them all
out "in one go"


Vince

--
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
Reply | Threaded
Open this post in threaded view
|

Re: [patch] redraw bug with 'foldcolumn' and 'conceallevel'

Matt Wozniski-2
On Tue, Jun 15, 2010 at 9:08 AM, Vince Negri wrote:

> From: Dominique Pellé [mailto:[hidden email]]
>
>> Thinking about it further, this second attached patch
>> also fixes the fold column redraw bug with less redraws
>> than patch in previous email.
>
>> However, unlike previous patch, it does not fix the
>> redraw glitches with moving commands )  ]] CTRL-F  (etc)
>> so they require specific fixes.
>
> I think this patch is the right way to go about it, as we shouldn't
> be redrawing unnecessarily (esp since Vim is often run over remote connections.)
>
> That does mean that explicit fixes need to be added for a number of movement
> commands, but I'd rather sort them out as they are discovered.
>
> Dominque, you so far have a list of these movement commands needing treatment:
>
>  )
>  ]]
>  <PageUp>
>  <PageDown>
>  CTRL-F
>  CTRL-B
>  CTRL-U
>  CTRL-E  (when cursor is on the top line, causing scrolling)
>  CTRL-Y  (when cursor is on the bottom line, causing scrolling)
>  CTRL-O
>  CTRL-I
>  [count]go
>  [count]g;
>
>  :[range]
>  :go [count]

I haven't tested the patch, but I'd bet that [count]z- [count]z+
[count]z<CR> [count]zt etc will need fixups, and might be easy to miss
since their no-count behavior doesn't move the cursor.

~Matt

--
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
Reply | Threaded
Open this post in threaded view
|

Re: [patch] redraw bug with 'foldcolumn' and 'conceallevel'

Dominique Pellé
In reply to this post by Vince Negri-4
Vince Negri wrote:

> From: Dominique Pellé [mailto:[hidden email]]
>
>> Thinking about it further, this second attached patch
>> also fixes the fold column redraw bug with less redraws
>> than patch in previous email.
>
>> However, unlike previous patch, it does not fix the
>> redraw glitches with moving commands )  ]] CTRL-F  (etc)
>> so they require specific fixes.
>
> I think this patch is the right way to go about it, as we shouldn't
> be redrawing unnecessarily (esp since Vim is often run over remote connections.)
>
> That does mean that explicit fixes need to be added for a number of movement
> commands, but I'd rather sort them out as they are discovered.
>
> Dominque, you so far have a list of these movement commands needing treatment:
>
>  )
>  ]]
>  <PageUp>
>  <PageDown>
>  CTRL-F
>  CTRL-B
>  CTRL-U
>  CTRL-E  (when cursor is on the top line, causing scrolling)
>  CTRL-Y  (when cursor is on the bottom line, causing scrolling)
>  CTRL-O
>  CTRL-I
>  [count]go
>  [count]g;
>
>  :[range]
>  :go [count]
>
>
> ..have you found any others since? It would be good if I could try to sort them all
> out "in one go"

Searching further, I find several other motion commands which
do not unconceal the current line and conceal the old line:

  gd
  gD
  [*
  [#

Undo commands:
  g-
  g+
  u
  CTRL-R
  :earlier
  :later
  :undo
  :redo

ctag and cscope commands:
  g]
  CTRL-]
  :ts
  :tj
  :pop
  :[count]tag
  :cs find ...

(CTRL-L to redraw works around it in all cases).

-- Dominique

--
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
Reply | Threaded
Open this post in threaded view
|

Re: [patch] redraw bug with 'foldcolumn' and 'conceallevel'

Bram Moolenaar

Dominique Pellé wrote:

> Vince Negri wrote:
>
> > From: Dominique Pellé [mailto:[hidden email]]
> >
> >> Thinking about it further, this second attached patch
> >> also fixes the fold column redraw bug with less redraws
> >> than patch in previous email.
> >
> >> However, unlike previous patch, it does not fix the
> >> redraw glitches with moving commands )  ]] CTRL-F  (etc)
> >> so they require specific fixes.
> >
> > I think this patch is the right way to go about it, as we shouldn't
> > be redrawing unnecessarily (esp since Vim is often run over remote connections.)
> >
> > That does mean that explicit fixes need to be added for a number of movement
> > commands, but I'd rather sort them out as they are discovered.
> >
> > Dominque, you so far have a list of these movement commands needing treatment:
> >
> >  )
> >  ]]
> >  <PageUp>
> >  <PageDown>
> >  CTRL-F
> >  CTRL-B
> >  CTRL-U
> >  CTRL-E  (when cursor is on the top line, causing scrolling)
> >  CTRL-Y  (when cursor is on the bottom line, causing scrolling)
> >  CTRL-O
> >  CTRL-I
> >  [count]go
> >  [count]g;
> >
> >  :[range]
> >  :go [count]
> >
> >
> > ..have you found any others since? It would be good if I could try to sort them all
> > out "in one go"
>
> Searching further, I find several other motion commands which
> do not unconceal the current line and conceal the old line:
>
>   gd
>   gD
>   [*
>   [#
>
> Undo commands:
>   g-
>   g+
>   u
>   CTRL-R
>   :earlier
>   :later
>   :undo
>   :redo
>
> ctag and cscope commands:
>   g]
>   CTRL-]
>   :ts
>   :tj
>   :pop
>   :[count]tag
>   :cs find ...
>
> (CTRL-L to redraw works around it in all cases).

I think it's time to look into a more generic solution.  Can we store
the old line number in the main loop, and only update there?
Search for last_cursormoved, that should give some hints.
Note that updates won't happen on typeahead.  Is that good or not?

--
hundred-and-one symptoms of being an internet addict:
209. Your house stinks because you haven't cleaned it in a week.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
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
Reply | Threaded
Open this post in threaded view
|

RE: [patch] redraw bug with 'foldcolumn' and 'conceallevel'

Vince Negri-4
From: Bram Moolenaar [mailto:[hidden email]]

> I think it's time to look into a more generic solution.  Can we store
> the old line number in the main loop, and only update there?
> Search for last_cursormoved, that should give some hints.
> Note that updates won't happen on typeahead.  Is that good or not?

Aha! Thanks for the tip. It looks promising..

--
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