commit 2669d3623d4b201e163d0f48a41f1bdafba13452
parent 22fc16b2d021afb51ae9815dd44a3456929c4a83
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 21 May 2019 12:15:37 +0200
tweaks: set a boolean directly, instead of using a function call
Diffstat:
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -2591,19 +2591,16 @@ const char *do_alt_speller(char *tempfile_name)
#ifndef NANO_TINY
/* Replace the marked text (or entire text) with the corrected text. */
if (openfile->mark) {
- linestruct *top, *bot;
- size_t top_x, bot_x;
- bool right_side_up;
+ bool upright = (openfile->mark->lineno < openfile->current->lineno ||
+ (openfile->mark == openfile->current &&
+ openfile->mark_x < openfile->current_x));
ssize_t was_mark_lineno = openfile->mark->lineno;
- get_region((const linestruct **)&top, &top_x,
- (const linestruct **)&bot, &bot_x, &right_side_up);
-
replace_marked_buffer(tempfile_name);
/* Adjust the end point of the marked region for any change in
* length of the region's last line. */
- if (right_side_up)
+ if (upright)
current_x_save = openfile->current_x;
else
openfile->mark_x = openfile->current_x;