Skip to content

Conversation

bfredl
Copy link
Member

@bfredl bfredl commented Jan 12, 2019

Followup to #9484.
There is various places where 'conceallevel' and 'concealcursor' necessitates additional redraws. This tries to separate the different cases and handle each accordingly:

  • share code with 'cursorline' for the common case: vertical move of cursor within the same window (concealcursor not active)
  • improve the logic for managing 'concealcursor' and switching modes: test for the case where the new mode behaves differently from the last one.
  • clarify the special case for horizontal movement within a line when 'concealcursor' is active, now there is an if-statement only for this and not hidden in larger check mostly for the first point.
  • keep the special case for moving between windows as is.

NB: there might still remain glitches. I will add more tests tomorrow (and fix if needed).

NB2: the third point is especially interesting. I plan to reuse the same logic to support virtualtext in the middle of a line (drawing the text I can do, but I have never managed to get cursor position right. Now I think I understand how conceal does it...)

@bfredl
Copy link
Member Author

bfredl commented Jan 12, 2019

cc @brammool the further 'concealcursor' cleanup might be interesting, though there could be more places to check in vim.

@bfredl bfredl changed the title redraw: share more between cursorline and conceal cursor redraws redraw: share more code between cursorline and conceal redraws Jan 12, 2019
@justinmk justinmk added the has:vim-patch issue is fixed in vim and patch needs to be ported label Jan 12, 2019
@bfredl
Copy link
Member Author

bfredl commented Jan 12, 2019

Note to self: add tests for open line (seems to work already, but a special case worth testing), as well as cocu=c

@bfredl bfredl added refactor changes that are not features or bugfixes display redraw, layout, presentation labels Jan 12, 2019
@bfredl
Copy link
Member Author

bfredl commented Jan 13, 2019

Added a bit more tests, all pass both on master and on this branch. With incsearch, the cocu redraw dosen't happen immediately on / (mode switch), but on first typed char (same in nvim/vim master). I think it is intentional, the extra redraw would be distracting (also avoids unnecessary :somecommand redraw at the same time). One can force the redraw with CmdlineEnter if one doesn't like this.

There is various places where 'conceallevel' and 'concealcursor'
necessitates additional redraws. This tries to separate the different
cases and handle each accordingly:

  - Share code with 'cursorline' for the common case: vertical move of
    cursor within the same window (concealcursor not active)
  - Improve the logic for managing 'concealcursor' and switching modes:
    test for the case where the new mode behaves differently from the
    last one.
  - Clarify the special case for horizontal movement within a line when
    'concealcursor' is active, now there is an if-statement only for this
     and not hidden in larger check mostly for the first point.
  - Keep the special case for moving between windows as is.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
display redraw, layout, presentation has:vim-patch issue is fixed in vim and patch needs to be ported refactor changes that are not features or bugfixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants