commit 786d2221e16186d5ef74e7c07d8823aa0dc68fac
parent 9a9f36fca7a728dd2c5b66a0f29b203b638c0e25
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 7 Jun 2020 11:00:49 +0200
indicator: recompute the extra rows also for cut/paste/split/join
This fixes https://savannah.gnu.org/bugs/?58511.
Bug existed since commit 9a9f36fc from yesterday.
Diffstat:
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/cut.c b/src/cut.c
@@ -94,6 +94,10 @@ void do_deletion(undo_type action)
unlink_node(joining);
+#ifndef NANO_TINY
+ if (ISSET(SOFTWRAP))
+ openfile->current->extrarows = extra_chunks_in(openfile->current);
+#endif
/* Two lines were joined, so do a renumbering and refresh the screen. */
renumber_from(openfile->current);
refresh_needed = TRUE;
@@ -322,6 +326,9 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_
#ifndef NANO_TINY
openfile->current->has_anchor = was_anchored;
+ if (ISSET(SOFTWRAP))
+ openfile->current->extrarows = extra_chunks_in(openfile->current);
+
if (post_marked || same_line)
openfile->mark = openfile->current;
if (post_marked)
@@ -406,6 +413,11 @@ void ingraft_buffer(linestruct *topline)
openfile->mark_x += length - xpos;
} else if (mark_follows)
openfile->mark_x += extralen;
+
+ if (ISSET(SOFTWRAP)) {
+ line->extrarows = extra_chunks_in(line);
+ openfile->current->extrarows = extra_chunks_in(openfile->current);
+ }
#endif
delete_node(topline);
diff --git a/src/text.c b/src/text.c
@@ -572,6 +572,8 @@ void do_undo(void)
break;
}
line->data[u->tail_x] = '\0';
+ if (ISSET(SOFTWRAP))
+ line->extrarows = extra_chunks_in(line);
intruder = make_new_node(line);
intruder->data = copy_of(u->strdata);
splice_node(line, intruder);
@@ -720,6 +722,8 @@ void do_redo(void)
case ENTER:
redidmsg = _("line break");
line->data[u->head_x] = '\0';
+ if (ISSET(SOFTWRAP))
+ line->extrarows = extra_chunks_in(line);
intruder = make_new_node(line);
intruder->data = copy_of(u->strdata);
splice_node(line, intruder);
@@ -898,6 +902,11 @@ void do_enter(void)
openfile->mark = newnode;
openfile->mark_x += extra - openfile->current_x;
}
+
+ if (ISSET(SOFTWRAP)) {
+ openfile->current->extrarows = extra_chunks_in(openfile->current);
+ newnode->extrarows = extra_chunks_in(newnode);
+ }
#endif
/* Insert the newly created line after the current one and renumber. */