Add scintilla backspace unindents feature

This commit is contained in:
Anna 2016-05-05 19:22:55 +03:00
parent 3d7283486a
commit 155398cf8e
5 changed files with 11 additions and 0 deletions

View file

@ -540,6 +540,12 @@ void Preferences::on_checkBoxAutoIndent_toggled(bool val)
writeSettings();
}
void Preferences::on_checkBoxBackspaceUnindents_toggled(bool val)
{
Settings::Settings::inst()->set(Settings::Settings::backspaceUnindents, Value(val));
writeSettings();
}
void Preferences::on_comboBoxIndentUsing_activated(int val)
{
applyComboBox(comboBoxIndentUsing, val, Settings::Settings::indentStyle);
@ -686,6 +692,7 @@ void Preferences::updateGUI()
this->spinBoxLineWrapIndentationIndent->setValue(s->get(Settings::Settings::lineWrapIndentation).toDouble());
this->spinBoxShowWhitespaceSize->setValue(s->get(Settings::Settings::showWhitespaceSize).toDouble());
this->checkBoxAutoIndent->setChecked(s->get(Settings::Settings::autoIndent).toBool());
this->checkBoxBackspaceUnindents->setChecked(s->get(Settings::Settings::backspaceUnindents).toBool());
this->checkBoxHighlightCurrentLine->setChecked(s->get(Settings::Settings::highlightCurrentLine).toBool());
this->checkBoxEnableBraceMatching->setChecked(s->get(Settings::Settings::enableBraceMatching).toBool());
this->checkBoxShowWarningsIn3dView->setChecked(s->get(Settings::Settings::showWarningsIn3dView).toBool());

View file

@ -53,6 +53,7 @@ public slots:
// Indentation
void on_checkBoxAutoIndent_toggled(bool);
void on_checkBoxBackspaceUnindents_toggled(bool);
void on_comboBoxIndentUsing_activated(int);
void on_spinBoxIndentationWidth_valueChanged(int);
void on_spinBoxTabWidth_valueChanged(int);

View file

@ -172,6 +172,7 @@ void ScintillaEditor::applySettings()
qsci->setWhitespaceVisibility(conv.toShowWhitespaces(s->get(Settings::Settings::showWhitespace)));
qsci->setWhitespaceSize(s->get(Settings::Settings::showWhitespaceSize).toDouble());
qsci->setAutoIndent(s->get(Settings::Settings::autoIndent).toBool());
qsci->setBackspaceUnindents(s->get(Settings::Settings::backspaceUnindents).toBool());
std::string indentStyle = s->get(Settings::Settings::indentStyle).toString();
qsci->setIndentationsUseTabs(indentStyle == "Tabs");

View file

@ -137,6 +137,7 @@ SettingsEntry Settings::lineWrapVisualizationEnd("editor", "lineWrapVisualizatio
SettingsEntry Settings::showWhitespace("editor", "showWhitespaces", values("Never", _("Never"), "Always", _("Always"), "AfterIndentation", _("After indentation")), Value("Never"));
SettingsEntry Settings::showWhitespaceSize("editor", "showWhitespacesSize", Value(RangeType(1, 16)), Value(2));
SettingsEntry Settings::autoIndent("editor", "autoIndent", Value(true), Value(true));
SettingsEntry Settings::backspaceUnindents("editor", "backspaceUnindents", Value(true), Value(true));
SettingsEntry Settings::indentStyle("editor", "indentStyle", values("Spaces", _("Spaces"), "Tabs", _("Tabs")), Value("Spaces"));
SettingsEntry Settings::tabKeyFunction("editor", "tabKeyFunction", values("Indent", _("Indent"), "InsertTab", _("Insert Tab")), Value("Indent"));
SettingsEntry Settings::highlightCurrentLine("editor", "highlightCurrentLine", Value(true), Value(true));

View file

@ -46,6 +46,7 @@ public:
static SettingsEntry showWhitespace;
static SettingsEntry showWhitespaceSize;
static SettingsEntry autoIndent;
static SettingsEntry backspaceUnindents;
static SettingsEntry indentStyle;
static SettingsEntry tabKeyFunction;
static SettingsEntry highlightCurrentLine;