X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt%2FGuiCompleter.cpp;h=661178575b1f860e2a71ce82bedd42dd5470456f;hb=8863d6d785358680d05b4b34b35ca09a15cccb82;hp=6fd39d30396a1de972aa23a2b062ac0c4561a840;hpb=efc0877f8fd33ad9369d06e5b638037c8d6a1b24;p=lyx.git diff --git a/src/frontends/qt/GuiCompleter.cpp b/src/frontends/qt/GuiCompleter.cpp index 6fd39d3039..661178575b 100644 --- a/src/frontends/qt/GuiCompleter.cpp +++ b/src/frontends/qt/GuiCompleter.cpp @@ -348,8 +348,7 @@ void GuiCompleter::updateVisibility(bool start, bool keep) updateVisibility(cur, start, keep); - if (cur.result().screenUpdate()) - gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); + gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); } @@ -456,8 +455,8 @@ void GuiCompleter::asyncUpdatePopup() // has a bad memory about it and we have to tell him again and again. QTreeView * listView = static_cast(popup()); listView->header()->setStretchLastSection(false); - setSectionResizeMode(listView->header(), 0, QHeaderView::Stretch); - setSectionResizeMode(listView->header(), 1, QHeaderView::Fixed); + listView->header()->setSectionResizeMode(0, QHeaderView::Stretch); + listView->header()->setSectionResizeMode(1, QHeaderView::Fixed); listView->header()->resizeSection(1, 22); // show/update popup @@ -597,8 +596,7 @@ void GuiCompleter::showPopup() showPopup(cur); // redraw if needed - if (cur.result().screenUpdate()) - gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); + gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); } @@ -610,8 +608,7 @@ void GuiCompleter::showInline() showInline(cur); // redraw if needed - if (cur.result().screenUpdate()) - gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); + gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); } @@ -643,8 +640,7 @@ void GuiCompleter::hideInline() hideInline(cur); // redraw if needed - if (cur.result().screenUpdate()) - gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); + gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); } @@ -659,8 +655,8 @@ void GuiCompleter::activate() void GuiCompleter::tab() { - BufferView * bv = &gui_->bufferView(); - Cursor cur = bv->cursor(); + BufferView & bv = gui_->bufferView(); + Cursor cur = bv.cursor(); cur.screenUpdateFlags(Update::None); // check that inline completion is active @@ -686,9 +682,8 @@ void GuiCompleter::tab() return; } - // Make undo possible + // Prepare for undo (recordUndo is invoked in the insets' insertCompletion methods) UndoGroupHelper ugh(cur.buffer()); - cur.recordUndo(); // If completion is active, at least complete by one character docstring prefix = cur.inset().completionPrefix(cur); @@ -701,6 +696,9 @@ void GuiCompleter::tab() hidePopup(); hideInline(cur); updateVisibility(false, false); + + // redraw if needed + bv.processUpdateFlags(cur.result().screenUpdate()); return; } docstring nextchar = completion.substr(prefix.size(), 1); @@ -712,8 +710,8 @@ void GuiCompleter::tab() docstring longestCompletion = longestUniqueCompletion(); prefix = cur.inset().completionPrefix(cur); docstring postfix = longestCompletion.substr(min(longestCompletion.size(), prefix.size())); - cur.inset().insertCompletion(cur, postfix, false); - old_cursor_ = bv->cursor(); + cur.inset().insertCompletion(cur, postfix, uniqueCompletionAvailable()); + old_cursor_ = bv.cursor(); updatePrefix(cur); // show popup without delay because the completion was not unique @@ -723,8 +721,7 @@ void GuiCompleter::tab() popup_timer_.start(0); // redraw if needed - if (cur.result().screenUpdate()) - gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); + bv.processUpdateFlags(cur.result().screenUpdate()); } @@ -891,8 +888,7 @@ void GuiCompleter::popupActivated(const QString & completion) hidePopup(); hideInline(cur); - if (cur.result().screenUpdate()) - gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); + gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); cur.endUndoGroup(); } @@ -908,8 +904,7 @@ void GuiCompleter::popupHighlighted(const QString & completion) if (inlineVisible()) updateInline(cur, completion); - if (cur.result().screenUpdate()) - gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); + gui_->bufferView().processUpdateFlags(cur.result().screenUpdate()); } } // namespace frontend