Home Download Buy Blog Forum Support

selecting behavior and popup makes something wrong.

selecting behavior and popup makes something wrong.

Postby sassembla on Mon Feb 17, 2014 3:43 pm

In ST3 build 3059,

view.show_popup_menu() can show popup, it's great.
But the selecting behavior and popup makes something wrong.

Select text, show popup, then close/cancel popup, selection will be restored forcely.

the reproducible step is below.

pattern A:
1.store region
2.wrap that region manually
3.when the stored region wrapped by selection(click red dot), fire "view.show_popup_menu()" internally.
4.popup appeared. choose something or cancel
5.tooltip disappeared
6.the selection is still there (it's not problem yet.)
7.run view.sel().clear(), but it does not work. selections are still there.

example:
https://vimeo.com/86896735

after popup disappeared + view.sel.clear(), selection is still there.
when moving cursor, selection moves too. like "move cursor with shift key pressed".

Is this valid behavior?


I tried to arrange the order of API.
run no.7's operation via text_command,
but no effect.


finally I could clear selection like below.

pattern B:
1.store region by select text (same
2.wrap that region manually (same
3.when the stored region wrapped by selection(select dot), fire "view.sel.clear()"
4.wait 10 milli sec. selection disappeared in time.
5.run "view.show_popup_menu()"
6.choose something or cancel
7.tooltip disappeared
8.no selection survive. nothing selected. looks good.

example:
https://vimeo.com/86897576

This only work fine with no.4. If no wait, produces pattern A.


It's too tricky but OK….

popup is verrrrry good feature.
sassembla
 
Posts: 12
Joined: Sat Apr 20, 2013 9:10 am

Re: selecting behavior and popup makes something wrong.

Postby tito on Thu Feb 20, 2014 4:05 pm

Sample code? Probbaly the view has no focus, or the view reference is lost. Try with view = sublime.active_window().active_view()
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 854
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: selecting behavior and popup makes something wrong.

Postby sassembla on Fri Feb 21, 2014 4:15 am

Ok, I'll post sample. please wait.
sassembla
 
Posts: 12
Joined: Sat Apr 20, 2013 9:10 am


Return to Plugin Development

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests