Skip to content

Commit 3dc9832

Browse files
committed
Make the output window scrollable
1 parent e834578 commit 3dc9832

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,13 @@ document.getElementById('btn-play').addEventListener('click', async () => {
139139
// We want the string content.
140140
const output = result.toString();
141141
outputDiv.innerText = output;
142+
// Auto-scroll to bottom
143+
outputDiv.scrollTop = outputDiv.scrollHeight;
142144
} catch (e) {
143145
console.error(e);
144146
outputDiv.innerText = "Execution Error: " + (e.message || e);
147+
// Auto-scroll to bottom
148+
outputDiv.scrollTop = outputDiv.scrollHeight;
145149
}
146150
});
147151

style.css

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,23 @@ body {
8484
flex-direction: column;
8585
height: 100%;
8686
min-width: 0;
87+
min-height: 0;
88+
overflow: hidden;
8789
}
8890

8991
.pane-header {
9092
margin-bottom: 8px;
9193
font-weight: bold;
9294
font-size: 1rem;
95+
flex-shrink: 0; /* Prevent header from shrinking */
9396
}
9497

9598
.monaco-container {
9699
flex: 1;
97100
border: 1px solid #445566;
98101
border-radius: 4px;
99102
overflow: hidden;
103+
min-height: 0;
100104
}
101105

102106
.output-container {
@@ -106,10 +110,9 @@ body {
106110
border-radius: 4px;
107111
padding: 10px;
108112
font-family: 'Courier New', Courier, monospace;
109-
overflow-y: auto;
110-
white-space: pre-wrap;
111-
display: flex;
112-
flex-direction: column;
113+
overflow: auto; /* Allow both vertical and horizontal scroll */
114+
white-space: pre; /* Do not wrap text */
115+
min-height: 0; /* Crucial for scrolling in flex container */
113116
}
114117

115118
.initial-state {

0 commit comments

Comments
 (0)