Sublime Forum

Underlining a region using sublime.DRAW_SOLID_UNDERLINE

#1

I was attempting to underline regions but ran into a problem.

I have code like:

mystuff = self.view.find_all(regular_expression) to get my list of regions.

Then I do:

self.view.add_regions(“found”, mystuff, “text.mystuff”, “dot”, sublime.DRAW_SOLID_UNDERLINE|sublime.DRAW_EMPTY|sublime.DRAW_NO_FILL|sublime.DRAW_NO_OUTLINE)

It works insofar as it will underline the WORDS in the region. If the region contains SPACES it does not underline the spaces. I have tried the flags sublime.DRAW_EMPTY and sublime.DRAW_EMPTY_AS_OVERWRITE but still no joy.

I have tried adding to my regular expression “\s” to specifically capture whitespace… and that sort of works but not really. It will underline newlines but not spaces.

A region is from point Region.a to Region.b. I would expect the functionality to underline the entire region irregardless of ‘content’.

Let me know if I’m screwing something up… I’m sure I’m failing to grasp something simple.

thanks :slight_smile:

0 Likes

#2

this is a known bug/feature:

0 Likes

#3

Found a hack from

lunixbochs

Oct 2013
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”.

but it still doesn’t quite “look right”
what a disappointment.

1 Like