nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] Spell check marked text


From: David Lawrence Ramsey
Subject: Re: [Nano-devel] Spell check marked text
Date: Mon, 11 Oct 2004 11:54:51 -0400
User-agent: Mozilla Thunderbird 0.8 (X11/20040913)

--- Rocco Corsi <address@hidden> wrote:
>  Actually, maybe I don't understand how to use the Mark feature.  See
>if I am doing this right.
>
>1) create a file with one line with some spelling mistake
>2) make four copies of this same line
>3) go to the beginning of the third line
>4) hit CTRL-^
>5) move to the end of the line (it will highlight the line)
>6) spell check (i.e. CTRL-t)
>7) Nano will prompt to "Edit a replacement: badword" on the first line.

I've been able to reproduce this, and yes, you're doing it right. Thanks for the clarification.

>Is this what how the feature was supposed to be implemented or a bug? >I am just asking because someone could make a case for either way.
>
>I mean:
>
>1) only send the marked text to "spell", but correct entire document
>2) only send the marked text to "spell", but correct marked text only

What it's doing here is not what it's supposed to be doing.  2) is what
it should be doing, IMO.  If the mark is on, only the marked text should
be changed.

I think I've fixed this in CVS.  (Please let me know if it works
properly.)  Now, if the mark is on, do_replace_loop() skips over all
matches not inside the mark.  I considered following the approach in
write_marked() (temporarily setting fileage, filebot, current, etc. so
that nano thinks the file contains only the marked text), but that would
have caused a lot of problems if the user resizes the window while the
replace prompt is being shown.  Incidentally, this also means that
replacing in general now only works on marked text when the mark is on,
a feature that Joseph Birthisel suggested in April 2003.

While I was testing this, I found another bug.  Type "tesssting" into a
blank buffer, do a regular expression search for "te?", and then try
running the internal spell checker.  nano will flag the word as
misspelled, but then, since the internal spell checker doesn't turn
regular expression searches off, it'll call regexec() in an attempt to
match subexpressions, etc. and end up segfaulting.  To fix this, the
regular expression search flag is now turned off when the internal spell
checker is running.  Also, the reverse search flag is turned off when
NANO_SMALL is defined, in which case the flag is never used.  Both of
these fixes are in CVS.  nano 1.2.4 is also vulnerable to this, so
there's a patch against 1.2.4-cvs here:

http://pooka_regent.tripod.com/patches/nano/nano124intspell-patch.txt

One last note: at the moment, marked spell check only partially works
with the alternate spell checker.  Apparently when I put it in, I forgot
to add code to properly merge the changed text back into the file. (It'll have to go in eventually, as the same technique will be needed to
undo things like multiple justify operations when undo/redo is
implemented.)  The TODO list item is updated accordingly.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]