-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Add wrapping to long diff lines to fix #1827 #1954
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
Conversation
Maybe have a checkbox toggle? For those that don't want wrapping :)
|
The wrapping was already default behavior for the split view, are you sure you want a setting for this? |
public/css/index.css
Outdated
@@ -2063,6 +2063,7 @@ footer .ui.language .menu { | |||
color: #A7A7A7; | |||
background: #fafafa; | |||
width: 1%; | |||
vertical-align: top; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't edit index.css
directly, instead edit the appropriate .less
file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh... I hate generated code in VCS... I'll fix it though, good spot!
Maybe beside 'View File' in the header? BTW I also noticed an error in the
Oh, and I also think this change should apply to regular code view, not just diffs. |
I assumed the I'm not sure I agree with applying this to normal code views as well. And if we decide to do this, I'd do so using a user preference. |
Looks like Thought, from the linked description, it sounds that |
Interesting, reading the W3C spec leads me to believe
|
Both are valid in WebKit: The spec seems pretty clear to me.
|
public/less/_base.less
Outdated
word-break: break-word; | ||
|
||
/* These are technically the same, but use both */ | ||
overflow-wrap: break-word; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something seems to be wrong with tabs
But we're talking about |
need @lafriks approval. |
Yeah, my error, I meant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When tabs are fixed than LG-TM
public/less/_repository.less
Outdated
td.message .isSigned { | ||
cursor: default; | ||
} | ||
td.message .isSigned { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much tabs
public/less/_repository.less
Outdated
.jumpable-path { | ||
color: #888; | ||
} | ||
.jumpable-path { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much tabs
public/less/_repository.less
Outdated
@@ -678,7 +678,7 @@ | |||
} | |||
textarea { | |||
height: 200px; | |||
font-family: "Consolas", monospace; | |||
font-family: "Consolas", monospace; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much tabs
public/less/_repository.less
Outdated
td.sha .sha.label { | ||
margin: 0; | ||
} | ||
td.sha .sha.label { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much tabs
public/less/_repository.less
Outdated
} | ||
} | ||
} | ||
#commits-table td.sha .sha.label, #repo-files-table .sha.label{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much tabs in all levels
public/less/_repository.less
Outdated
&:not(.positive):last-child { | ||
border-bottom: 1px solid #A3C293; | ||
} | ||
&:not(.positive){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much tabs
public/less/_repository.less
Outdated
@@ -1304,7 +1305,7 @@ | |||
} | |||
|
|||
.issue-actions { | |||
display: none; | |||
display: none; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One tab too much :)
This whole formatting problem is caused by the .editorconfig file stating that indentation should be done using 4 spaces, but the less files are using tabs. Which should it be? |
Lack of response leads me to believe nobody really cares if indentation is done using spaces or tabs, so I'll go with 4 spaces. |
Getting back to the topic of having it also apply on regular code views: Why should it only wrap in diffs? If you have a long line in a diff, it'll be a long line in the regular code view. I'd rather have both wrap for consistence. Of course, a checkbox toggle in the header would be ideal, but that can come later, imho. |
This may just be me, but I generally hate wrapping in code. The only time I do find it useful is when I need to see the difference between two pieces of code in a single glance. The wrapping is especially useful in a side-by-side diff, where the horizontal space is extra limited. I'm not against implementing wrapping in normal code-views as well, but I'd rather build the toggle setting with it so I can turn it off. Would you be willing to wait for the normal code view wrapping until that time? |
@mjwwit in code view and diff view code wrapping is needed as otherwise if code block is larger than screen you have to scroll to the bottom of code block to be able to scroll to right |
I'm fine if you want to do it later with the toggle. Having it in diffs is already an improvement. Side-by-side diffs already wrap without this patch for me, by the way. Also agree with @lafriks, horizontal scroll on big files is generally a bad UX, but there are options like using the arrow keys to scroll. |
I vote for 4 spaces for tabbing just wanted more opinion from other Gitea developers. If other are also OK with that than it is LG-TM |
@lafriks LG-TM on 4 space. Haven't reviewed this one though so no real LG-TM from me ;) |
hi, please rebase. |
Rebased and tested, LGTM |
Codecov Report
@@ Coverage Diff @@
## master #1954 +/- ##
=======================================
Coverage 27.08% 27.08%
=======================================
Files 88 88
Lines 17264 17264
=======================================
Hits 4676 4676
Misses 11909 11909
Partials 679 679 Continue to review full report at Codecov.
|
This PR adds line wrapping to the unified diff view (for long lines) (#1827). Wrapping was already done in the split view.

An additional change has been made to align the line-numbers of wrapped diff lines to the top of the line.
EDIT: Closes #1827