Commit 83ff644b authored by David Lawrence Ramsey's avatar David Lawrence Ramsey Committed by Benno Schulenberg
Browse files

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.
parent 3e22240f
Showing with 6 additions and 6 deletions
+6 -6
...@@ -1811,7 +1811,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls) ...@@ -1811,7 +1811,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
{ {
size_t current_len, i = 0; size_t current_len, i = 0;
#ifndef NANO_TINY #ifndef NANO_TINY
size_t orig_lenpt = 0; size_t orig_rows = 0;
#endif #endif
char *char_buf = charalloc(mb_cur_max()); char *char_buf = charalloc(mb_cur_max());
int char_len; int char_len;
...@@ -1820,7 +1820,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls) ...@@ -1820,7 +1820,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#ifndef NANO_TINY #ifndef NANO_TINY
if (ISSET(SOFTWRAP)) if (ISSET(SOFTWRAP))
orig_lenpt = strlenpt(openfile->current->data); orig_rows = strlenpt(openfile->current->data) / editwincols;
#endif #endif
while (i < output_len) { while (i < output_len) {
...@@ -1886,7 +1886,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls) ...@@ -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 /* If the number of screen rows that a softwrapped line occupies
* has changed, we need a full refresh. */ * has changed, we need a full refresh. */
if (ISSET(SOFTWRAP) && refresh_needed == FALSE) 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; refresh_needed = TRUE;
#endif #endif
......
...@@ -92,7 +92,7 @@ char *invocation_error(const char *name) ...@@ -92,7 +92,7 @@ char *invocation_error(const char *name)
void do_deletion(undo_type action) void do_deletion(undo_type action)
{ {
#ifndef NANO_TINY #ifndef NANO_TINY
size_t orig_lenpt = 0; size_t orig_rows = 0;
#endif #endif
assert(openfile->current != NULL && openfile->current->data != NULL && assert(openfile->current != NULL && openfile->current->data != NULL &&
...@@ -113,7 +113,7 @@ void do_deletion(undo_type action) ...@@ -113,7 +113,7 @@ void do_deletion(undo_type action)
update_undo(action); update_undo(action);
if (ISSET(SOFTWRAP)) if (ISSET(SOFTWRAP))
orig_lenpt = strlenpt(openfile->current->data); orig_rows = strlenpt(openfile->current->data) / editwincols;
#endif #endif
/* Move the remainder of the line "in", over the current character. */ /* Move the remainder of the line "in", over the current character. */
...@@ -184,7 +184,7 @@ void do_deletion(undo_type action) ...@@ -184,7 +184,7 @@ void do_deletion(undo_type action)
/* If the number of screen rows that a softwrapped line occupies /* If the number of screen rows that a softwrapped line occupies
* has changed, we need a full refresh. */ * has changed, we need a full refresh. */
if (ISSET(SOFTWRAP) && refresh_needed == FALSE) 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; refresh_needed = TRUE;
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment