Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add an option to render whitespace in the diff and editor views #751

Merged
merged 4 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading