diff --git a/src/ExtendedScintilla.cpp b/src/ExtendedScintilla.cpp index b86048e6..eb8c8671 100644 --- a/src/ExtendedScintilla.cpp +++ b/src/ExtendedScintilla.cpp @@ -45,6 +45,9 @@ ExtendedScintilla::ExtendedScintilla(QWidget* parent) : // adjusts the scroll width to be narrower. setScrollWidthTracking(true); + // Visual flags for when wrap lines is enabled + setWrapVisualFlags(QsciScintilla::WrapFlagByBorder); + // Connect signals connect(this, SIGNAL(linesChanged()), this, SLOT(updateLineNumberAreaWidth())); @@ -155,6 +158,9 @@ void ExtendedScintilla::reloadLexerSettings(QsciLexer *lexer) setTabWidth(Settings::getValue("editor", "tabsize").toInt()); lexer->refreshProperties(); + // Set wrap lines + setWrapMode(static_cast(Settings::getValue("editor", "wrap_lines").toInt())); + // Check if error indicators are enabled and clear them if they just got disabled showErrorIndicators = Settings::getValue("editor", "error_indicators").toBool(); if(!showErrorIndicators) diff --git a/src/PreferencesDialog.cpp b/src/PreferencesDialog.cpp index cddb6fe4..89289199 100644 --- a/src/PreferencesDialog.cpp +++ b/src/PreferencesDialog.cpp @@ -167,6 +167,7 @@ void PreferencesDialog::loadSettings() ui->spinEditorFontSize->setValue(Settings::getValue("editor", "fontsize").toInt()); ui->spinTabSize->setValue(Settings::getValue("editor", "tabsize").toInt()); ui->spinLogFontSize->setValue(Settings::getValue("log", "fontsize").toInt()); + ui->wrapComboBox->setCurrentIndex(Settings::getValue("editor", "wrap_lines").toInt()); ui->checkAutoCompletion->setChecked(Settings::getValue("editor", "auto_completion").toBool()); ui->checkCompleteUpper->setEnabled(Settings::getValue("editor", "auto_completion").toBool()); ui->checkCompleteUpper->setChecked(Settings::getValue("editor", "upper_keywords").toBool()); @@ -221,6 +222,7 @@ void PreferencesDialog::saveSettings() Settings::setValue("editor", "fontsize", ui->spinEditorFontSize->value()); Settings::setValue("editor", "tabsize", ui->spinTabSize->value()); Settings::setValue("log", "fontsize", ui->spinLogFontSize->value()); + Settings::setValue("editor", "wrap_lines", ui->wrapComboBox->currentIndex()); Settings::setValue("editor", "auto_completion", ui->checkAutoCompletion->isChecked()); Settings::setValue("editor", "upper_keywords", ui->checkCompleteUpper->isChecked()); Settings::setValue("editor", "error_indicators", ui->checkErrorIndicators->isChecked()); diff --git a/src/PreferencesDialog.ui b/src/PreferencesDialog.ui index e5030d15..20ab6828 100644 --- a/src/PreferencesDialog.ui +++ b/src/PreferencesDialog.ui @@ -990,7 +990,7 @@ - + Code co&mpletion @@ -1000,14 +1000,14 @@ - + enabled - + Keywords in &UPPER CASE @@ -1017,7 +1017,7 @@ - + When set, the SQL keywords are completed in UPPER CASE letters. @@ -1027,7 +1027,7 @@ - + Error indicators @@ -1037,7 +1037,7 @@ - + When set, the SQL code lines that caused errors during the last execution are highlighted and the results frame indicates the error in the background @@ -1047,7 +1047,7 @@ - + Hori&zontal tiling @@ -1057,7 +1057,7 @@ - + If enabled the SQL code editor and the result table view are shown side by side instead of one over the other. @@ -1067,6 +1067,40 @@ + + + + + Never + + + + + At word boundaries + + + + + At character boundaries + + + + + At whitespace boundaries + + + + + + + + Wrap lines + + + wrapComboBox + + + diff --git a/src/Settings.cpp b/src/Settings.cpp index 28da7c17..763a3ca7 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -290,6 +290,10 @@ QVariant Settings::getDefaultValue(const QString& group, const QString& name) } } + // editor/wrap_lines + if(group == "editor" && name == "wrap_lines") + return 0; // QsciScintilla::WrapNone + // editor/auto_completion? if(group == "editor" && name == "auto_completion") return true;