Skip to content

Commit

Permalink
Merge pull request #751 from mwerle/feature/editor-show-whitespace
Browse files Browse the repository at this point in the history
feat: add an option to render whitespace in the diff and editor views
  • Loading branch information
Murmele authored May 12, 2024
2 parents 67a358f + 37c8034 commit 39ccb26
Show file tree
Hide file tree
Showing 14 changed files with 3,304 additions and 3,049 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ build
.idea/
.venv
compile_commands.json

tags
3 changes: 3 additions & 0 deletions conf/editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ return {
family = family,
size = size
},
view = {
showWhitespace = false
},
indent = {
tabs = true,
width = 4,
Expand Down
792 changes: 411 additions & 381 deletions l10n/gittyup_de.ts

Large diffs are not rendered by default.

792 changes: 411 additions & 381 deletions l10n/gittyup_en.ts

Large diffs are not rendered by default.

792 changes: 411 additions & 381 deletions l10n/gittyup_es.ts

Large diffs are not rendered by default.

792 changes: 411 additions & 381 deletions l10n/gittyup_ja.ts

Large diffs are not rendered by default.

792 changes: 411 additions & 381 deletions l10n/gittyup_pt.ts

Large diffs are not rendered by default.

792 changes: 411 additions & 381 deletions l10n/gittyup_pt_BR.ts

Large diffs are not rendered by default.

792 changes: 411 additions & 381 deletions l10n/gittyup_ru.ts

Large diffs are not rendered by default.

792 changes: 411 additions & 381 deletions l10n/gittyup_zh_CN.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/conf/Setting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 1 addition & 0 deletions src/conf/Setting.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Setting : public SettingsTempl<Setting> {
IndentWidth,
TabWidth,
ShowHeatmapInBlameMargin,
ShowWhitespaceInEditor,
ColorTheme,
ShowFullRepoPath,
HideLogAutomatically,
Expand Down
9 changes: 9 additions & 0 deletions src/dialogs/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,14 @@ class EditorPanel : public QWidget {
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"));
Expand Down Expand Up @@ -695,6 +703,7 @@ class EditorPanel : public QWidget {
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);
Expand Down
1 change: 1 addition & 0 deletions src/editor/TextEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 39ccb26

Please sign in to comment.