On 27/12/08 04:43, Markus Heidelberg wrote:
> björn, 26.12.2008:
>> Hi,
>>
>> Currently if I use the mouse to close a tab (click the "close" button
>> on Mac, right-click tab and select "close" on pop-up menu on Windows)
>> when there is a modified buffer I get the following warning message:
>>    "E37: No write since last change (add ! to override)"
>> This is kind of unhelpful since you can't "add !" using the mouse only.
>
> Sorry for hijacking the thread, but while playing around I noticed that
> a tabpage cannot be closed with the menu item File->Close (:close) for
> me. Typing :close worked, so I looked at runtime/menu.vim:
>
>       \ :if winheight(2)<  0<Bar>
>       \   confirm enew<Bar>
>       \ else<Bar>
>       \   confirm close<Bar>
>       \ endif<CR>
>
> winheight(2) always returns -1 for me, when on a tabpage without
> vertically or horizontally split windows. Maybe there is something wrong
> with it, but what's the intention of the :enew in a close item at all?

winheight(2) is -1 if there is no 2nd window, i.e., the window isn't 
split. The purpose is to avoid closing the last window (:close gives an 
error if attempted on the only window in Vim). This menu is perhaps 
unchanged since version 6 (which had no tabs).

>
>> The attached patch fixes this problem by displaying the "Save changes"
>> dialog instead of the warning message in the above scenario.  I think
>> it is as simple as calling "conf tabclose" instead of "tabclose" in
>> handle_tabmenu() (at least the comment before that function seems to
>> imply that it is only called when the user interacts with the GUI
>> tabline using the mouse), but correct me if I'm wrong.
>
> Works at least with GTK+ 2 on Linux.
>
> Markus

Best regards,
Tony.
-- 
God is real, unless declared integer.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui