Allow disabling of line wrapping in diff
Description
Line wrapping was previously an option when viewing diffs, however it was removed in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/396. I understand why it is the default, but I don't understand why the button was removed entirely.
Proposal
- Add
Wrap lines
as an option underPreferences
on theChanges
tab - Default to
Wrap lines
- Preference should persist across MRs
File browser
[ List view][ Tree view ]
Compare changes
[ Inline ][ Side-by-side ]
[x] Show whitespace changes
[ ] Show one file at a time
[x] Wrap lines
Documentation blurb
Overview
What is it?
- A button to toggle line wrapping in a diff
Why should someone use this feature?
- When they don't want lines to wrap
What is the underlying (business) problem?
- Makes it hard to scan the beginning of lines in files that have particularly long lines, e.g. log files, or developers who for whatever reason like really long lines
- It is difficult to determine if the line breaks and changes were generated by the MR or the Diff/Review tool.
How do you use this feature?
- Viewing merge requests that have particularly long lines, and the wrapping ruins the intended appearance of the code.
Use cases
- Looking at merge requests diffs and don't want lines to wrap.
Feature checklist
Make sure these are completed before closing the issue, with a link to the relevant commit.
-
Feature assurance -
Documentation -
Added to features.yml
Testing
This would require an additional set of tests similar to spec/features/merge_request/user_toggles_whitespace_changes_spec.rb
Additional tests required for the setting: spec/models/user_preference_spec.rb
, spec/models/user_spec.rb
If this setting is to be supported by the API an additional test should be added to spec/requests/api/users_preferences_spec.rb