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

Use pseudo-elements instead of border to preserve line height #687

Merged
merged 5 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
37 changes: 23 additions & 14 deletions packages/nbdime/src/styles/diff.css
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,25 @@
}

.jp-Notebook-diff .cm-line {
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
/* enable positioning pseudo-elements relative to line */
position: relative;
}

/* Color diff highlighting according to style vars */
.jp-Notebook-diff .cm-merge-r-chunk {
background-color: var(--jp-diff-deleted-color2);
}

.jp-Notebook-diff .cm-merge-r-chunk-start {
border-top: 1px solid var(--jp-diff-deleted-color0);
}

.jp-Notebook-diff .cm-merge-r-chunk-end {
border-bottom: 1px solid var(--jp-diff-deleted-color0);
/* border-top/bottom without taking up space */
.jp-Notebook-diff .cm-merge-r-chunk-start::before,
.jp-Notebook-diff .cm-merge-r-chunk-end::after {
content: '';
width: 100%;
height: 1px;
background: var(--jp-diff-deleted-color0);
display: block;
position: absolute;
left: 0px;
}

.jp-Notebook-diff .cm-merge-r-connect {
Expand All @@ -187,12 +191,17 @@
background-color: var(--jp-diff-added-color2);
}

.jp-Notebook-diff .cm-diff-right-editor .cm-merge-r-chunk-start {
border-top: 1px solid var(--jp-diff-added-color0);
}

.jp-Notebook-diff .cm-diff-right-editor .cm-merge-r-chunk-end {
border-bottom: 1px solid var(--jp-diff-added-color0);
/* border-top/bottom without taking up space */
.jp-Notebook-diff .cm-diff-right-editor .cm-merge-r-chunk-start::before,
.jp-Notebook-diff .cm-diff-right-editor .cm-merge-r-chunk-end::after
{
content: '';
width: 100%;
height: 1px;
background: var(--jp-diff-added-color0);
display: block;
position: absolute;
left: 0px;
}

.jp-Notebook-diff .cm-diff-right-editor .cm-merge-r-connect {
Expand Down
80 changes: 47 additions & 33 deletions packages/nbdime/src/styles/merge.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,27 +76,31 @@
width: 100%;
}

.jp-Notebook-merge .cm-merge-spacer {
background-color: #eee;
.jp-Notebook-merge .cm-line {
/* enable positioning pseudo-elements relative to line */
position: relative;
}

.jp-Notebook-merge .cm-line {
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
.jp-Notebook-merge .cm-merge-spacer {
background-color: #eee;
}

.jp-Notebook-merge .cm-merge-r-chunk {
background-color: var(--jp-merge-remote-color2);
}

.jp-Notebook-merge .cm-merge-r-chunk-start,
.jp-Notebook-merge .cm-merge-m-chunk-start-remote {
border-top: 1px solid var(--jp-merge-remote-color1);
}

.jp-Notebook-merge .cm-merge-r-chunk-end,
.jp-Notebook-merge .cm-merge-m-chunk-end-remote {
border-bottom: 1px solid var(--jp-merge-remote-color1);
/* border-top/bottom without taking up space */
.jp-Notebook-merge .cm-merge-r-chunk-start::before,
.jp-Notebook-merge .cm-merge-m-chunk-start-remote::before,
.jp-Notebook-merge .cm-merge-r-chunk-end::after,
.jp-Notebook-merge .cm-merge-m-chunk-end-remote::after {
content: '';
width: 100%;
height: 1px;
background: var(--jp-merge-remote-color1);
display: block;
position: absolute;
left: 0px;
}

.jp-Notebook-merge .cm-merge-r-connect {
Expand Down Expand Up @@ -125,14 +129,18 @@
background-color: var(--jp-merge-local-color2);
}

.jp-Notebook-merge .cm-merge-l-chunk-start,
.jp-Notebook-merge .cm-merge-m-chunk-start-local {
border-top: 1px solid var(--jp-merge-local-color1);
}

.jp-Notebook-merge .cm-merge-l-chunk-end,
.jp-Notebook-merge .cm-merge-m-chunk-end-local {
border-bottom: 1px solid var(--jp-merge-local-color1);
/* border-top/bottom without taking up space */
.jp-Notebook-merge .cm-merge-l-chunk-start::before,
.jp-Notebook-merge .cm-merge-m-chunk-start-local::before,
.jp-Notebook-merge .cm-merge-l-chunk-end::after,
.jp-Notebook-merge .cm-merge-m-chunk-end-local::after {
content: '';
width: 100%;
height: 1px;
background: var(--jp-merge-local-color1);
display: block;
position: absolute;
left: 0px;
}

.jp-Notebook-merge .cm-merge-l-connect {
Expand Down Expand Up @@ -161,24 +169,30 @@
background-color: #ffb;
}

.jp-Notebook-merge .cm-merge-m-chunk-start-custom {
border-top: 1px solid #fe6;
}

.jp-Notebook-merge .cm-merge-m-chunk-end-custom {
border-bottom: 1px solid #fe6;
.jp-Notebook-merge .cm-merge-m-chunk-start-custom::before,
.jp-Notebook-merge .cm-merge-m-chunk-end-custom::after {
content: '';
width: 100%;
height: 1px;
background: #fe6;
display: block;
position: absolute;
left: 0px;
}

.jp-Notebook-merge .cm-merge-l-chunk.cm-merge-r-chunk {
background: var(--jp-merge-both-color2);
}

.jp-Notebook-merge .cm-merge-l-chunk-start.cm-merge-r-chunk-start {
border-top: 1px solid var(--jp-merge-both-color1);
}

.jp-Notebook-merge .cm-merge-l-chunk-end.cm-merge-r-chunk-end {
border-bottom: 1px solid var(--jp-merge-both-color1);
.jp-Notebook-merge .cm-merge-l-chunk-start.cm-merge-r-chunk-start::before,
.jp-Notebook-merge .cm-merge-l-chunk-end.cm-merge-r-chunk-end::after {
content: '';
width: 100%;
height: 1px;
background: var(--jp-merge-both-color1);
display: block;
position: absolute;
left: 0px;
}

.jp-Notebook-merge
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.