Skip to content
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

fix extra newlines when copying from diff in Firefox #7288

Merged
merged 19 commits into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions public/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -638,15 +638,14 @@ footer .ui.left,footer .ui.right{line-height:40px}
.repository .diff-file-box .file-body.file-code .lines-num-old{border-right:1px solid #ddd}
.repository .diff-file-box .code-diff{font-size:12px}
.repository .diff-file-box .code-diff td{padding:0 0 0 10px;border-top:0}
.repository .diff-file-box .code-diff pre{margin:0}
.repository .diff-file-box .code-diff .lines-num{border-color:#d4d4d5;border-right-width:1px;border-right-style:solid;padding:0 5px}
.repository .diff-file-box .code-diff tbody tr td.halfwidth{width:49%}
.repository .diff-file-box .code-diff tbody tr td.tag-code,.repository .diff-file-box .code-diff tbody tr.tag-code td{background-color:#f0f0f0!important;border-color:#d3cfcf!important;padding-top:8px;padding-bottom:8px}
.repository .diff-file-box .code-diff tbody tr .removed-code{background-color:#f99}
.repository .diff-file-box .code-diff tbody tr .added-code{background-color:#9f9}
.repository .diff-file-box .code-diff tbody tr .lines-num[data-line-num]::before{content:attr(data-line-num);text-align:right}
.repository .diff-file-box .code-diff tbody tr .lines-type-marker{width:10px;min-width:10px}
.repository .diff-file-box .code-diff tbody tr .line-type-marker[data-type-marker]::before{content:attr(data-type-marker);text-align:right;display:inline-block}
.repository .diff-file-box .code-diff tbody tr [data-line-num]::before{content:attr(data-line-num);text-align:right}
.repository .diff-file-box .code-diff tbody tr .lines-type-marker{width:10px;min-width:10px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
.repository .diff-file-box .code-diff tbody tr [data-type-marker]::before{content:attr(data-type-marker);text-align:right;display:inline-block}
.repository .diff-file-box .code-diff-unified tbody tr.del-code td{background-color:#ffe0e0!important;border-color:#f1c0c0!important}
.repository .diff-file-box .code-diff-unified tbody tr.add-code td{background-color:#d6fcd6!important;border-color:#c1e9c1!important}
.repository .diff-file-box .code-diff-split table,.repository .diff-file-box .code-diff-split tbody{width:100%}
Expand Down
9 changes: 3 additions & 6 deletions public/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -1362,10 +1362,6 @@
border-top: 0;
}

pre {
margin: 0;
}

.lines-num {
border-color: #d4d4d5;
border-right-width: 1px;
Expand Down Expand Up @@ -1405,17 +1401,18 @@
background-color: #99ff99;
}

.lines-num[data-line-num]::before {
[data-line-num]::before {
content: attr(data-line-num);
text-align: right;
}

.lines-type-marker {
width: 10px;
min-width: 10px;
user-select: none;
}

.line-type-marker[data-type-marker]::before {
[data-type-marker]::before {
content: attr(data-type-marker);
text-align: right;
display: inline-block;
Expand Down
8 changes: 4 additions & 4 deletions templates/repo/diff/box.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -124,25 +124,25 @@
<span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}"></span>
</td>
<td class="lines-type-marker">
<pre>{{if $line.LeftIdx}}<span class="line-type-marker" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</pre>
{{if $line.LeftIdx}}<code data-type-marker="{{$line.GetLineTypeMarker}}"></code>{{end}}
</td>
<td class="lines-code lines-code-old halfwidth">
{{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="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
<code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code>
zeripath marked this conversation as resolved.
Show resolved Hide resolved
</td>
<td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}">
<span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}"></span>
</td>
<td class="lines-type-marker">
<pre>{{if $line.RightIdx}}<span class="line-type-marker" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</pre>
{{if $line.RightIdx}}<code data-type-marker="{{$line.GetLineTypeMarker}}"></code>{{end}}
</td>
<td class="lines-code lines-code-new halfwidth">
{{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="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
<code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code>
</td>
</tr>
{{if gt (len $line.Comments) 0}}
Expand Down
4 changes: 2 additions & 2 deletions templates/repo/diff/section_unified.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
</td>
{{end}}
<td class="lines-type-marker">
<pre><span class="line-type-marker" data-type-marker="{{$line.GetLineTypeMarker}}"></span></pre>
<code data-type-marker="{{$line.GetLineTypeMarker}}"></code>
</td>
<td class="lines-code {{if (not $line.RightIdx)}}lines-code-old{{end}}">
{{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="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre>
<code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code>
</td>
</tr>
{{if gt (len $line.Comments) 0}}
Expand Down