-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Fix fold update problem #5351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix fold update problem #5351
Conversation
147d7f8
to
458047d
Compare
Fixed tests. |
All tests are passed! |
Why not always update folds after leaving insert-mode? That avoids the global flag. |
OK. |
This fix is OK? |
|
||
fold_T *fp; | ||
if (wp->w_buffer->terminal) { | ||
if (compl_busy || State & INSERT || wp->w_buffer->terminal) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not in terminal buffers?
@@ -462,6 +462,8 @@ static void insert_enter(InsertState *s) | |||
o_lnum = curwin->w_cursor.lnum; | |||
} | |||
|
|||
foldUpdateAll(curwin); | |||
foldOpenCursor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was calling foldUpdateAll()
before now? We are adding new calls, but can we delete the old one?changed_common
was the origin, nothing we can remove there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Shougo This seems to open folds on any cursor motion (not change) now. Why is foldOpenCursor()
needed? Can we remove it?
@@ -5924,6 +5924,9 @@ static void nv_replace(cmdarg_T *cap) | |||
curwin->w_set_curswant = true; | |||
set_last_insert(cap->nchar); | |||
} | |||
|
|||
foldUpdateAll(curwin); | |||
foldOpenCursor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? insert_enter()
should be enough. The comment above edit()
mentions that it handles gr
, gR
, R
, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see now only a special case of r
is handled by edit()
. But why didn't change_common
take care of it?
Looking...
It seems the foldUpdate
call in change_common
doesn't invalidate window folds. So that's why foldUpdateAll
is needed.
Fixes failing test: 045_folding_spec.lua References #5299
Merged. Thanks @Shougo ! |
Thank you! |
I have updated the vim_dev patch. |
I have fixed fold update problem.
The fold is updated in insertleave or
nv_replace
if the update is skipped.It fixes #5299 test failures.
Note:
nv_replace
is normal-moder
implementation.It enters insert mode and change text.
So, the fix is needed...