Commit dbe39901 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

utils: snip a superfluous check for NULL

Nano doesn't start doing anything with the edit window or the keyboard
until all files have been read in or a blank buffer has been opened, so
the case of openfile->current == NULL will never occur.

Also correct the comment -- because with multibyte characters, it is
very well possible that the screen column corresponding to current_x
is smaller than current_x itself.
Showing with 4 additions and 6 deletions
+4 -6
...@@ -451,14 +451,12 @@ size_t get_page_start(size_t column) ...@@ -451,14 +451,12 @@ size_t get_page_start(size_t column)
} }
/* Return the placewewant associated with current_x, i.e. the zero-based /* Return the placewewant associated with current_x, i.e. the zero-based
* column position of the cursor. The value will be no smaller than * column position of the cursor. */
* current_x. */
size_t xplustabs(void) size_t xplustabs(void)
{ {
if (openfile->current) assert(openfile->current != NULL);
return strnlenpt(openfile->current->data, openfile->current_x); return strnlenpt(openfile->current->data, openfile->current_x);
else
return 0;
} }
/* Return the index in s of the character displayed at the given column, /* Return the index in s of the character displayed at the given column,
......
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