nano

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

commit 896cfcef955bcdc0ff3b136397b21566a3906e05
parent d54180ad8bea9753b9cc388dee1bdaa6fefad09e
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 28 Apr 2019 15:53:33 +0200

tweaks: when OR'ing, put the most likely condition first

Also, slightly reword a comment, adjust some whitespace, and use
a more direct comparison for equality.

Diffstat:
Msrc/utils.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/utils.c b/src/utils.c @@ -450,15 +450,15 @@ void remove_magicline(void) #endif #ifndef NANO_TINY -/* Set (top, top_x) and (bot, bot_x) to the start and end "coordinates" of - * the marked region. If right_side_up isn't NULL, set it to TRUE when the - * mark is at the top of the marked region, and to FALSE otherwise. */ +/* Return in (top, top_x) and (bot, bot_x) the start and end "coordinates" + * of the marked region. If right_side_up isn't NULL, set it to TRUE when + * the mark is at the top of the marked region, and to FALSE otherwise. */ void get_region(const linestruct **top, size_t *top_x, - const linestruct **bot, size_t *bot_x, bool *right_side_up) + const linestruct **bot, size_t *bot_x, bool *right_side_up) { - if ((openfile->current->lineno == openfile->mark->lineno && - openfile->current_x > openfile->mark_x) || - openfile->current->lineno > openfile->mark->lineno) { + if (openfile->mark->lineno < openfile->current->lineno || + (openfile->mark == openfile->current && + openfile->mark_x < openfile->current_x)) { *top = openfile->mark; *top_x = openfile->mark_x; *bot = openfile->current;