Jason Franklin wrote:

> I noticed in gnome-terminal that window title redrawing behaved in
> unpredictable ways.  I determined that the functions did_set_title() and
> maketitle() were unstable and needed some minor refactoring.
> 
> To reproduce:
> 
>     vim --clean
> 
>     :set title
>     :set notitle title
>     :redraw
> 
> Notice that 'titleold' is displayed rather than the normal window
> title.  This is not expected.

I can reproduce this.

> The above is a corner case.  An example
> from normal Vim use is as follows:
> 
>     vim --clean
> 
>     :set title
>     :set titlestring=My\ Title
>     :options
>     :redraw
> 
> Notice 'titleold' is now seen instead of "My Title".  This is because the
> "optwin.vim" script toggles the 'title' setting internally.

I could not reproduce this.

> Note also that even :redraw fails work in both cases!

Not sure what you mean, :redraw is independent of setting the title.

> There are two problems here:
>   1. maketitle() uses a static var, "lasttitle", to keep track of the most
>      recently set title string.  When ":set notitle" is run, "lasttitle" is 
> not
>      updated.  This means that the next call to maketitle() will see no change
>      in the title string and will possibly not update the titlestring.  This 
> is
>      why ":set notitle title" breaks.
>   2. did_set_title() doesn't respect 'lazyredraw'.  Whenever notitle or noicon
>      is set, the title is updated immediately.
> 
> Both of the above problems are fixed in this patch by moving title setting
> checks into maketitle() where they belong.  This lets us update the 
> "lasttitle"
> variable, and it lets us obey the 'lazyredraw' setting by using the logic
> already in maketitle().

Thanks for the patch.  It can be improved a bit by not restoring the
title when lasttile was already NULL.

> I would include a test, but I don't see a good way to grab the current title
> being displayed.

That is indeed not so easy (and also why restoring the title sometimes
doesn't work).

-- 
hundred-and-one symptoms of being an internet addict:
56. You leave the modem speaker on after connecting because you think it
    sounds like the ocean wind...the perfect soundtrack for "surfing the net".

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
-- 
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 the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui