Skip to content

Commit 3132b05

Browse files
authored
Merge pull request #608 from intersystems/issue-590
Fix diffview
2 parents a7e343a + 947cb00 commit 3132b05

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5151
- Fixed changing favorites for users without permissions (#587)
5252
- Fix creating new branch from Git Web UI (#591)
5353
- Fix wording for Git Repo Root Directory (#601)
54+
- Fix Diff View options not applying immediately (#590)
5455

5556
## [2.6.0] - 2024-10-07
5657

git-webui/release/share/git-webui/webui/js/git-webui.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,6 +1525,13 @@ webui.DiffView = function(sideBySide, hunkSelectionAllowed, parent, stashedCommi
15251525
var self = this;
15261526

15271527
self.update = function(cmd, diffOpts, file, mode) {
1528+
if (cmd || diffOpts || file || mode) {
1529+
// if new input, update all
1530+
this.cmd = cmd
1531+
this.diffOpts = diffOpts
1532+
this.file = file
1533+
this.mode = mode
1534+
}
15281535
gitApplyType = mode;
15291536
$(".diff-stage", self.element).attr("style", "display:none");
15301537
$(".diff-cancel", self.element).attr("style", "display:none");
@@ -1576,6 +1583,10 @@ webui.DiffView = function(sideBySide, hunkSelectionAllowed, parent, stashedCommi
15761583
}
15771584
};
15781585

1586+
self.reRun = function() {
1587+
self.update(this.cmd, this.diffOpts, this.file, this.mode)
1588+
}
1589+
15791590
self.refresh = function(diff) {
15801591
self.currentDiff = diff;
15811592
self.diffHeader = "";
@@ -1789,24 +1800,24 @@ webui.DiffView = function(sideBySide, hunkSelectionAllowed, parent, stashedCommi
17891800

17901801
self.addContext = function() {
17911802
self.context += 3;
1792-
self.update();
1803+
self.reRun();
17931804
}
17941805

17951806
self.removeContext = function() {
17961807
if (self.context > 3) {
17971808
self.context -= 3;
1798-
self.update();
1809+
self.reRun();
17991810
}
18001811
}
18011812

18021813
self.allContext = function() {
18031814
self.complete = !self.complete;
1804-
self.update();
1815+
self.reRun();
18051816
}
18061817

18071818
self.toggleIgnoreWhitespace = function() {
18081819
self.ignoreWhitespace = !self.ignoreWhitespace;
1809-
self.update();
1820+
self.reRun();
18101821
}
18111822

18121823
self.handleClick = function(event) {

git-webui/src/share/git-webui/webui/js/git-webui.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,6 +1525,13 @@ webui.DiffView = function(sideBySide, hunkSelectionAllowed, parent, stashedCommi
15251525
var self = this;
15261526

15271527
self.update = function(cmd, diffOpts, file, mode) {
1528+
if (cmd || diffOpts || file || mode) {
1529+
// if new input, update all
1530+
this.cmd = cmd
1531+
this.diffOpts = diffOpts
1532+
this.file = file
1533+
this.mode = mode
1534+
}
15281535
gitApplyType = mode;
15291536
$(".diff-stage", self.element).attr("style", "display:none");
15301537
$(".diff-cancel", self.element).attr("style", "display:none");
@@ -1576,6 +1583,10 @@ webui.DiffView = function(sideBySide, hunkSelectionAllowed, parent, stashedCommi
15761583
}
15771584
};
15781585

1586+
self.reRun = function() {
1587+
self.update(this.cmd, this.diffOpts, this.file, this.mode)
1588+
}
1589+
15791590
self.refresh = function(diff) {
15801591
self.currentDiff = diff;
15811592
self.diffHeader = "";
@@ -1789,24 +1800,24 @@ webui.DiffView = function(sideBySide, hunkSelectionAllowed, parent, stashedCommi
17891800

17901801
self.addContext = function() {
17911802
self.context += 3;
1792-
self.update();
1803+
self.reRun();
17931804
}
17941805

17951806
self.removeContext = function() {
17961807
if (self.context > 3) {
17971808
self.context -= 3;
1798-
self.update();
1809+
self.reRun();
17991810
}
18001811
}
18011812

18021813
self.allContext = function() {
18031814
self.complete = !self.complete;
1804-
self.update();
1815+
self.reRun();
18051816
}
18061817

18071818
self.toggleIgnoreWhitespace = function() {
18081819
self.ignoreWhitespace = !self.ignoreWhitespace;
1809-
self.update();
1820+
self.reRun();
18101821
}
18111822

18121823
self.handleClick = function(event) {

0 commit comments

Comments
 (0)