mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 04:41:21 +03:00
Making splice_node() update 'filebot', instead of doing it in
four different places. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5490 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
cac3c3399f
commit
77c0357868
@ -1,3 +1,7 @@
|
||||
2015-12-08 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/nano.c (splice_node): Make this function update 'filebot',
|
||||
instead of doing it in four different places.
|
||||
|
||||
2015-12-07 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/winio.c (edit_draw): Quit the loop when there is no end match.
|
||||
* src/files.c (do_writeout): When --tempfile is given, make ^O not
|
||||
|
@ -104,6 +104,10 @@ void splice_node(filestruct *afterthis, filestruct *newnode)
|
||||
if (afterthis->next != NULL)
|
||||
afterthis->next->prev = newnode;
|
||||
afterthis->next = newnode;
|
||||
|
||||
/* Update filebot when inserting a node at the end of file. */
|
||||
if (openfile && openfile->filebot == afterthis)
|
||||
openfile->filebot = newnode;
|
||||
}
|
||||
|
||||
/* Unlink a node from the rest of the filestruct and delete it. */
|
||||
|
16
src/text.c
16
src/text.c
@ -544,8 +544,6 @@ void do_undo(void)
|
||||
free(f->data);
|
||||
f->data = data;
|
||||
splice_node(f, t);
|
||||
if (f == openfile->filebot)
|
||||
openfile->filebot = t;
|
||||
goto_line_posx(u->lineno, u->begin);
|
||||
break;
|
||||
case CUT_EOF:
|
||||
@ -678,8 +676,6 @@ void do_redo(void)
|
||||
free(f->data);
|
||||
f->data = data;
|
||||
splice_node(f, shoveline);
|
||||
if (f == openfile->filebot)
|
||||
openfile->filebot = shoveline;
|
||||
renumber(shoveline);
|
||||
goto_line_posx(u->lineno + 1, u->mark_begin_x);
|
||||
break;
|
||||
@ -798,9 +794,6 @@ void do_enter()
|
||||
openfile->current_x = extra;
|
||||
|
||||
splice_node(openfile->current, newnode);
|
||||
|
||||
if (openfile->current == openfile->filebot)
|
||||
openfile->filebot = newnode;
|
||||
openfile->current = newnode;
|
||||
renumber(newnode);
|
||||
|
||||
@ -2162,9 +2155,7 @@ void do_justify(bool full_justify)
|
||||
|
||||
assert(break_pos <= line_len);
|
||||
|
||||
/* Make a new line, and copy the text after where we're
|
||||
* going to break this line to the beginning of the new
|
||||
* line. */
|
||||
/* Insert a new line after the current one. */
|
||||
splice_node(openfile->current, make_new_node(openfile->current));
|
||||
|
||||
/* If this paragraph is non-quoted, and autoindent isn't
|
||||
@ -2203,11 +2194,6 @@ void do_justify(bool full_justify)
|
||||
/* Break the current line. */
|
||||
null_at(&openfile->current->data, break_pos);
|
||||
|
||||
/* If the current line is the last line of the file, move
|
||||
* the last line of the file down to the next line. */
|
||||
if (openfile->filebot == openfile->current)
|
||||
openfile->filebot = openfile->filebot->next;
|
||||
|
||||
/* Go to the next line. */
|
||||
par_len--;
|
||||
openfile->current_y++;
|
||||
|
Loading…
Reference in New Issue
Block a user