Home Download Buy Blog Forum Support

Stop text formatting in panels

Stop text formatting in panels

Postby jburnett on Wed Nov 09, 2011 9:24 am

Is there a way for a plugin to know if the view it's working with is in a panel (e.g. find, replace, goto, etc)?

I'm using a plugin (WordHighlight) that dynamically creates regions in views. It works great, however, it's causing text in panels to have black backgrounds, making it hard to view/edit that text. This plugin effectively shows the problem:

Code: Select all
import sublime
import sublime_plugin
class HighlightTest(sublime_plugin.EventListener):
    def on_selection_modified(self, view):
        view.add_regions('myregionskey', [sublime.Region(0,view.size()/2)], 'comment')


Run that, open the search panel, and type in some search text to see the issue.
jburnett
 
Posts: 89
Joined: Wed Jul 27, 2011 9:23 pm

Re: Stop text formatting in panels

Postby jps on Wed Nov 09, 2011 12:27 pm

You can query the is_widget setting, which will be true for widgets
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Stop text formatting in panels

Postby jburnett on Wed Nov 09, 2011 7:38 pm

Great, thanks, that worked. For posterity, this is the code: view.settings.get('is_widget').

This isn't documented from what I can see - is it considered part of the "public API" of Sublime?
jburnett
 
Posts: 89
Joined: Wed Jul 27, 2011 9:23 pm


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 11 guests