diff --git a/src/cut.c b/src/cut.c index 806b0d34..9510f50d 100644 --- a/src/cut.c +++ b/src/cut.c @@ -87,6 +87,8 @@ void do_deletion(undo_type action) openfile->mark = openfile->current; openfile->mark_x += openfile->current_x; } + + openfile->current->bookmarked |= joining->bookmarked; #endif unlink_node(joining); renumber_from(openfile->current); @@ -246,9 +248,14 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_ bool same_line = (openfile->mark == top); bool post_marked = (openfile->mark && (openfile->mark->lineno > top->lineno || (same_line && openfile->mark_x > top_x))); + bool was_bookmarked = top->bookmarked; if (top == bot && top_x == bot_x) return; + + if (top != bot) + for (linestruct *line = top->next; line != bot->next; line = line->next) + was_bookmarked |= line->bookmarked; #endif if (top == bot) { @@ -318,6 +325,8 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_ openfile->current_x = top_x; #ifndef NANO_TINY + openfile->current->bookmarked = was_bookmarked; + if (post_marked || same_line) openfile->mark = openfile->current; if (post_marked) diff --git a/src/nano.c b/src/nano.c index 12698b40..34358515 100644 --- a/src/nano.c +++ b/src/nano.c @@ -151,7 +151,7 @@ linestruct *copy_node(const linestruct *src) #endif dst->lineno = src->lineno; #ifndef NANO_TINY - dst->bookmarked = src->bookmarked; + dst->bookmarked = FALSE; #endif return dst; diff --git a/src/text.c b/src/text.c index 7b7f51e4..b1d2208f 100644 --- a/src/text.c +++ b/src/text.c @@ -535,6 +535,7 @@ void do_undo(void) line->data = charealloc(line->data, strlen(line->data) + strlen(&u->strdata[regain_from_x]) + 1); strcat(line->data, &u->strdata[regain_from_x]); + line->bookmarked |= line->next->bookmarked; unlink_node(line->next); renumber_from(line); goto_line_posx(u->head_lineno, original_x);