Wei Zhang wrote:
I added the terminal popup menu as just a simple way to select an
action. Mainly for the terminal debugger. I don't really want to spend
a lot of time on improving it.
> > > And on last thing, special character '&' can not be used in the TUI popup,
> > Yeah, it's hard to find a way to highlight it. And then how do you type
> > the character? Mappings may get in the way. Alt key may not always
> > work.
> It is not necessary to highlight special character, they can be distinguished
> by parentheses.
> :amenu PopUp.Cscope\ (&D)efinition ...
> :amenu PopUp.Cscope\ (&S)ymbol ...
> :amenu PopUp.Cscope\ (&C)allee ...
> :amenu PopUp.Cscope\ (&A)ssigned ...
> They should look like:
> Cscope (D)efinition
> Cscope (S)ymbol
> Cscope (C)allee
> Cscope (A)ssigned
> or items can also be arranged by user like:
> [D] Cscope Definition
> [S] Cscope Symbol
> [C] Cscope Callee
> [A] Cscope Assigned
> Both of them are quite acceptable, just like some traditional mono
> color TUI tools .
> So, highlighting is not necessary if it requires a lot of work.
It does require defining a menu specifically for the terminal, or the
same menu entry with different string to display in the GUI or in a
terminal. This makes it more complex.
> What might be necessary is making GVim's ':popup' command display the
> TUI's text based popup menu instead of the native win32's popup menu
> (or a guioption for this ?).
> Can I explain this a little ?
> 1. GUI popup is only available for Win32 and GTK, but text based popup
> can run every where.
Only when the mouse is supported. And it only works properly when mouse
dragging is supported. Preferably also mouse movements (just made that
work for Win32). Mouse support is not trivial, see term.c for all the
code for different mouse implementations.
> 2. Part of vim users use CTRL+[ as ESC, text based popup can be closed by
> CTRL+[ while native GUI popup can't.
> 3. Native GUI ":popup" command sometimes behave in a strange way (also
> mentioned in gui.txt) and different from TUI's popup menu.
> Here is an example:
> ----------- menutest.vim ------------
> silent! aunmenu ]test.*
> let g:selected_index=-1
> amenu <silent> ]test.item\ 1 :let g:selected_index=1<cr>
> amenu <silent> ]test.item\ 2 :let g:selected_index=2<cr>
> amenu <silent> ]test.item\ 3 :let g:selected_index=3<cr>
> amenu <silent> ]test.item\ 4 :let g:selected_index=4<cr>
> amenu <silent> ]test.item\ 5 :let g:selected_index=5<cr>
> amenu <silent> ]test.item\ 6 :let g:selected_index=6<cr>
> function! MenuInputList()
> let g:selected_index=-1
> popup ]test
> echo "selected: ".g:selected_index
> return g:selected_index
> When MenuInputList() happens in TUI vim, you can see `g:selected_index` has
> been changed after ":popup" command, it is definitely the right way.
> But it is a different result in GVim, no matter what item is selected, the
> echo command below will always print "selected: -1". After my investigation,
> ":popup" command returns before actually executing the real menu command "let
> g:selected_index=?". It seems that the real menu command has been queued in
> win32 message buffer and will not be execute before ':popup' exits.
> So, the echo command displays the unchanged g:selected_index in GVim.
> But when I was trying the TUI's ":popup" command in the latest vim, it worked
> great !! menu command (let g:selected_index=?) can be executed **BEFORE**
> ":popup" command returns.
> Executing menu command **BEFORE** ":popup" exiting is important because
> following commands can get the result of selected item. if not, every
> following command in the same function behave in the wrong way.
> So, do you think it is necessary to execute menu command before ":popup"
> returning ? or to replace GVim's ":popup" menu with the TUI's text based one ?
No, in the GUI you can't block on making a selection in the menu. The
event loop must be processed. At least it can't be done without a lot
You can use some kind of loop to check if the user made a selection.
Main problem is that you don't know when the user closed the menu
without making a selection.
This computer is so slow, it takes forever to execute and endless loop!
/// Bram Moolenaar -- b...@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 ///
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
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.