Commit 5834638d authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

It shouldn't be necessary to doubly check for being at the end of file.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5492 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent a64bfbee
Showing with 8 additions and 4 deletions
+8 -4
2015-12-08 Benno Schulenberg <bensberg@justemail.net> 2015-12-08 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (splice_node, unlink_node): Let these functions update * src/nano.c (splice_node, unlink_node): Let these functions update
'filebot', instead of doing it in four different places each. 'filebot', instead of doing it in four different places each.
* src/search.c (goto_line_posx), src/move (do_down): It should not
be necessary to doubly check for being at the end of file.
2015-12-07 Benno Schulenberg <bensberg@justemail.net> 2015-12-07 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (edit_draw): Quit the loop when there is no end match. * src/winio.c (edit_draw): Quit the loop when there is no end match.
......
...@@ -460,10 +460,12 @@ void do_down( ...@@ -460,10 +460,12 @@ void do_down(
#endif #endif
/* If we're at the bottom of the file, get out. */ /* If we're at the bottom of the file, get out. */
if (openfile->current == openfile->filebot || !openfile->current->next) if (openfile->current == openfile->filebot)
return; return;
assert(ISSET(SOFTWRAP) || openfile->current_y == openfile->current->lineno - openfile->edittop->lineno); assert(ISSET(SOFTWRAP) || openfile->current_y ==
openfile->current->lineno - openfile->edittop->lineno);
assert(openfile->current->next != NULL);
/* Move the current line of the edit window down. */ /* Move the current line of the edit window down. */
openfile->current = openfile->current->next; openfile->current = openfile->current->next;
......
...@@ -936,8 +936,8 @@ void do_replace(void) ...@@ -936,8 +936,8 @@ void do_replace(void)
/* Go to the specified line and x position. */ /* Go to the specified line and x position. */
void goto_line_posx(ssize_t line, size_t pos_x) void goto_line_posx(ssize_t line, size_t pos_x)
{ {
for (openfile->current = openfile->fileage; openfile->current != openfile->filebot && for (openfile->current = openfile->fileage; line > 1 &&
openfile->current->next != NULL && line > 1; line--) openfile->current != openfile->filebot; line--)
openfile->current = openfile->current->next; openfile->current = openfile->current->next;
openfile->current_x = pos_x; openfile->current_x = pos_x;
......
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