nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] undoing replaces in a marked region goes wrong


From: Benno Schulenberg
Subject: Re: [Nano-devel] undoing replaces in a marked region goes wrong
Date: Fri, 27 Mar 2015 11:52:44 +0100

On Fri, Mar 27, 2015, at 11:44, Benno Schulenberg wrote:
> When having done some replaces in a marked region, undoing these
> will eat whatever was on the mark's line before the mark.

Oh, I discovered this while looking at this piece of code and not
succeeding in making sense of it:

#ifndef NANO_TINY
            /* If the mark was on and (mark_begin, mark_begin_x) was the
             * top of it, don't change mark_begin_x. */
            if (!old_mark_set || !right_side_up) {
                /* Keep mark_begin_x in sync with the text changes. */
                if (openfile->current == openfile->mark_begin &&
                        openfile->mark_begin_x > openfile->current_x) {
                    if (openfile->mark_begin_x < openfile->current_x +
                        match_len)
                        openfile->mark_begin_x = openfile->current_x;
                    else
                        openfile->mark_begin_x += length_change;
                }
            }

            /* If the mark was on and (current, current_x) was the top
             * of it, don't change real_current_x. */
            if (!old_mark_set || right_side_up) {
#endif
                /* Keep real_current_x in sync with the text changes. */
                if (openfile->current == real_current &&
                        openfile->current_x <= *real_current_x) {
                    if (*real_current_x < openfile->current_x + match_len)
                        *real_current_x = openfile->current_x + match_len;
                    *real_current_x += length_change;
                }
#ifndef NANO_TINY
            }
#endif

It's in src/search.c from line 805.  (Do an 'svn up' before.)

Benno

-- 
http://www.fastmail.com - Email service worth paying for. Try it for free




reply via email to

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