• Login
Community
  • Login

How to highlight the underlined squiggle words

Scheduled Pinned Locked Moved General Discussion
35 Posts 6 Posters 3.6k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E
    Ekopalypse
    last edited by Apr 2, 2020, 11:31 AM

    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. :)

    1 Reply Last reply Reply Quote 0
    • M
      Michael Vincent @Ekopalypse
      last edited by Apr 2, 2020, 12:48 PM

      @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.

      E 2 Replies Last reply Apr 2, 2020, 12:55 PM Reply Quote 2
      • E
        Ekopalypse @Michael Vincent
        last edited by Apr 2, 2020, 12:55 PM

        @Michael-Vincent

        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.

        M 1 Reply Last reply Apr 2, 2020, 1:15 PM Reply Quote 0
        • M
          Michael Vincent @Ekopalypse
          last edited by Apr 2, 2020, 1:15 PM

          @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.

          1 Reply Last reply Reply Quote 2
          • E
            Ekopalypse
            last edited by Apr 2, 2020, 1:26 PM

            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.

            1 Reply Last reply Reply Quote 1
            • E
              Ekopalypse @Michael Vincent
              last edited by Apr 2, 2020, 2:39 PM

              @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.

              1 Reply Last reply Reply Quote 2
              • M
                Mia Nguyen
                last edited by Apr 22, 2020, 3:43 AM

                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 ?

                P 1 Reply Last reply Apr 22, 2020, 12:46 PM Reply Quote 0
                • P
                  PeterJones @Mia Nguyen
                  last edited by Apr 22, 2020, 12:46 PM

                  @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).

                  M 1 Reply Last reply Apr 23, 2020, 8:08 AM Reply Quote 3
                  • M
                    Mia Nguyen @PeterJones
                    last edited by Apr 23, 2020, 8:08 AM

                    @PeterJones If i send them my .usr file. Can they use directly or have to do anything to merge?

                    P 1 Reply Last reply Apr 23, 2020, 1:46 PM Reply Quote 0
                    • P
                      PeterJones @Mia Nguyen
                      last edited by Apr 23, 2020, 1:46 PM

                      @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.

                      A 1 Reply Last reply Apr 23, 2020, 1:48 PM Reply Quote 2
                      • A
                        Alan Kilborn @PeterJones
                        last edited by Apr 23, 2020, 1:48 PM

                        …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.

                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors