Skip to content

Commit ec54029

Browse files
silverwindtechknowlogick
authored andcommitted
Revert "Fix wrapping long code lines in UI" (#6074)
This reverts commit e5cd80e. Fixes: #6064
1 parent 7ae5956 commit ec54029

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

public/css/index.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/less/_base.less

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,26 @@ pre, code {
3030
line-height: 1.5;
3131
overflow: auto;
3232
}
33-
}
34-
/* Wrap long lines of code. This will also apply to Markdown code boxes. */
35-
pre > code {
36-
white-space: pre-wrap !important;
37-
word-break: break-all !important;
38-
overflow-wrap: break-word !important;
33+
&.wrap {
34+
white-space: pre-wrap; /* CSS 3 */
35+
// white-space: -moz-normal; /* Mozilla, since 1999 */
36+
// white-space: -normal; /* Opera 4-6 */
37+
// white-space: -o-normal; /* Opera 7 */
38+
39+
-ms-word-break: break-all;
40+
word-break: break-all;
41+
42+
/* These are technically the same, but use both */
43+
overflow-wrap: break-word;
44+
word-wrap: break-word;
45+
}
3946
}
4047
.dont-break-out {
48+
/* These are technically the same, but use both */
4149
overflow-wrap: break-word;
50+
word-wrap: break-word;
51+
52+
-ms-word-break: break-all;
4253
word-break: break-all;
4354

4455
/* Adds a hyphen where the word breaks, if supported (No Blink) */

public/less/_repository.less

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,13 @@
364364
padding: 0 !important;
365365
li {
366366
display: block;
367-
padding: 0 .25em;
367+
width: 100%;
368368
&.active {
369369
background: #ffffdd;
370370
}
371+
&:before {
372+
content: ' ';
373+
}
371374
}
372375
}
373376
}

templates/repo/diff/box.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 2))}}
128128
<a class="ui green button add-code-comment add-code-comment-left" data-path="{{$file.Name}}" data-side="left" data-idx="{{$line.LeftIdx}}">+</a>
129129
{{end}}
130-
<pre><code class="{{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
130+
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
131131
</td>
132132
<td class="lines-num lines-num-new">
133133
<span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
@@ -137,7 +137,7 @@
137137
{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 3))}}
138138
<a class="ui green button add-code-comment add-code-comment-right" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}">+</a>
139139
{{end}}
140-
<pre><code class="{{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
140+
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
141141
</td>
142142
</tr>
143143
{{if gt (len $line.Comments) 0}}

templates/repo/diff/section_unified.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{{if and $.root.SignedUserID $line.CanComment $.root.PageIsPullFiles}}
2020
<a class="ui green button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}" data-path="{{$file.Name}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">+</a>
2121
{{end}}
22-
<pre><code class="{{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre>
22+
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre>
2323
</td>
2424
</tr>
2525
{{if gt (len $line.Comments) 0}}

0 commit comments

Comments
 (0)