Skip to content

Commit befb33a

Browse files
committed
fix scrolling on mobile #914
1 parent 4735d6c commit befb33a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

css/jquery.terminal-src.css

+3-3
Original file line numberDiff line numberDiff line change
@@ -1120,11 +1120,11 @@ terminal .terminal-output > div {
11201120
display: inline-block;
11211121
}
11221122
.cmd-editable {
1123-
position: fixed;
1124-
top: 0;
1123+
position: absolute;
1124+
top: calc(var(--cmd-top) * 1px);
1125+
bottom: 0;
11251126
right: 0;
11261127
left: 0;
1127-
bottom: 0;
11281128
z-index: 500;
11291129
color: transparent;
11301130
background: transparent;

js/jquery.terminal-src.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@
12601260
})();
12611261
// -------------------------------------------------------------------------
12621262
var is_css_variables_supported = root.CSS && root.CSS.supports &&
1263-
root.CSS.supports('--fake-var', 0);
1263+
root.CSS.supports('(--fake-var: 0)');
12641264
// -------------------------------------------------------------------------
12651265
var is_android = navigator.userAgent.toLowerCase().indexOf('android') !== -1;
12661266
// -------------------------------------------------------------------------
@@ -10644,12 +10644,16 @@
1064410644
var cmd_cursor = self.find('.cmd-cursor');
1064510645
var offset = self.find('.cmd').offset();
1064610646
var self_offset = self.offset();
10647-
self.stopTime('flush').oneTime(1, 'flush', function() {
10647+
self.stopTime('flush').oneTime(10, 'flush', function() {
10648+
const top = output.height();
10649+
const height = command_line.height();
1064810650
css(self[0], {
1064910651
'--terminal-height': self.height(),
1065010652
'--terminal-x': offset.left - self_offset.left,
1065110653
'--terminal-y': offset.top - self_offset.top,
10652-
'--terminal-scroll': scroller.prop('scrollTop')
10654+
'--terminal-scroll': scroller.prop('scrollTop'),
10655+
'--cmd-top': top,
10656+
'--cmd-height': height
1065310657
});
1065410658
if (enabled && !is_mobile) {
1065510659
// Firefox won't reflow the cursor automatically, so

0 commit comments

Comments
 (0)