Bug: bad interaction between ui and preview window for omnifunc with extra info

191 views
Skip to first unread message

Carlos Pita

unread,
Jul 2, 2014, 4:04:10 PM7/2/14
to vim...@googlegroups.com
When the omnifunc provides extra info to be shown in the preview window (in case preview is included in completeopt) there is a permanent focus switching back and forth between the current window and the preview window, which produces several annoying and very noticeable visual artifacts:

1) The window title flickers (it changes too fast so the change is perceived as a flickering artifact).

2) The window name at the taskbar also flickers.

3) Plugins like vim-airline, which are able to show a buffer list highlighting the current buffer, will madly switch the highlight back and forth.

I think an implementation which doesn't switch focus is in order.

h_east

unread,
Jul 3, 2014, 12:09:57 AM7/3/14
to vim...@googlegroups.com
Hi Carlos,

2014/7/3(Thu) 5:04:10 UTC+9 Carlos Pita:

Attached patch fixed 1) and 2).

Bram, what do you think?
--
Best regards,
Hirohito Higashi

omnifunc_and_preview_flicker.patch

Bram Moolenaar

unread,
Jul 4, 2014, 6:05:30 AM7/4/14
to h_east, vim...@googlegroups.com
It's a nice simple solution, even though it won't fix everything.
I haven't looked at the code yet, but often it's unavoidable to switch
to the buffer to be changed, which also requires switching windows,
which then requires triggering autocommands to have editing work as
expected... Perhaps it could be done with one switch and back, instead
of switching multiple times.


--
There are three kinds of people: Those who can count & those who can't.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

h_east

unread,
Jul 4, 2014, 6:37:30 AM7/4/14
to vim...@googlegroups.com, h.eas...@gmail.com
Hi Bram,

2014/7/4(Fri) 19:05:30 UTC+9 Bram Moolenaar:


> Hirohito Higashi wrote:
>
>
>
> > Hi Carlos,
>
> >
>
> > 2014/7/3(Thu) 5:04:10 UTC+9 Carlos Pita:
>
> > > When the omnifunc provides extra info to be shown in the preview window (in case preview is included in completeopt) there is a permanent focus switching back and forth between the current window and the preview window, which produces several annoying and very noticeable visual artifacts:
>
> > >
>
> > > 1) The window title flickers (it changes too fast so the change is perceived as a flickering artifact).
>
> > >
>
> > > 2) The window name at the taskbar also flickers.
>
> > >
>
> > > 3) Plugins like vim-airline, which are able to show a buffer list highlighting the current buffer, will madly switch the highlight back and forth.
>
> > >
>
> > > I think an implementation which doesn't switch focus is in order.
>
> >
>
> > Attached patch fixed 1) and 2).
>
> >
>
> > Bram, what do you think?
>
>
>
> It's a nice simple solution, even though it won't fix everything.
>
> I haven't looked at the code yet, but often it's unavoidable to switch
>
> to the buffer to be changed, which also requires switching windows,
>
> which then requires triggering autocommands to have editing work as
>
> expected... Perhaps it could be done with one switch and back, instead
>
> of switching multiple times.

I think so, my patch is really good solution. If we don't think about autocommands. :-(

autocommands is too powerful.

Carlos Pita

unread,
Jul 4, 2014, 7:41:53 AM7/4/14
to vim...@googlegroups.com, h.eas...@gmail.com

You can selectively supress autocommands at vimscript level with noautocmd and eventignore. Can you do that at the C level? Do you think it's undesirable to do so? I'm not able to think of a listener interested in this particular buffer switch as it's more of a subproduct of a particular implementation than of an intentional switch.

Cheers
--
Carlos

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

---
You received this message because you are subscribed to a topic in the Google Groups "vim_dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_dev/z-ABEOyJMFc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Fritz

unread,
Jul 4, 2014, 12:23:12 PM7/4/14
to vim...@googlegroups.com, h.eas...@gmail.com
On Friday, July 4, 2014 6:41:53 AM UTC-5, Carlos Pita wrote:
> You can selectively supress autocommands at vimscript level with noautocmd and eventignore. Can you do that at the C level? Do you think it's undesirable to do so? I'm not able to think of a listener interested in this particular buffer switch as it's more of a subproduct of a particular implementation than of an intentional switch.
>

I have autocmds to set certain options on the preview window; for example, "nowrap".

Carlos Pita

unread,
Jul 4, 2014, 12:29:43 PM7/4/14
to vim...@googlegroups.com, east h
>> You can selectively supress autocommands at vimscript level with noautocmd and eventignore. Can you do that at the C level? Do you think it's undesirable to do so? I'm not able to think of a listener interested in this particular buffer switch as it's more of a subproduct of a particular implementation than of an intentional switch.
>>
>
> I have autocmds to set certain options on the preview window; for example, "nowrap".

I was thinking just about the focus related events. It's fine to react
to the preview window creation event but I see no point reacting to a
permanent flow of focus in/out events triggered by the autocomplete
mechanism.

Carlos Pita

unread,
Jul 4, 2014, 12:31:26 PM7/4/14
to vim...@googlegroups.com, east h
> I was thinking just about the focus related events.

More precisely, about the focus related events >triggered by the
particular implementation of the autocomplete mechanism<, not by the
user or other plugins or parts of vim where they could arguably be of
interest.

Carlos Pita

unread,
Jul 12, 2014, 12:18:29 AM7/12/14
to vim...@googlegroups.com
What do you think about supressing events in the specific way I described above? Is it possible without a lot of work? Could it be problematic for some reasonable use case?

h_east

unread,
Jul 15, 2014, 9:16:03 AM7/15/14
to vim...@googlegroups.com
Hi Carlos,

2014/7/12(Sat) 13:18:29 UTC+9 Carlos Pita:


> What do you think about supressing events in the specific way I described above? Is it possible without a lot of work? Could it be problematic for some reasonable use case?

I think your idea is last resort.
Because it would be an incomplete work the autocmd mechanism.
I think that there is a good solution to the other.
I do not know just yet...
Let's read a src/edit.c

h_east

unread,
Jul 16, 2014, 10:42:02 AM7/16/14
to vim...@googlegroups.com
Hi Bram,

Attach a patch.
Suppress preview window's status line redrawing when popupmenu opened for completion with preview window.

What do you think? worth to consider?

suppress_flicker_for_completion_with_prevwin.patch

Bram Moolenaar

unread,
Jul 17, 2014, 11:34:05 AM7/17/14
to h_east, vim...@googlegroups.com

Hirohito Higashi wrote:

> Attach a patch.
> Suppress preview window's status line redrawing when popupmenu opened
> for completion with preview window.
>
> What do you think? worth to consider?

Looks tricky. What if the popup menu was covering the status line
before, and now reveals (part of) it? Does the check for "resized"
catch that?


--
Every time I lose weight, it finds me again!

h_east

unread,
Jul 23, 2014, 10:48:56 AM7/23/14
to vim...@googlegroups.com, h.eas...@gmail.com
Hi Bram,

2014/7/18(Fri) 0:34:05 UTC+9 Bram Moolenaar:


> Hirohito Higashi wrote:
>
>
>
> > Attach a patch.
>
> > Suppress preview window's status line redrawing when popupmenu opened
>
> > for completion with preview window.
>
> >
>
> > What do you think? worth to consider?
>
>
>
> Looks tricky. What if the popup menu was covering the status line
>
> before, and now reveals (part of) it?

I update a patch. Please check.

> Does the check for "resized" catch that?

It seem to redraw correctly in the existing code.

suppress_prevwin_statusline_redraw_in_completion.patch
Reply all
Reply to author
Forward
0 new messages