Skip to content

Commit

Permalink
ASTDiff GUI: Fix the scrolling issues
Browse files Browse the repository at this point in the history
Further fix for tsantalis#672
  • Loading branch information
pouryafard75 committed Aug 24, 2024
1 parent ef343a6 commit 6008038
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/java/gui/webdiff/dir/DirectoryDiffView.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void renderOn(HtmlCanvas html) throws IOException {
._if()
.div(class_("row mt-3 mb-3"))
.div(class_("col"))
.div(class_("card"))
.div(class_("card").style("padding: 5px"))
.div(class_("card-header"))
.h4(class_("card-title mb-0"))
.write("Modified files ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void renderOn(HtmlCanvas html) {
html.render(DocType.HTML5)
.html(lang("en"))
.body()
.div(class_("container-fluid"))
.div(class_("container-fluid").style("padding-left: 0"))
.div(class_("row h-100"))
.div(class_("col-2 bg-light dir-diff"))
.render(new DirectoryDiffView(comparator, true))
Expand Down Expand Up @@ -61,7 +61,7 @@ public void renderOn(HtmlCanvas html) {
._div()
._div()
.div(id("collapse-" + i).class_("collapse show").add("aria-labelledby", "heading-" + i))
.div(class_("card-body").style("padding: 0;"));
.div(class_("card-body").style("overflow: hidden; padding: 0;"));
makeEachDiff(html, i, core);
html
._div()
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/web/dist/monaco.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ div {
}

#diff_panel {
overflow-y: auto;
height: 100%;
}
/*.deleted {*/
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/web/dist/monaco.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ function getEditorOptions(config, text) {
lineDecorationsWidth: 0,
glyphMargin: false,
scrollbar: {
alwaysConsumeMouseWheel: false
alwaysConsumeMouseWheel: false,
vertical: config.spv === true ? 'hidden' : 'auto'
},
minimap: {
enabled: false,
Expand Down
11 changes: 9 additions & 2 deletions src/main/resources/web/dist/single.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
.monaco-panel {
overflow-y: auto; /* Enable scrollbar for Monaco panel */
overflow: hidden; /* Disable both vertical and horizontal scrollbars */

height: 100%; /* Ensure it fills the available height */
}
.dir-diff{
height: 100%;
overflow-y: scroll; /* Enable vertical scrolling */
overflow-x: hidden; /* Disable horizontal scrolling */
}

#accordion {
overflow-y: auto; /* Enable scrollbar for accordion */
overflow-y: scroll; /* Enable vertical scrolling */
overflow-x: hidden; /* Disable horizontal scrolling */
height: 100%; /* Ensure it fills the available height */
}

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/web/dist/single.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
x = 1;
$(document).ready(function() {
// Select all elements with an ID that starts with 'diff_row_'
$('[id^="diff_row_"]').each(function() {
Expand All @@ -11,7 +10,6 @@ $(document).ready(function() {
event.preventDefault(); // Prevent the default anchor behavior
var targetId = 'heading-' + id.split('_')[2];
var $target = $('#' + targetId);
x = $target
var targetOffset = $('#' + targetId).offset().top;
var accordionOffset = $('#accordion').offset().top;
var scrollTo = targetOffset - accordionOffset + $('#accordion').scrollTop();
Expand Down

0 comments on commit 6008038

Please sign in to comment.