Skip to content

Commit 932a3c9

Browse files
author
WebCoder49
committed
Add some auto-scrolling
1 parent 53df0b3 commit 932a3c9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

plugins/indent.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,5 +137,17 @@
137137
input_element.selectionEnd = selection_end + number_indents + 1;
138138

139139
codeInput.update(input_element.value);
140+
141+
142+
// Update scrolls
143+
input_element.scrollLeft = 0;
144+
// Move down 1 line
145+
let lineHeight = Number(getComputedStyle(input_element).lineHeight.split(0, -2));
146+
console.log(getComputedStyle(input_element).lineHeight);
147+
if(lineHeight == NaN && getComputedStyle(input_element).lineHeight.split(-2) == "px") {
148+
input_element.scrollTop += lineHeight;
149+
} else {
150+
input_element.scrollTop += 20; // px
151+
}
140152
}
141153
}

0 commit comments

Comments
 (0)