mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-10-03 21:47:10 +03:00
feat(whitespace): show whitespace in editor views
This commit adds a new Settings entry "ShowWhitespaceinEditor" ("editor/view/showWhitespace") to the Settings class, and a new checkbox in the Editor settings dialog. This setting defaults to off/false, preserving the current behaviour of the application. If this setting is toggled to on, whitespace is rendered in the HunkWidget and BlameEditor views.
This commit is contained in:
parent
e5f9484638
commit
81cf2e6e5e
@ -14,6 +14,9 @@ return {
|
||||
family = family,
|
||||
size = size
|
||||
},
|
||||
view = {
|
||||
showWhitespace = false
|
||||
},
|
||||
indent = {
|
||||
tabs = true,
|
||||
width = 4,
|
||||
|
@ -12,6 +12,7 @@ void Setting::initialize(QMap<Id, QString> &keys) {
|
||||
keys[Id::IndentWidth] = "editor/indent/width";
|
||||
keys[Id::TabWidth] = "editor/indent/tabwidth";
|
||||
keys[Id::ShowHeatmapInBlameMargin] = "editor/blame/heatmap";
|
||||
keys[Id::ShowWhitespaceInEditor] = "editor/view/showWhitespace";
|
||||
keys[Id::ColorTheme] = "window/theme";
|
||||
keys[Id::ShowFullRepoPath] = "window/path/full";
|
||||
keys[Id::HideLogAutomatically] = "window/log/hide";
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
IndentWidth,
|
||||
TabWidth,
|
||||
ShowHeatmapInBlameMargin,
|
||||
ShowWhitespaceInEditor,
|
||||
ColorTheme,
|
||||
ShowFullRepoPath,
|
||||
HideLogAutomatically,
|
||||
|
@ -661,6 +661,14 @@ public:
|
||||
Settings::instance()->setValue(Setting::Id::FontSize, i);
|
||||
});
|
||||
|
||||
QCheckBox *showWhitespace = new QCheckBox(tr("Show whitespace"), this);
|
||||
showWhitespace->setChecked(
|
||||
settings->value(Setting::Id::ShowWhitespaceInEditor).toBool());
|
||||
connect(showWhitespace, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::ShowWhitespaceInEditor,
|
||||
checked);
|
||||
});
|
||||
|
||||
QComboBox *indent = new QComboBox(this);
|
||||
indent->addItem(tr("Tabs"));
|
||||
indent->addItem(tr("Spaces"));
|
||||
@ -695,6 +703,7 @@ public:
|
||||
QFormLayout *layout = new QFormLayout(this);
|
||||
layout->addRow(tr("Font:"), font);
|
||||
layout->addRow(tr("Font size:"), fontSize);
|
||||
layout->addRow(tr("Whitespace:"), showWhitespace);
|
||||
layout->addRow(tr("Indent using:"), indent);
|
||||
layout->addRow(tr("Indent width:"), indentWidth);
|
||||
layout->addRow(tr("Tab width:"), tabWidth);
|
||||
|
@ -182,6 +182,7 @@ void TextEditor::applySettings() {
|
||||
setUseTabs(settings->value(Setting::Id::UseTabsForIndent).toBool());
|
||||
setIndent(settings->value(Setting::Id::IndentWidth).toInt());
|
||||
setTabWidth(settings->value(Setting::Id::TabWidth).toInt());
|
||||
setViewWS(settings->value(Setting::Id::ShowWhitespaceInEditor).toBool());
|
||||
|
||||
if (Settings::instance()->isTextEditorWrapLines()) {
|
||||
setWrapMode(SC_WRAP_WORD);
|
||||
|
Loading…
Reference in New Issue
Block a user