Add diff options as icon buttons#108
Conversation
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
Add buttons to the right above the diff pane that allows user to select diff view options. All icons are MIT Licensed according to: 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
|
License update: I found the proper reference repo for the icons: 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. |
|
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! |
f89f357 to
a991b77
Compare
a991b77 to
94dd588
Compare
|
Fixed name case, also added a simple test for the formatting marks button |
I drew these to replace 3rd party icons.
"Whitespace changes ignored" instead of "File contents didn't change".
|
I expanded on your work a bit:
Thoughts on the UI:
Notes on your implementation:
|
|
Just wanted to chime in on this.
I agree with difficulty in communicating what this actually does, since I am not sure from the way it's presented. But I want to note that it is immensely valuable to be able to ignore whitespace changes that merely change indentation and/or alignment, vs. those that are material, say inside a string or regex.
IMHO, this should be separate; tools should accommodate their users, not the other way around. If some dev has checked in different line endings from what I am using and my OS/Compiler/etc doesn't care about line endings, then neither do I. I would want to permanently have line-ending differences ignored, no matter what whitespace option I have enabled. |
|
Still getting used to QT, lots to learn 😄
I use all these options in different repos, so for me they're useful. 😄 The options are just an interpretation of what I've seen in different diff tools, I don't particularly like how the experience works but I haven't been able to figure out a better UI/UX. There might be a better layout where the options are presented as an increasing level of ignore? "Ignore nothing, ignore some things, ignore more things, ignore the most things." If you get what I mean. The documentation probably needs to show some good examples to the users. Need to think about that. But can be its own task maybe.
There are some messy repos where it's quite useful. There are some cases I activate it depending on what I'm reviewing in different stages, and sometimes I just come in to review architecture or safety and don't care about code style. For reviewing codes style, you need all whitespace and newlines to be visible, but in other cases you're reviewing on a higher level and it's just noise. I think there are a lot of developers that use this with the motivation "Don't break my workflow". 😄 I've also worked as a teacher where I review student code, and it's very useful to focus on the high level stuff. I don't expect beginner programmers in a classroom to worry about CR/LF/CRFL.
Could be a good structure, yes.
I think either show all options, or remove word wrap from that menu.
Not sure why I had trouble with this, it was a hack to get around something. Good that it could be removed. |
|
You both made good points, so I kept all options, with one caveat: After experimenting a bit, I found out that I also added additional controls to the button strip: a spinbox to tune the amount of context lines and an SVG preview toggle. I've had these controls in the back of my mind for years, thank you Andreas for initiating this. I merged all this into master, but feel free to chime in if this still needs tweaking before I flesh out the documentation and cut a new release. |
Overview
Adds toolbar controls to the right side of the diff file header for common diff display options, with matching entries in Preferences -> Code.
Toolbar
Preferences
New settings under Code:
(Note: Word wrap was already in Preferences, no change to this)
Comparison method
Controls how
git diffis run when loading a patch for the diff view. Options map to Git’s built-in flags:--ignore-cr-at-eol--ignore-cr-at-eol,--ignore-space-change--ignore-cr-at-eol,--ignore-all-spaceNote: 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