* exit.c (edit_delete_line): Don't remove and restore the

preceding newline.  Don't treat binary zero as newline.
From Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
This commit is contained in:
Pavel Roskin 2002-11-14 05:17:56 +00:00
parent 895c9468c3
commit c6e56452ea
2 changed files with 31 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2002-11-14 Pavel Roskin <proski@gnu.org>
* exit.c (edit_delete_line): Don't remove and restore the
preceding newline. Don't treat binary zero as newline.
From Dmitry Semyonov <Dmitry.Semyonov@oktet.ru>
2002-11-12 Pavel Roskin <proski@gnu.org> 2002-11-12 Pavel Roskin <proski@gnu.org>
* *.c: Fix all global functions without declarations - declare, * *.c: Fix all global functions without declarations - declare,

View File

@ -1765,17 +1765,32 @@ static void edit_delete_to_line_begin (WEdit * edit)
} }
} }
void edit_delete_line (WEdit * edit) void
edit_delete_line (WEdit *edit)
{ {
int c; /*
do { * Delete right part of the line.
c = edit_delete (edit); * Note that edit_get_byte() returns '\n' when byte position is
} while (c != '\n' && c); * beyond EOF.
do { */
c = edit_backspace (edit); while (edit_get_byte (edit, edit->curs1) != '\n') {
} while (c != '\n' && c); (void) edit_delete (edit);
if (c) }
edit_insert (edit, '\n');
/*
* Delete '\n' char.
* Note that edit_delete() will not corrupt anything if called while
* cursor position is EOF.
*/
(void) edit_delete (edit);
/*
* Delete left part of the line.
* Note, that edit_get_byte() returns '\n' when byte position is < 0.
*/
while (edit_get_byte (edit, edit->curs1 - 1) != '\n') {
(void) edit_backspace (edit);
};
} }
static void insert_spaces_tab (WEdit * edit, int half) static void insert_spaces_tab (WEdit * edit, int half)