nano

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

commit 0378146addf12a9344687bb101c863814e87bc97
parent 6e9d6a08b9537c17b261f8e57a6c04bd40257c4c
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Fri, 24 Feb 2017 15:03:02 +0100

tweaks: rename a variable, drop a false assert, and reshuffle a bit

Diffstat:
Msrc/winio.c | 17+++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -3100,16 +3100,17 @@ void disable_nodelay(void) * expect word to have tabs and control characters expanded. */ void spotlight(bool active, const char *word) { - size_t word_len = strlenpt(word), room = word_len; + size_t word_span = strlenpt(word); + size_t room = word_span; /* Compute the number of columns that are available for the word. */ - if (!ISSET(SOFTWRAP)) + if (!ISSET(SOFTWRAP)) { room = editwincols + get_page_start(xplustabs()) - xplustabs(); - assert(room > 0); - - if (word_len > room) - room--; + /* If the word is partially offscreen, reserve space for the "$". */ + if (word_span > room) + room--; + } reset_cursor(); @@ -3117,12 +3118,12 @@ void spotlight(bool active, const char *word) wattron(edit, hilite_attribute); /* This is so we can show zero-length matches. */ - if (word_len == 0) + if (word_span == 0) waddch(edit, ' '); else waddnstr(edit, word, actual_x(word, room)); - if (word_len > room) + if (word_span > room) waddch(edit, '$'); if (active)