Browse Source

Revert "Fix wrapping long code lines in UI" (#6074)

This reverts commit e5cd80e021.

Fixes: https://github.com/go-gitea/gitea/issues/6064
for-closed-social
silverwind 5 years ago
committed by techknowlogick
parent
commit
ec540294a1
5 changed files with 25 additions and 11 deletions
  1. +1
    -1
      public/css/index.css
  2. +17
    -6
      public/less/_base.less
  3. +4
    -1
      public/less/_repository.less
  4. +2
    -2
      templates/repo/diff/box.tmpl
  5. +1
    -1
      templates/repo/diff/section_unified.tmpl

+ 1
- 1
public/css/index.css
File diff suppressed because it is too large
View File


+ 17
- 6
public/less/_base.less View File

@ -30,15 +30,26 @@ pre, code {
line-height: 1.5;
overflow: auto;
}
}
/* Wrap long lines of code. This will also apply to Markdown code boxes. */
pre > code {
white-space: pre-wrap !important;
word-break: break-all !important;
overflow-wrap: break-word !important;
&.wrap {
white-space: pre-wrap; /* CSS 3 */
// white-space: -moz-normal; /* Mozilla, since 1999 */
// white-space: -normal; /* Opera 4-6 */
// white-space: -o-normal; /* Opera 7 */
-ms-word-break: break-all;
word-break: break-all;
/* These are technically the same, but use both */
overflow-wrap: break-word;
word-wrap: break-word;
}
}
.dont-break-out {
/* These are technically the same, but use both */
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
word-break: break-all;
/* Adds a hyphen where the word breaks, if supported (No Blink) */

+ 4
- 1
public/less/_repository.less View File

@ -364,10 +364,13 @@
padding: 0 !important;
li {
display: block;
padding: 0 .25em;
width: 100%;
&.active {
background: #ffffdd;
}
&:before {
content: ' ';
}
}
}
}

+ 2
- 2
templates/repo/diff/box.tmpl View File

@ -127,7 +127,7 @@
{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 2))}}
<a class="ui green button add-code-comment add-code-comment-left" data-path="{{$file.Name}}" data-side="left" data-idx="{{$line.LeftIdx}}">+</a>
{{end}}
<pre><code class="{{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
</td>
<td class="lines-num lines-num-new">
<span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
@ -137,7 +137,7 @@
{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 3))}}
<a class="ui green button add-code-comment add-code-comment-right" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}">+</a>
{{end}}
<pre><code class="{{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
</td>
</tr>
{{if gt (len $line.Comments) 0}}

+ 1
- 1
templates/repo/diff/section_unified.tmpl View File

@ -19,7 +19,7 @@
{{if and $.root.SignedUserID $line.CanComment $.root.PageIsPullFiles}}
<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>
{{end}}
<pre><code class="{{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre>
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre>
</td>
</tr>
{{if gt (len $line.Comments) 0}}

Loading…
Cancel
Save