How to highlight the underlined squiggle words
-
I did a quick test and it seems that logic below works
INDICATOR_TO_SEARCH = 31 length = editor.getLength() start = editor.indicatorStart(INDICATOR_TO_SEARCH, -1) end = editor.indicatorEnd(INDICATOR_TO_SEARCH, -1) real_start = start if editor.indicatorValueAt(INDICATOR_TO_SEARCH, start) else end print(start, end, length, real_start) i = 100 while real_start != length: i -= 1 if i == 0: print('ahhh endless loop - breaking') break end = editor.indicatorEnd(INDICATOR_TO_SEARCH, real_start) print(editor.getTextRange(real_start, end)) print() real_start = editor.indicatorEnd(INDICATOR_TO_SEARCH, end)
-
Maybe it is a good idea to check if start != end before executing
the while loop to see if there has been an indicator found at all
and to prevent endless loops. :) -
@Ekopalypse said in How to highlight the underlined squiggle words:
logic below works
Thanks. Converted to PerlScript:
#!perl use strict; use warnings; use Win32::Mechanize::NotepadPlusPlus ':main'; my $npp = notepad(); my $indicator = 19; my $length = editor->getLength(); my $start = editor->indicatorStart( $indicator, -1 ); my $end = editor->indicatorEnd( $indicator, -1 ); my $real_start; if ( editor->indicatorValueAt( $indicator, $start ) ) { $real_start = $start; } else { $real_start = $end; } print "$start, $end, $length, $real_start\n"; my $i = 100; while ( $real_start != $length ) { $i -= 1; if ( $i == 0 ) { print "ahhh endless loop - breaking\n"; last; } $end = editor->indicatorEnd( $indicator, $real_start ); print editor->getTextRange( $real_start, $end ); print "\n"; $real_start = editor->indicatorEnd( $indicator, $end ); }
It “works” but same issue, only finding the squigglies on screen. If I scroll down to some new squigglies, it only finds those on screen again (i.e., not the previous ones that were on screen but are no longer). Becoming more convinced this is a DSpellCheck optimization - only squiggly-ing the misspellings on screen.
Cheers.
-
hmm, did the test using the mark indicator from find dialog,
which worked, maybe I should have used/installed dspell plugin.
Sorry for the noise. -
@Ekopalypse said in How to highlight the underlined squiggle words:
Sorry for the noise.
No noise at all! In fact you pretty much confirmed it’s a DSpellCheck optimization . I was going to get around to writing a script to add indicators but didn’t know the Find => Mark could do that. Using the same long file I’ve been testing on, I Find => Mark a word I know recurs over 100 times throughout the file and all my scripts (2 previous and the one I converted from your Python example) found more than just those indicators on screen in view.
Cheers.
-
I guess for a plugin like DSpellCheck it makes sense to do its work
only for the current screen but on the other side it might be possible
to do it in the background as well - but threading and scintilla and npp …
maybe an async method would be safer. -
@Michael-Vincent said in How to highlight the underlined squiggle words:
Becoming more convinced this is a DSpellCheck optimization
I guess you are correct, as to this it checks only the visible area.
-
Hi @all ,
Me again another doubt. If the word is correct should be legitimate and I right clicked to add into Dictionary, it will be added into my own Npp only.
Is there anyway after all i extract the plug in and gave it for other people so they can use on their own Npp ? -
@Mia-Nguyen said in How to highlight the underlined squiggle words:
Hi @all ,
Is there anyway after all i extract the plug in and gave it for other people so they can use on their own Npp ?Assuming your language is US-English, it puts it into
%AppData%\Notepad++\Plugins\Config\Hunspell\en_US.usr
… thus, I would assume that it goes into that same folder, but with the appropriate language code (for whatever spelling language you have selected) as the file basename, with.usr
as the extension. So you could distribute that file, which the other users can then merge with their dictionary (assuming they’ve also added words). -
@PeterJones If i send them my .usr file. Can they use directly or have to do anything to merge?
-
@Mia-Nguyen said in How to highlight the underlined squiggle words:
@PeterJones If i send them my .usr file. Can they use directly or have to do anything to merge?
If they didn’t have any custom words yet, or if you can guarantee that your
.usr
file has every custom word they’ve already added, then they can just use your file directly. But if they save your.usr
file overtop of their old one, then any custom words they had before would be lost. -
…any custom words they had before would be lost.
If the
.usr
file is in text format (don’t know, don’t use the spell-check plugin), perhaps the Compare plugin or a script to perform an automatic merge is called for. Just sayin.