Skip to content
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

redraw/redrawstatus does not flush window. #174

Closed
lambdalisue opened this issue Dec 15, 2015 · 17 comments
Closed

redraw/redrawstatus does not flush window. #174

lambdalisue opened this issue Dec 15, 2015 · 17 comments

Comments

@lambdalisue
Copy link

redraw or redrawstatus does not flush window in MacVim so users cannot recognize the current status by indicators like "Downloading [2/5]..." or whatever. Try https://gist.github.com/lambdalisue/94d14ff706a5627d64f5

So I add gui_macvim_flush() after ex_redraw and ex_redrawstatus in this commit.
It seems that the issue no longer exists with that commit but I am not familiar with Vim/MacVim source code so could anyone check the side-effect and fix this problem?

Thanks :-)

@splhack
Copy link
Contributor

splhack commented Dec 15, 2015

Thanks. Could you test #175?

@lambdalisue
Copy link
Author

Perfect. Thanks. I'm looking forward it to be merged ;-)

@lambdalisue
Copy link
Author

🎊

@chdiza
Copy link
Contributor

chdiza commented Dec 20, 2015

Shouldn't this have been solved by using :redraw! instead of :redraw, rather than chaning MacVim source?

Plain Vim doesn't behave in the way that this commit (and #182) make MacVim behave.

@lambdalisue
Copy link
Author

Shouldn't this have been solved by using :redraw! instead of :redraw, rather than chaning MacVim source?

I don't think so. I tried redraw! but using redraw! in for loop makes screen blinking.

Vim help said.

                            *:redr* *:redraw*
:redr[aw][!]        Redraw the screen right now.  When ! is included it is
            cleared first.
            Useful to update the screen halfway executing a script
            or function.  Also when halfway a mapping and
            'lazyredraw' is set.

So redraw and redraw! is a bit different.
I tinkg calling gui_macvim_flush_force after redraw or redrawstatus is a correct behavior.

@chdiza
Copy link
Contributor

chdiza commented Dec 20, 2015

but using redraw! in for loop makes screen blinking

But that's how plain Vim works.

Also, the flush_force version of this repair makes for a blinking cursor upon :redraw, when it didn't previously blink.

@chdiza
Copy link
Contributor

chdiza commented Dec 20, 2015

The docs show that :redraw isn't supposed to completely clear and then redraw the screen. That's what :redraw! is for.

@lambdalisue
Copy link
Author

But that's how plain Vim works.

No. At least in Vim on Ubuntu, GVim on Ubuntu, or Vim on Mac, the screen does not blink when I call :redraw but redraw!. So you cannot use redraw! instead of redraw. It's different.

https://gist.github.com/lambdalisue/94d14ff706a5627d64f5

The docs show that :redraw isn't supposed to completely clear and then redraw the screen. That's what :redraw! is for.

No. :redraw! stands for to clear first. redraw should also redraw the screen whenever called as well but without clearing (thus the screen won't blink).

I'm not sure if calling gui_macvim_flush_force is a correct way but I'm sure that the previous behavior is way different from other Vim.

@lambdalisue
Copy link
Author

And actually I noticed that redraw! did not work as well in revision ddc5c14 the one before the fix.

@chdiza
Copy link
Contributor

chdiza commented Dec 21, 2015

No. :redraw! stands for to clear first. redraw should also redraw the screen whenever called as well but without clearing (thus the screen won't blink).

That's what I said. :redraw is not for clearing first, :redraw! is for clearing first.

@splhack
Copy link
Contributor

splhack commented Dec 21, 2015

@chdiza your comment "Plain Vim doesn't behave in the way that this commit (and #182) make MacVim behave. " is useless. Please provide a concrete reproduction scenario like https://gist.github.com/lambdalisue/94d14ff706a5627d64f5.

@chdiza
Copy link
Contributor

chdiza commented Dec 21, 2015

At the very least, if I take that gist and :source it and run Test2, the behavor is different in MacVim and plain Vim. In plain Vim (i.e., from github.com/vim/vim, /usr/local/bin -u NONE -N), I see the countdown from 99 echoed by single digits. In MacVim (mvim -u NONE -U NONE -N) I see nothing at all echoed. It should work in both MacVim and plain Vim. If I run MacVim in the console, it behaves like plain Vim.

@lambdalisue
Copy link
Author

Now I got. Yes it seems an issue on redraw! but redraw. It is a quite strange behavior ... I didn't notice.

@chdiza
Copy link
Contributor

chdiza commented Dec 21, 2015

It didn't do that prior to the flush tweaks. I don't have time right now to see whether it was introduced in the flush or the force_flush change.

@lambdalisue
Copy link
Author

Expected behavior

Of https://gist.github.com/lambdalisue/94d14ff706a5627d64f5

Indicator is increasing 1 by 1 (E.g. Test: 1 -> Test: 2 -> ...) without blinking screen when Test 1 (redraw) is called.
Indicator is increasing 1 by 1 (E.g. Test: 1 -> Test: 2 -> ...) with blinking screen (because of screen flush) when Test 2 (redraw!) is called.

Actual behavior

Just before the redraw fix

revision: ddc5c14

Both Test1 and Test2 hung a bit and Test 99 is suddenly shown.

After the 1st redraw fix

revision: 2d3163f

Indicator is increasing 2 by 2 (Test: 1 -> Test: 3 -> ...) without blinking screen when Test 1 is called (almost correct behavior).
Nothing is shown when Test 2 is called.

After the 2nd redraw fix

revision: 05e488d

Indicator is increasing 1 by 1 (Test: 1 -> Test: 2 -> ...) without blinking screen when Test 1 is called (correct behavior).
Nothing is shown when Test 2 is called.

My conclusion

Both redraw and redraw! were broken and only redraw was fixed with recent commits. So reverting the commits won't fix the problem and further workarounds are required I guess. But I'm not really familiar with the code of Vim nor MacVim so I have no idea how :-p

It didn't do that prior to the flush tweaks

Let us know the revision. For me, this issue exists from when I started to use MacVim (several years ago). You may know the revision which works fine for redraw! workaround and that might help to resolve the issue.

How did I change the revision (in case)

I add :revision => "xxx" to brew edit macvim and re-installed.

head "https://github.com/macvim-dev/macvim.git", :revision => "ddc5c14"

@chdiza
Copy link
Contributor

chdiza commented Dec 21, 2015

with blinking screen (because of screen flush) when Test 2 (redraw!) is called.

Why is a blinking screen expected in this case? It doesn't blink in plain Vim when I call Test2.

@lambdalisue
Copy link
Author

because it clear the screen. try with fullscreen mode and/or a slow machine. prob your GPU is too fast to recognise i guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants