commit 83ff644b6af1669b19e1eb2550d97e99a305d137
parent 3e22240fd5d17cadb22c0da4e75efb45c0ad9f41
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Thu, 19 Jan 2017 19:58:37 -0600
tweaks: do a comparison a bit differently in do_output() and do_deletion()
Make it clearer we're comparing the number of rows, not string lengths.
Diffstat:
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -1811,7 +1811,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
{
size_t current_len, i = 0;
#ifndef NANO_TINY
- size_t orig_lenpt = 0;
+ size_t orig_rows = 0;
#endif
char *char_buf = charalloc(mb_cur_max());
int char_len;
@@ -1820,7 +1820,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#ifndef NANO_TINY
if (ISSET(SOFTWRAP))
- orig_lenpt = strlenpt(openfile->current->data);
+ orig_rows = strlenpt(openfile->current->data) / editwincols;
#endif
while (i < output_len) {
@@ -1886,7 +1886,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
/* If the number of screen rows that a softwrapped line occupies
* has changed, we need a full refresh. */
if (ISSET(SOFTWRAP) && refresh_needed == FALSE)
- if (strlenpt(openfile->current->data) / editwincols != orig_lenpt / editwincols)
+ if ((strlenpt(openfile->current->data) / editwincols) != orig_rows)
refresh_needed = TRUE;
#endif
diff --git a/src/text.c b/src/text.c
@@ -92,7 +92,7 @@ char *invocation_error(const char *name)
void do_deletion(undo_type action)
{
#ifndef NANO_TINY
- size_t orig_lenpt = 0;
+ size_t orig_rows = 0;
#endif
assert(openfile->current != NULL && openfile->current->data != NULL &&
@@ -113,7 +113,7 @@ void do_deletion(undo_type action)
update_undo(action);
if (ISSET(SOFTWRAP))
- orig_lenpt = strlenpt(openfile->current->data);
+ orig_rows = strlenpt(openfile->current->data) / editwincols;
#endif
/* Move the remainder of the line "in", over the current character. */
@@ -184,7 +184,7 @@ void do_deletion(undo_type action)
/* If the number of screen rows that a softwrapped line occupies
* has changed, we need a full refresh. */
if (ISSET(SOFTWRAP) && refresh_needed == FALSE)
- if (strlenpt(openfile->current->data) / editwincols != orig_lenpt / editwincols)
+ if ((strlenpt(openfile->current->data) / editwincols) != orig_rows)
refresh_needed = TRUE;
#endif