Skip to content

Commit

Permalink
aligned_diff style by default is solid gray instead of zebra, fold sy…
Browse files Browse the repository at this point in the history
…ncing
  • Loading branch information
anijanyan committed Dec 29, 2024
1 parent 890c91b commit 64ffbc1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 12 deletions.
15 changes: 8 additions & 7 deletions diff0/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,14 @@
background-color: rgba(255, 128, 79, 0.26);
}
.ace_diff.aligned_diff.inline:after {
background: repeating-linear-gradient(
45deg, /* Angle of the stripes */
rgba(122, 111, 108, 0.26), /* First color */
rgba(122, 111, 108, 0.26) 5px, /* Stripe width */
#FFFFFF 5px, /* Second color starts */
#FFFFFF 10px /* Second stripe width */
);
background: rgba(206, 194, 191, 0.26);
/*background: repeating-linear-gradient(*/
/* 45deg, !* Angle of the stripes *!*/
/* rgba(122, 111, 108, 0.26), !* First color *!*/
/* rgba(122, 111, 108, 0.26) 5px, !* Stripe width *!*/
/* #FFFFFF 5px, !* Second color starts *!*/
/* #FFFFFF 10px !* Second stripe width *!*/
/*);*/
}

.ace_diff.delete.inline.empty {
Expand Down
38 changes: 33 additions & 5 deletions diff0/twoway.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,43 @@ class DiffView {
}

onChangeFold(ev, session) {
if (ev.action == "remove") {
var other = session == this.orig.session ? this.edit.session : this.orig.session;
var fold = ev.data;
if (fold && fold.other) {
var fold = ev.data;
if (this.$syncFold || !fold || !ev.action)
return;

const isOrig = session === this.orig.session;
const other = isOrig ? this.edit.session : this.orig.session;

if (ev.action === "remove") {
if (fold.other) {
fold.other.other = null;
other.removeFold(fold.other);
} else if (fold.lineWidget) {
other.widgetManager.addLineWidget(fold.lineWidget);
fold.lineWidget = null;
other.$editor.renderer.updateBackMarkers();
}
}

if (ev.action === "add") {
const range = this.transformRange(fold.range, isOrig);
if (range.isEmpty()) {
const row = range.start.row + 1;
if (other.lineWidgets[row]) {
fold.lineWidget = other.lineWidgets[row];
other.widgetManager.removeLineWidget(fold.lineWidget);
other.$editor.renderer.updateBackMarkers();
}
} else {
this.$syncFold = true;

fold.other = other.addFold("---", range);
fold.other.other = fold;

this.$syncFold = false;

}
}
}

$attachEditorsEventHandlers() {
Expand Down Expand Up @@ -639,7 +668,6 @@ class SyncSelectionMarker {

this.range = newRange;
}

}

class DiffHighlight {
Expand Down

0 comments on commit 64ffbc1

Please sign in to comment.