1
1

tweak do_wrap(), remove_magicline(), edit_scroll(), and edit_update() to

rely on fileage and filebot instead of NULL for their checks to detect
the top or bottom of the file


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3143 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
David Lawrence Ramsey 2005-11-10 04:27:30 +00:00
родитель 6195f7c34c
Коммит e99223dd25
4 изменённых файлов: 7 добавлений и 6 удалений

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

@ -49,7 +49,8 @@ CVS code -
do_page_down(), do_para_end(), do_next_word(), do_prev_word(), do_page_down(), do_para_end(), do_next_word(), do_prev_word(),
do_up(), do_down(), do_scroll_down(), do_right(), do_mouse(), do_up(), do_down(), do_scroll_down(), do_right(), do_mouse(),
do_gotolinecolumn(), do_delete(), begpar(), find_paragraph(), do_gotolinecolumn(), do_delete(), begpar(), find_paragraph(),
and do_justify(). (DLR) do_justify(), do_wrap(), remove_magicline(), edit_scroll(),
and edit_update(). (DLR)
- Add new -L/--nonewlines command line option, and new - Add new -L/--nonewlines command line option, and new
"nonewlines" rcfile option, to control whether nano adds "nonewlines" rcfile option, to control whether nano adds
magiclines to the ends of files. Changes to read_file(), magiclines to the ends of files. Changes to read_file(),

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

@ -432,7 +432,7 @@ bool do_wrap(filestruct *line)
/* We prepend the wrapped text to the next line, if the /* We prepend the wrapped text to the next line, if the
* same_line_wrap flag is set, there is a next line, and prepending * same_line_wrap flag is set, there is a next line, and prepending
* would not make the line too long. */ * would not make the line too long. */
if (same_line_wrap && line->next != NULL) { if (same_line_wrap && line != openfile->filebot) {
const char *end = after_break + move_mbleft(after_break, const char *end = after_break + move_mbleft(after_break,
after_break_len); after_break_len);

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

@ -494,7 +494,7 @@ void new_magicline(void)
void remove_magicline(void) void remove_magicline(void)
{ {
if (openfile->filebot->data[0] == '\0' && if (openfile->filebot->data[0] == '\0' &&
openfile->filebot->prev != NULL) { openfile->filebot != openfile->fileage) {
openfile->filebot = openfile->filebot->prev; openfile->filebot = openfile->filebot->prev;
free_filestruct(openfile->filebot->next); free_filestruct(openfile->filebot->next);
openfile->filebot->next = NULL; openfile->filebot->next = NULL;

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

@ -2634,11 +2634,11 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
* there are fewer than nlines lines available. */ * there are fewer than nlines lines available. */
for (i = nlines; i > 0; i--) { for (i = nlines; i > 0; i--) {
if (direction == UP) { if (direction == UP) {
if (openfile->edittop->prev == NULL) if (openfile->edittop == openfile->fileage)
break; break;
openfile->edittop = openfile->edittop->prev; openfile->edittop = openfile->edittop->prev;
} else { } else {
if (openfile->edittop->next == NULL) if (openfile->edittop == openfile->filebot)
break; break;
openfile->edittop = openfile->edittop->next; openfile->edittop = openfile->edittop->next;
} }
@ -2842,7 +2842,7 @@ void edit_update(update_type location)
goal = editwinrows - 1; goal = editwinrows - 1;
} }
for (; goal > 0 && foo->prev != NULL; goal--) for (; goal > 0 && foo != openfile->edittop; goal--)
foo = foo->prev; foo = foo->prev;
openfile->edittop = foo; openfile->edittop = foo;