Tony wrote:

> • In Normal gvim with Motif GUI in GUI mode, :echo exists(':tearoff')
> gives 0 but menus can be teared off from the menu bar with the mouse
> • In the same in Console mode, :echo exists(':tearoff') gives 2
> • In Huge gvim with GTK3 GUI (where menus cannot be teared off with
> the mouse), :echo exists(':tearoff') gives 2 even in the GUI.
> • In all these cases, :tearoff PopUp (or with any other menu name)
> gives error "E319: Sorry, the command is not available in this
> version."
> 
> In my humble opinion, E319 ought never to happen if a prior check with
> exists(':command') has given 2.

This is a special case: The command is in the list of supported
commands, but it is only actually implemented for MS-Windows.

> :help tear-off-menus says that tearoff menus are available with Motif
> or GTK2 GUIs but not GTK3 version 3.4 or later and indeed, I can tear
> off menus (but only with the mouse) in Motif gvim but not in GTK3
> 3.24.38.
> 
> • Maybe the Motif Vim should evaluate exists(':tearoff') to zero even
> when not in GUI mode?

Having exists() return non-zero for a command that doesn't work is
misleading.  However, returning zero also isn't correct, since Vim does
know about the command.  Currently the returned values are:

        1  for match with start of a command
        2  full match with a command
        3  matches several user commands

That doesn't leave room for a new value.  The best I can think of would
be to return one:

        1  for match with start of a command
           and full match with command that is
           not implemented

Any better ideas?

> • Maybe the GTK3 GUI with GTK3 3.4 or later should evaluate
> exists('tearoff') to zero in all cases?
> • Maybe the help for :tearoff (which is in gui_w32.txt) should insist
> on the fact that this command applies only to Windows?

It won't hurt to state that explicitly.

> • Or, contrariwise, maybe the :tearoff command should be extended to
> Motif and GTK2 GUIs, which have tearoff menus (but only by mouse
> AFAICT)?

I do not know how to do that.  Perhaps there is a function for that, I
haven't attempted finding it.

-- 
Google is kind of like Dr. Who's Tardis; it's weirder on the
inside than on the outside...

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230626113126.7DF1A1C054C%40moolenaar.net.

Raspunde prin e-mail lui