Fix part of bug #7072 by opening undo groups as needed.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36597 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2010-11-29 16:38:13 +00:00
parent 87a0c25bc4
commit 940ab1261b

View File

@ -683,6 +683,7 @@ void GuiCompleter::tab()
} }
// Make undo possible // Make undo possible
cur.beginUndoGroup();
cur.recordUndo(); cur.recordUndo();
// If completion is active, at least complete by one character // If completion is active, at least complete by one character
@ -696,11 +697,14 @@ void GuiCompleter::tab()
hidePopup(cur); hidePopup(cur);
hideInline(cur); hideInline(cur);
updateVisibility(false, false); updateVisibility(false, false);
cur.endUndoGroup();
return; return;
} }
docstring nextchar = completion.substr(prefix.size(), 1); docstring nextchar = completion.substr(prefix.size(), 1);
if (!cur.inset().insertCompletion(cur, nextchar, false)) if (!cur.inset().insertCompletion(cur, nextchar, false)) {
cur.endUndoGroup();
return; return;
}
updatePrefix(cur); updatePrefix(cur);
// try to complete as far as it is unique // try to complete as far as it is unique
@ -720,6 +724,7 @@ void GuiCompleter::tab()
// redraw if needed // redraw if needed
if (cur.result().screenUpdate()) if (cur.result().screenUpdate())
gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); gui_->bufferView().processUpdateFlags(cur.result().screenUpdate());
cur.endUndoGroup();
} }
@ -876,6 +881,7 @@ void GuiCompleter::popupActivated(const QString & completion)
Cursor cur = gui_->bufferView().cursor(); Cursor cur = gui_->bufferView().cursor();
cur.screenUpdateFlags(Update::None); cur.screenUpdateFlags(Update::None);
cur.beginUndoGroup();
cur.recordUndo(); cur.recordUndo();
docstring prefix = cur.inset().completionPrefix(cur); docstring prefix = cur.inset().completionPrefix(cur);
@ -886,6 +892,7 @@ void GuiCompleter::popupActivated(const QString & completion)
if (cur.result().screenUpdate()) if (cur.result().screenUpdate())
gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); gui_->bufferView().processUpdateFlags(cur.result().screenUpdate());
cur.endUndoGroup();
} }