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
parent
fc7eb69b70
commit
dbe39901b2
10
src/utils.c
10
src/utils.c
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue