Merge branch '5777_texthistory_restore_modified_flag_on_redo' into 'main'
gtktexthistory: restore 'modified' flag on redo Closes #5777 See merge request GNOME/gtk!6302
This commit is contained in:
@@ -1100,6 +1100,18 @@ gtk_text_history_modified_changed (GtkTextHistory *self,
|
||||
peek->is_modified_set = TRUE;
|
||||
}
|
||||
|
||||
if ((peek = g_queue_peek_head (&self->redo_queue)))
|
||||
{
|
||||
if (peek->kind == ACTION_KIND_BARRIER)
|
||||
{
|
||||
if (!(peek = peek->link.next->data))
|
||||
return;
|
||||
}
|
||||
|
||||
peek->is_modified = TRUE;
|
||||
peek->is_modified_set = TRUE;
|
||||
}
|
||||
|
||||
self->is_modified = !!modified;
|
||||
self->is_modified_set = TRUE;
|
||||
|
||||
|
||||
@@ -635,6 +635,35 @@ test_issue_4575 (void)
|
||||
run_test (commands, G_N_ELEMENTS (commands), 0);
|
||||
}
|
||||
|
||||
static void
|
||||
test_issue_5777 (void)
|
||||
{
|
||||
static const Command commands[] = {
|
||||
{ MODIFIED, -1, -1, NULL, NULL, UNSET, UNSET, SET },
|
||||
{ INSERT_SEQ, 0, -1, "this is a test\nmore", "this is a test\nmore", SET, UNSET, SET },
|
||||
{ UNDO, -1, -1, NULL, "this is a test\n", SET, SET, SET },
|
||||
{ UNMODIFIED, -1, -1, NULL, NULL, SET, SET, UNSET },
|
||||
{ REDO, -1, -1, NULL, "this is a test\nmore", SET, UNSET, SET },
|
||||
{ UNDO, -1, -1, NULL, "this is a test\n", SET, SET, UNSET },
|
||||
{ REDO, -1, -1, NULL, "this is a test\nmore", SET, UNSET, SET },
|
||||
{ UNDO, -1, -1, NULL, "this is a test\n", SET, SET, UNSET },
|
||||
{ MODIFIED, -1, -1, NULL, NULL, SET, SET, SET },
|
||||
{ REDO, -1, -1, NULL, "this is a test\nmore", SET, UNSET, SET },
|
||||
{ UNMODIFIED, -1, -1, NULL, NULL, SET, UNSET, UNSET },
|
||||
{ UNDO, -1, -1, NULL, "this is a test\n", SET, SET, SET },
|
||||
{ REDO, -1, -1, NULL, "this is a test\nmore", SET, UNSET, UNSET },
|
||||
{ UNDO, -1, -1, NULL, "this is a test\n", SET, SET, SET },
|
||||
{ UNDO, -1, -1, NULL, "this is a test", SET, SET, SET },
|
||||
{ UNMODIFIED, -1, -1, NULL, NULL, SET, SET, UNSET },
|
||||
{ UNDO, -1, -1, NULL, "this is a", SET, SET, SET },
|
||||
{ REDO, -1, -1, NULL, "this is a test", SET, SET, UNSET },
|
||||
{ REDO, -1, -1, NULL, "this is a test\n", SET, SET, SET },
|
||||
{ REDO, -1, -1, NULL, "this is a test\nmore", SET, UNSET, SET },
|
||||
};
|
||||
|
||||
run_test (commands, G_N_ELEMENTS (commands), 4);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
@@ -657,6 +686,7 @@ main (int argc,
|
||||
g_test_add_func ("/Gtk/TextHistory/test14", test14);
|
||||
g_test_add_func ("/Gtk/TextHistory/issue_4276", test_issue_4276);
|
||||
g_test_add_func ("/Gtk/TextHistory/issue_4575", test_issue_4575);
|
||||
g_test_add_func ("/Gtk/TextHistory/issue_5777", test_issue_5777);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user