diff --git a/src/DefaultPrefs.h b/src/DefaultPrefs.h index 12882b910..f6a4966c8 100644 --- a/src/DefaultPrefs.h +++ b/src/DefaultPrefs.h @@ -37,6 +37,7 @@ const int kDefault_TabWidth = 32; const int kDefault_HideConsole = 1; const bool kDefault_HighlightCurrentLine = true; const bool kDefault_AutocompleteEnabled = true; +const bool kDefault_AutoFollowFocusEnabled = false; const bool kDefault_AllowScriptFileReading = false; const bool kDefault_AllowScriptFileWriting = false; const bool kDefault_EnableScriptingPlugins = false; diff --git a/src/PrefsDialog.cpp b/src/PrefsDialog.cpp index b14febdf4..8a9fa2cd6 100644 --- a/src/PrefsDialog.cpp +++ b/src/PrefsDialog.cpp @@ -328,6 +328,7 @@ void PrefsDialog::restoreDefaults() encoding->setCurrentIndex(encoding->findText(QString::fromLatin1("UTF-8"))); highlightCurrentLine->setChecked(kDefault_HighlightCurrentLine); autocompleteEnabled->setChecked(kDefault_AutocompleteEnabled); + autoFollowFocusEnabled->setChecked(kDefault_AutoFollowFocusEnabled); break; case 2: @@ -578,6 +579,7 @@ QDialog::DialogCode PrefsDialog::doPrefsDialog(QWidget *parent) dlg.encoding->setCurrentIndex(nameList.indexOf(QString::fromUtf8(TWApp::instance()->getDefaultCodec()->name().constData()))); dlg.highlightCurrentLine->setChecked(settings.value(QString::fromLatin1("highlightCurrentLine"), kDefault_HighlightCurrentLine).toBool()); dlg.autocompleteEnabled->setChecked(settings.value(QString::fromLatin1("autocompleteEnabled"), kDefault_AutocompleteEnabled).toBool()); + dlg.autoFollowFocusEnabled->setChecked(settings.value(QStringLiteral("autoFollowFocusEnabled"), kDefault_AutoFollowFocusEnabled).toBool()); QString defDict = settings.value(QString::fromLatin1("language"), QString::fromLatin1("None")).toString(); int i = dlg.language->findData(defDict); @@ -747,6 +749,8 @@ QDialog::DialogCode PrefsDialog::doPrefsDialog(QWidget *parent) settings.setValue(QString::fromLatin1("autocompleteEnabled"), autocompleteEnabled); CompletingEdit::setAutocompleteEnabled(autocompleteEnabled); + settings.setValue(QStringLiteral("autoFollowFocusEnabled"), dlg.autoFollowFocusEnabled->isChecked()); + // Since the tab width can't be set by any other means, forcibly update // all windows now foreach (QWidget* widget, TWApp::instance()->allWidgets()) { diff --git a/src/PrefsDialog.ui b/src/PrefsDialog.ui index 2c2e6bb2f..65201c376 100644 --- a/src/PrefsDialog.ui +++ b/src/PrefsDialog.ui @@ -520,6 +520,13 @@ + + + + Enable auto-follow focus + + + diff --git a/src/TeXDocumentWindow.cpp b/src/TeXDocumentWindow.cpp index 3437785a6..f1a91b390 100644 --- a/src/TeXDocumentWindow.cpp +++ b/src/TeXDocumentWindow.cpp @@ -268,6 +268,8 @@ void TeXDocumentWindow::init() b = settings.value(QString::fromLatin1("lineNumbers"), false).toBool(); actionLine_Numbers->setChecked(b); setLineNumbers(b); + + actionAuto_Follow_Focus->setChecked(settings.value(QStringLiteral("autoFollowFocusEnabled"), kDefault_AutoFollowFocusEnabled).toBool()); QStringList options = TeXHighlighter::syntaxOptions();