Sublime Forum

Selecting behavior and popup makes something wrong

#1

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:
http://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:
http://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.

0 Likes

#2

Sample code? Probbaly the view has no focus, or the view reference is lost. Try with view = sublime.active_window().active_view()

0 Likes

#3

Ok, I’ll post sample. please wait.

0 Likes