tweaks: remove the group handling for undoing/redoing (un)indents
Indenting/unindenting always happens in a single contiguous block. Lines that cannot or should not be indented or unindented do not need to remembered separately as it follows from their content.master
parent
d0d293b8af
commit
8965103a4d
10
src/text.c
10
src/text.c
|
@ -435,14 +435,15 @@ void do_unindent(void)
|
|||
void handle_indent_action(undo *u, bool undoing, bool add_indent)
|
||||
{
|
||||
undo_group *group = u->grouping;
|
||||
filestruct *line = fsfromline(group->top_line);
|
||||
|
||||
if (group->next != NULL)
|
||||
statusline(ALERT, "Multiple groups -- please report a bug");
|
||||
|
||||
/* When redoing, reposition the cursor and let the indenter adjust it. */
|
||||
if (!undoing)
|
||||
goto_line_posx(u->lineno, u->begin);
|
||||
|
||||
while (group) {
|
||||
filestruct *line = fsfromline(group->top_line);
|
||||
|
||||
/* For each line in the group, add or remove the individual indent. */
|
||||
while (line && line->lineno <= group->bottom_line) {
|
||||
char *blanks = group->indentations[line->lineno - group->top_line];
|
||||
|
@ -455,9 +456,6 @@ void handle_indent_action(undo *u, bool undoing, bool add_indent)
|
|||
line = line->next;
|
||||
}
|
||||
|
||||
group = group->next;
|
||||
}
|
||||
|
||||
/* When undoing, reposition the cursor to the recorded location. */
|
||||
if (undoing)
|
||||
goto_line_posx(u->lineno, u->begin);
|
||||
|
|
Loading…
Reference in New Issue