src/history.cc

changeset 563
10939452bf86
parent 562
c4ff45e98551
child 594
d9feccafcbf7
equal deleted inserted replaced
562:c4ff45e98551 563:10939452bf86
34 // ----------------------------------------------------------------------------- 34 // -----------------------------------------------------------------------------
35 void History::undo() 35 void History::undo()
36 { if (m_changesets.isEmpty() || getPosition() == -1) 36 { if (m_changesets.isEmpty() || getPosition() == -1)
37 return; 37 return;
38 38
39 // Don't take the changes done here as actual edits to the document
40 setIgnoring (true);
41
39 const Changeset& set = getChangeset (getPosition()); 42 const Changeset& set = getChangeset (getPosition());
40 g_fullRefresh = false; 43 g_fullRefresh = false;
41 44
42 // Iterate the list in reverse and undo all actions 45 // Iterate the list in reverse and undo all actions
43 for (int i = set.size() - 1; i >= 0; --i) 46 for (int i = set.size() - 1; i >= 0; --i)
52 else 55 else
53 g_win->doFullRefresh(); 56 g_win->doFullRefresh();
54 57
55 g_win->updateActions(); 58 g_win->updateActions();
56 dlog ("Position is now %1", getPosition()); 59 dlog ("Position is now %1", getPosition());
60 setIgnoring (false);
57 } 61 }
58 62
59 // ============================================================================= 63 // =============================================================================
60 // ----------------------------------------------------------------------------- 64 // -----------------------------------------------------------------------------
61 void History::redo() 65 void History::redo()
62 { if (getPosition() == m_changesets.size()) 66 { if (getPosition() == m_changesets.size())
63 return; 67 return;
64 68
69 setIgnoring (true);
65 const Changeset& set = getChangeset (getPosition() + 1); 70 const Changeset& set = getChangeset (getPosition() + 1);
66 g_fullRefresh = false; 71 g_fullRefresh = false;
67 72
68 // Redo things - in the order as they were done in the first place 73 // Redo things - in the order as they were done in the first place
69 for (const AbstractHistoryEntry* change : set) 74 for (const AbstractHistoryEntry* change : set)
76 else 81 else
77 g_win->doFullRefresh(); 82 g_win->doFullRefresh();
78 83
79 g_win->updateActions(); 84 g_win->updateActions();
80 dlog ("Position is now %1", getPosition()); 85 dlog ("Position is now %1", getPosition());
86 setIgnoring (false);
81 } 87 }
82 88
83 // ============================================================================= 89 // =============================================================================
84 // ----------------------------------------------------------------------------- 90 // -----------------------------------------------------------------------------
85 void History::clear() 91 void History::clear()

mercurial