Skip to content

Commit

Permalink
fix #87
Browse files Browse the repository at this point in the history
  • Loading branch information
sunderme committed Jul 13, 2018
1 parent 79e96a2 commit 33b5e65
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/latexcompleter.cpp
Expand Up @@ -6,6 +6,7 @@
#include "smallUsefulFunctions.h"

#include "qdocumentline.h"
#include "qdocument_p.h"
#include "qeditorinputbinding.h"
#include "qformatfactory.h"
#include "qdocumentline_p.h"
Expand Down Expand Up @@ -62,10 +63,10 @@ class CompleterInputBinding: public QEditorInputBinding
{
if (!editor) return;
maxWritten += text.length();
if ( editor->currentPlaceHolder() >= 0 && editor->currentPlaceHolder() < editor->placeHolderCount() )
editor->document()->beginMacro();
editor->cursor().insertText(text);
//cursor mirrors
if ( editor->currentPlaceHolder() >= 0 && editor->currentPlaceHolder() < editor->placeHolderCount() )
editor->document()->beginMacro();
editor->write(text);
//cursor mirrors
if ( editor->currentPlaceHolder() >= 0 && editor->currentPlaceHolder() < editor->placeHolderCount() ) {
PlaceHolder ph = editor->getPlaceHolder(editor->currentPlaceHolder());

Expand All @@ -77,7 +78,7 @@ class CompleterInputBinding: public QEditorInputBinding
ph.mirrors[phm].replaceSelectedText(baseText);
}
editor->document()->endMacro();
}
}
//end cursor mirrors
if (editor->cursor().columnNumber() > curStart + 1 && !completer->isVisible()) {
QString wrd = getCurWord();
Expand Down Expand Up @@ -312,11 +313,13 @@ class CompleterInputBinding: public QEditorInputBinding
bool handled = false;
if (event->key() == Qt::Key_Backspace) {
maxWritten--;
editor->cursor().deletePreviousChar();
if (editor->cursor().columnNumber() <= curStart) {
QDocumentCursorHandle *dch=editor->cursorHandle();
Q_ASSERT(dch);
dch->deletePreviousChar();
if (dch->columnNumber() <= curStart) {
resetBinding();
return true;
} else if (editor->cursor().columnNumber() + 1 <= curStart && !showAlways) {
} else if (dch->columnNumber() + 1 <= curStart && !showAlways) {
completer->widget->hide();
return true;
}
Expand Down

0 comments on commit 33b5e65

Please sign in to comment.