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.
master
Benno Schulenberg 2016-04-10 17:42:01 +02:00
parent fc7eb69b70
commit dbe39901b2
1 changed files with 4 additions and 6 deletions

View File

@ -451,14 +451,12 @@ size_t get_page_start(size_t column)
}
/* Return the placewewant associated with current_x, i.e. the zero-based
* column position of the cursor. The value will be no smaller than
* current_x. */
* column position of the cursor. */
size_t xplustabs(void)
{
if (openfile->current)
return strnlenpt(openfile->current->data, openfile->current_x);
else
return 0;
assert(openfile->current != NULL);
return strnlenpt(openfile->current->data, openfile->current_x);
}
/* Return the index in s of the character displayed at the given column,