Skip to content

Add diff options as icon buttons#108

Open
stdout-se wants to merge 4 commits into
jorio:masterfrom
stdout-se:wip/diffbuttons
Open

Add diff options as icon buttons#108
stdout-se wants to merge 4 commits into
jorio:masterfrom
stdout-se:wip/diffbuttons

Conversation

@stdout-se

@stdout-se stdout-se commented May 27, 2026

Copy link
Copy Markdown
Contributor

Overview

Adds toolbar controls to the right side of the diff file header for common diff display options, with matching entries in Preferences -> Code.

image image

Toolbar

  • Word wrap (toggle) — existing preference; new shortcut in the header (still available from the diff context menu and Preferences).
  • Formatting marks (toggle) — show tab and space characters in the diff text.
  • Comparison method (menu) — choose how Git compares lines when showing a patch in the diff view.

Preferences

New settings under Code:

  • Show formatting marks (tabs and spaces)
  • Comparison method (radio list, same four modes as the header menu)

(Note: Word wrap was already in Preferences, no change to this)

Comparison method

Controls how git diff is run when loading a patch for the diff view. Options map to Git’s built-in flags:

Option Git flags
Recognize line endings and white space differences (this is the default) None
Ignore line ending differences --ignore-cr-at-eol
Ignore line ending and white space length differences --ignore-cr-at-eol, --ignore-space-change
Ignore line ending differences and all white space differences --ignore-cr-at-eol, --ignore-all-space

Note: Comparison method affects how patches are displayed on-screen only. This does not affect exporting patches, reverting files, etc. This still uses the precise methods.

Changing the comparison method reloads the current patch (re-runs git diff). Word wrap and formatting marks apply immediately without reloading.

Icons

Notes about icons I have used: All icons are MIT Licensed according to these pages:
Update: See comments below.

https://www.svgrepo.com/svg/361077/clear-all
https://www.svgrepo.com/svg/361075/circle-slash
https://www.svgrepo.com/svg/361072/circle-large-filled
https://www.svgrepo.com/svg/361073/circle-large-outline
https://www.svgrepo.com/svg/361403/whitespace
https://www.svgrepo.com/svg/361405/word-wrap

stdout-se added 3 commits May 27, 2026 08:33
Shows tabs and spaces in diff view if setting is enabled
Add option in settings->code to select between different whitespace and line ending display methods
@stdout-se

Copy link
Copy Markdown
Contributor Author

@stdout-se

stdout-se commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

License update: I found the proper reference repo for the icons:
Reference links:
https://github.com/microsoft/vscode-codicons
https://microsoft.github.io/vscode-codicons/dist/codicon.html

License:
https://github.com/microsoft/vscode-codicons/blob/main/LICENSE

While the license for the code in the repo is MIT, the icons are under The license is Creative Commons Attribution 4.0 International. Not great. Not terrible, I guess.

@jorio

jorio commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Super neat!! I've wanted to do this for a long time, this'll be sure to make people happy. It looks well polished from what I can see. Awesome!

I'll cook up some SVG icons by hand so we don't have to worry about licensing.

Please, can you convert your identifiers to camelCase for consistency with the rest of the code? (The only place with snake_case is porcelain.py because it's an extension to pygit2; the rest of the code more or less follows Qt's naming conventions.)

I will review the rest of your code in detail soon. Thank you for your hard work!

@stdout-se

Copy link
Copy Markdown
Contributor Author

Fixed name case, also added a simple test for the formatting marks button

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants