Home Download Buy Blog Forum Support

Underline

Underline

Postby Gadgetroch on Mon Sep 23, 2013 9:29 pm

Hi,

I search how underline a word with sublime text.

Someone help ?

Thanks
Gadgetroch
 
Posts: 3
Joined: Sun Sep 22, 2013 10:00 am

Re: Underline

Postby jbrooksuk on Mon Oct 14, 2013 4:35 pm

Underline isn't available yet I'm afraid.
jbrooksuk
 
Posts: 781
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Underline

Postby quarnster on Sun Oct 20, 2013 9:42 pm

Not true, it can be done via add_regions:
Code: Select all
    v = sublime.active_window().active_view()
    v.add_regions("hello", [sublime.Region(0,v.size())], "somescope","", sublime.DRAW_SOLID_UNDERLINE|sublime.DRAW_NO_FILL|sublime.DRAW_NO_OUTLINE)
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: Underline

Postby lunixbochs on Sat Oct 26, 2013 8:55 am

You can also get a solid underline (with no word breaks) by underlining a list of empty regions (one zero-width pos each, for the width of your underline) and the add_regions flag "sublime.DRAW_EMPTY_AS_OVERWRITE".

This has been working since 2011.
lunixbochs
 
Posts: 91
Joined: Fri Oct 08, 2010 10:18 pm

Re: Underline

Postby hick on Sat Nov 02, 2013 11:53 am

quarnster wrote:Not true, it can be done via add_regions:
Code: Select all
    v = sublime.active_window().active_view()
    v.add_regions("hello", [sublime.Region(0,v.size())], "somescope","", sublime.DRAW_SOLID_UNDERLINE|sublime.DRAW_NO_FILL|sublime.DRAW_NO_OUTLINE)



How can I get the list of the "somescope" ? I just had some try and found a scope named "keyword"
I searched the API documentation and the google but failed.

I found the "view.scope_name(view.sel()[0].begin())" will get some king of "scope_name", but it's a long text like "source.python meta.function.python meta.function.parameters.python variable.parameter.function.python", I extracted some words like "variable", "parameter", but no other color appeared
hick
 
Posts: 8
Joined: Fri Aug 09, 2013 5:36 am

Re: Underline

Postby tito on Mon Nov 11, 2013 6:51 am

Underline works:

sublime.active_window().active_view().add_regions('keyword', [sublime.Region(0, sublime.active_window().active_view().size())], 'b', '', sublime.DRAW_SOLID_UNDERLINE|sublime.DRAW_NO_FILL|sublime.DRAW_NO_OUTLINE)
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 864
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 6 guests