Alexey-T / CudaText

Cross-platform text editor, written in Free Pascal
Mozilla Public License 2.0
2.39k stars 166 forks source link

HiOccur doesn't follow all the properties from `theme_item_` options #5501

Closed pintassilgo closed 1 month ago

pintassilgo commented 1 month ago

HiOccur has options theme_item_current and theme_item_other to set hilite style. But current code reuses border_bottom for all the four directions and ignores bold/italic/strikeout. It should follow the same style entirely.

For example, with current code it's impossible if I want to set hilite to be only a underscore (border bottom, without border in other directions).

Something like this, maybe:

    theme = app.app_proc(app.PROC_THEME_SYNTAX_DICT_GET, '')
    item_oth = theme.get(opt.THEME_OTHER)

    ed_self.attr(app.MARKERS_ADD_MANY, MARKTAG, xx, yy, nn,
                 color_font=item_oth['color_font'],
                 color_bg=item_oth['color_back'],
                 color_border=item_oth['color_border'],
                 border_left=item_oth['border_left'],
                 border_right=item_oth['border_right'],
                 border_up=item_oth['border_top'],
                 border_down=item_oth['border_bottom'],
                 font_bold=+('b' in item_oth['styles']),
                 font_italic=+('i' in item_oth['styles']),
                 font_strikeout=+('s' in item_oth['styles']),
                 )
Alexey-T commented 1 month ago

Can you test your fix, and make the patch?

Alexey-T commented 1 month ago

I am working on it, don't do it

pintassilgo commented 1 month ago

It works, but I'm not Python dev so improvements should be done, like caching item_oth out of the function to prevent having to process theme.get(opt.THEME_OTHER) every match.

Also, I couldn't make underline to work.

pintassilgo commented 1 month ago

I played with "Lexer style" dialog and it's working: bold, italic, strikeout, borders in the 4 directions separately... but checking "underline" doesn't work.

Alexey-T commented 1 month ago

I made fix in the plugin's git. please test from git. https://github.com/CudaText-addons/cuda_hilite_occurrences/

Alexey-T commented 1 month ago

Underline-font style from theme props dialog cannot be used. Py API don't allow it. and underliying atsynedit API also does not.

Alexey-T commented 1 month ago

Posted more changes to git.

pintassilgo commented 1 month ago

Thanks.

Underline-font style from theme props dialog cannot be used. Py API don't allow it. and underliying atsynedit API also does not.

So, after all, underline is not the same as border bottom, right?

Alexey-T commented 1 month ago

it is not the same maybe, but the look of bottom-line is the same, so to emulate underline, just set the bottom-line.