|
2368 | 2368 | }
|
2369 | 2369 | var tmp = command;
|
2370 | 2370 | // fix scroll the page where there is no scrollbar
|
2371 |
| - clip.$node.blur(); |
| 2371 | + if (!is_mobile) { |
| 2372 | + clip.$node.blur(); |
| 2373 | + } |
2372 | 2374 | history.reset();
|
2373 | 2375 |
|
2374 | 2376 | // for next input event on firefox/android with google keyboard
|
|
2388 | 2390 | }
|
2389 | 2391 | self.set('');
|
2390 | 2392 | clip.val('');
|
2391 |
| - clip.$node.focus(); |
| 2393 | + if (!is_mobile) { |
| 2394 | + clip.$node.focus(); |
| 2395 | + } |
2392 | 2396 | return false;
|
2393 | 2397 | },
|
2394 | 2398 | 'SHIFT+ENTER': function() {
|
|
5284 | 5288 | }
|
5285 | 5289 | }
|
5286 | 5290 | // -------------------------------------------------------------------------
|
| 5291 | + // :: handler to trigger when window change size. The most important |
| 5292 | + // :: is that it's triggers when virtual keyboard is toggled |
| 5293 | + // ------------------------------------------------------------------------- |
| 5294 | + function on_height_change(callback) { |
| 5295 | + var height = window.visualViewport.height; |
| 5296 | + callback(height); |
| 5297 | + window.visualViewport.addEventListener('resize', function() { |
| 5298 | + var newHeight = window.visualViewport.height; |
| 5299 | + if (height !== newHeight) { |
| 5300 | + height = newHeight; |
| 5301 | + callback(height); |
| 5302 | + } |
| 5303 | + }); |
| 5304 | + } |
| 5305 | + // ------------------------------------------------------------------------- |
5287 | 5306 | $.terminal = {
|
5288 | 5307 | version: '{{VER}}',
|
5289 | 5308 | date: '{{DATE}}',
|
|
10630 | 10649 | '--terminal-height': self.height(),
|
10631 | 10650 | '--terminal-x': offset.left - self_offset.left,
|
10632 | 10651 | '--terminal-y': offset.top - self_offset.top,
|
10633 |
| - '--terminal-scroll': self.prop('scrollTop') |
| 10652 | + '--terminal-scroll': scroller.prop('scrollTop') |
10634 | 10653 | });
|
10635 |
| - if (enabled) { |
| 10654 | + if (enabled && !is_mobile) { |
10636 | 10655 | // Firefox won't reflow the cursor automatically, so
|
10637 | 10656 | // hide it briefly then reshow it
|
10638 | 10657 | cmd_cursor.hide();
|
|
12021 | 12040 | if (!enabled) {
|
12022 | 12041 | clip.focus();
|
12023 | 12042 | self.focus();
|
| 12043 | + setTimeout(function() { |
| 12044 | + self.scroll_to_bottom(); |
| 12045 | + }, 100); |
12024 | 12046 | } else {
|
12025 | 12047 | clip.blur();
|
12026 | 12048 | self.disable();
|
|
12031 | 12053 | start = null;
|
12032 | 12054 | });
|
12033 | 12055 | })();
|
| 12056 | + if ('visualViewport' in window) { |
| 12057 | + on_height_change(function(height) { |
| 12058 | + css(document.documentElement, { |
| 12059 | + '--terminal-force-height': height |
| 12060 | + }); |
| 12061 | + }); |
| 12062 | + } |
12034 | 12063 | } else {
|
12035 | 12064 | // work weird on mobile
|
12036 | 12065 | $win.on('focus.terminal_' + self.id(), focus_terminal).
|
|
12536 | 12565 | ret = settings.touchscroll(event, delta, self);
|
12537 | 12566 | }
|
12538 | 12567 | css(self[0], {
|
12539 |
| - '--terminal-scroll': self.prop('scrollTop') |
| 12568 | + '--terminal-scroll': scroller.prop('scrollTop') |
12540 | 12569 | });
|
12541 | 12570 | if (ret === true) {
|
12542 | 12571 | return;
|
|
0 commit comments