Fix cutting selection containing a folded segment not unfolding before adding to cutbuffer
This commit is contained in:
parent
b81dca5014
commit
140f2d72cb
15
src/cut.c
15
src/cut.c
@ -261,11 +261,20 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_
|
||||
if (top == bot && top_x == bot_x)
|
||||
return;
|
||||
|
||||
UNFOLD_SEGMENT(top);
|
||||
/* In case bot is the start of a folded segment.
|
||||
* Folds within [top, bot] are taken care of in the following loop */
|
||||
UNFOLD_SEGMENT(bot);
|
||||
|
||||
if (top != bot)
|
||||
for (linestruct *line = top->next; line != bot->next; line = line->next)
|
||||
#ifdef ENABLE_FOLDING
|
||||
top->folded = FALSE;
|
||||
#endif
|
||||
for (linestruct *line = top->next; line != bot->next; line = line->next){
|
||||
had_anchor |= line->has_anchor;
|
||||
#ifdef ENABLE_FOLDING
|
||||
line->folded = FALSE;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
if (top == bot) {
|
||||
@ -274,7 +283,6 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_
|
||||
memmove(top->data + top_x, top->data + bot_x, strlen(top->data + bot_x) + 1);
|
||||
last = taken;
|
||||
} else if (top_x == 0 && bot_x == 0) {
|
||||
UNFOLD_SEGMENT(bot);
|
||||
taken = top;
|
||||
last = make_new_node(NULL);
|
||||
last->data = copy_of("");
|
||||
@ -293,7 +301,6 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_
|
||||
|
||||
openfile->current = bot;
|
||||
} else {
|
||||
UNFOLD_SEGMENT(bot);
|
||||
taken = make_new_node(NULL);
|
||||
taken->data = copy_of(top->data + top_x);
|
||||
taken->next = top->next;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user