1
1

in cut_marked_segment(), respect concatenate_cut, as we need to use it

if we do a marked cut and immediately follow it with a cut-to-end (which
uses that function)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2095 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
David Lawrence Ramsey 2004-11-13 01:32:17 +00:00
родитель bfb98f8bd4
Коммит 649b431171
2 изменённых файлов: 25 добавлений и 4 удалений

Просмотреть файл

@ -114,6 +114,10 @@ CVS code -
handle this. (DLR) handle this. (DLR)
- Convert some ints with predefined boundaries to enums. (DLR) - Convert some ints with predefined boundaries to enums. (DLR)
- cut.c: - cut.c:
cut_marked_segment()
- Respect concatenate_cut, as we need to use it if we do a
marked cut and immediately follow it with a cut-to-end (which
uses this function). (DLR)
do_cut_text() do_cut_text()
- Set concatenate_cut to TRUE unconditionally when doing a - Set concatenate_cut to TRUE unconditionally when doing a
marked cut. This fixes an incompatibility with Pico where an marked cut. This fixes an incompatibility with Pico where an

Просмотреть файл

@ -59,8 +59,8 @@ void add_to_cutbuffer(filestruct *inptr, bool allow_concat)
cutbuffer = inptr; cutbuffer = inptr;
#ifndef NANO_SMALL #ifndef NANO_SMALL
else if (allow_concat && concatenate_cut) { else if (allow_concat && concatenate_cut) {
/* Just tack the text in inptr onto the text in cutbottom, /* If allow_concat is TRUE and we're concatenating, tack the
* unless allow_concat is FALSE. */ * text in inptr onto the text in cutbottom. */
cutbottom->data = charealloc(cutbottom->data, cutbottom->data = charealloc(cutbottom->data,
strlen(cutbottom->data) + strlen(inptr->data) + 1); strlen(cutbottom->data) + strlen(inptr->data) + 1);
strcat(cutbottom->data, inptr->data); strcat(cutbottom->data, inptr->data);
@ -120,9 +120,26 @@ void cut_marked_segment(void)
cutbuffer = tmp; cutbuffer = tmp;
cutbottom = tmp; cutbottom = tmp;
} else { } else {
if (concatenate_cut) {
/* If we're concatenating, tack the text in the first line
* of tmp onto the text in the bottom of the cutbuffer, and
* move tmp one line down to where its next line begins. */
cutbottom->data = charealloc(cutbottom->data,
strlen(cutbottom->data) + strlen(tmp->data) + 1);
strcat(cutbottom->data, tmp->data);
tmp = tmp->next;
}
/* Put tmp on the line after the bottom of the cutbuffer. */
cutbottom->next = tmp; cutbottom->next = tmp;
tmp->prev = cutbottom;
cutbottom = tmp; if (!concatenate_cut) {
/* Tf we're not concatenating, attach tmp to the bottom of
* the cutbuffer, and then move the bottom of the cutbuffer
* one line down to where tmp is. */
tmp->prev = cutbottom;
cutbottom = tmp;
}
} }
/* And make the top remainder line manually too. Update current_x /* And make the top remainder line manually too. Update current_x