CudaText icon indicating copy to clipboard operation
CudaText copied to clipboard

"Highlight occurences" plugin doesn't work with multi-line fragments

Open hastyeagle opened this issue 1 year ago • 3 comments

It seems that Highlight occurences doesn't work if there is a line end character involved. I'd like to be able to select the last character in the previous line (CR/LF/etc.) and then continue onto the next line with whatever I'm selecting. However, it seems when I hit the line end character, it just doesn't work. Any way to get it to work with a line end character?

https://synwrite.sourceforge.net/forums/viewtopic.php?p=19234

hastyeagle avatar Jun 19 '24 01:06 hastyeagle

Somebody wants to work on plugin, to support multi-line fragments, please?

Alexey-T avatar Jun 19 '24 01:06 Alexey-T

Alex,

Looking into the code and reviewing the API documentation, and after some tests: image

I think the MARKERS_ADD functionality doesn't accept "crossing to a new line", even if I increase the length parameter.

What other command do we need to use to "mark" many lines?

JairoMartinezA avatar Jun 26 '24 17:06 JairoMartinezA

yes, API don't support marker for several lines. but plugin can find proper multi-line fragments and place markers on the 1st line of match. so that user will find fragments.

Alexey-T avatar Jun 27 '24 02:06 Alexey-T

@hastyeagle @miroslavmatas @pintassilgo sorry for long delay, but I was busy with other tasks. let's try simple fix for HiOccur plugin which helped me with this issue! file py/cuda_hilite_occurrences/__init__.py, find this block

            # After sorting y2 always will be greater or equal to y1
            # No multi-line allowed
            if (y2 - y1) > 0: return

and comment last line with 'return'. now for me, plugin marks all matches even if multi-line. only beginning line of matches, not full matches.

Screenshot from 2024-12-27 18-13-04

Alexey-T avatar Dec 27 '24 15:12 Alexey-T

applied this fix, and updated the plugin in AddonManager.

Alexey-T avatar Dec 29 '24 12:12 Alexey-T