Commit e99223dd authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

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
No related merge requests found
Showing with 7 additions and 6 deletions
+7 -6
...@@ -49,7 +49,8 @@ CVS code - ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment