Merge pull request #751 from mwerle/feature/editor-show-whitespace

feat: add an option to render whitespace in the diff and editor views
This commit is contained in:
Murmele 2024-05-12 18:38:23 +02:00 committed by GitHub
commit 39ccb2661c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 3432 additions and 3177 deletions

2
.gitignore vendored
View File

@ -10,4 +10,4 @@ build
.idea/
.venv
compile_commands.json
tags

View File

@ -14,6 +14,9 @@ return {
family = family,
size = size
},
view = {
showWhitespace = false
},
indent = {
tabs = true,
width = 4,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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";

View File

@ -36,6 +36,7 @@ public:
IndentWidth,
TabWidth,
ShowHeatmapInBlameMargin,
ShowWhitespaceInEditor,
ColorTheme,
ShowFullRepoPath,
HideLogAutomatically,

View File

@ -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);

View File

@ -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);