nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit dbe39901b2ad297732bb474177ce37ce4b9b72e7
parent fc7eb69b70a5704c861f09a7e8d25a01079e92c7
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Sun, 10 Apr 2016 17:42:01 +0200

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.

Diffstat:
Msrc/utils.c | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/utils.c b/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,