Skip to content

Commit 4cbe4da

Browse files
committed
merge with devel
2 parents 97d1eec + 6dee610 commit 4cbe4da

File tree

5 files changed

+62
-46
lines changed

5 files changed

+62
-46
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.44.1
2+
### Bugfix
3+
* fix errors with form autofill outside of the terminal [#977](https://github.com/jcubic/jquery.terminal/issues/977)
4+
15
## 2.44.0
26
### Features
37
* new API `terminal::animation()` and `terminal::delay()` [#683](https://github.com/jcubic/jquery.terminal/issues/683)

js/jquery.terminal-src.js

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4077,7 +4077,7 @@
40774077
// we hold text before keydown to fix backspace for Android/Chrome/SwiftKey
40784078
// keyboard that generate keycode 229 for all keys #296
40794079
var prev_command = '';
4080-
var prev_key;
4080+
var prev_shortcut;
40814081
// ---------------------------------------------------------------------
40824082
// :: Keydown Event Handler
40834083
// ---------------------------------------------------------------------
@@ -4111,35 +4111,41 @@
41114111
var result;
41124112
process = (e.key || '').toLowerCase() === 'process' || e.which === 0;
41134113
dead_key = no_keypress && single_key && !is_backspace(e);
4114+
// fake event without key #977
4115+
var have_key = typeof e.key !== 'undefined';
4116+
var key = String(e.key).toLowerCase();
4117+
var unidentified_key = key === 'unidentified';
41144118
// special keys don't trigger keypress fix #293
41154119
try {
41164120
if (!e.fake) {
41174121
single_key = is_single(e);
4122+
no_key = !unidentified_key;
41184123
// chrome on android support key property but it's "Unidentified"
4119-
no_key = String(e.key).toLowerCase() === 'unidentified';
4120-
backspace = is_backspace(e);
4124+
backspace = have_key && is_backspace(e);
41214125
}
41224126
} catch (exception) {}
41234127
// keydown created in input will have text already inserted and we
41244128
// want text before input
4125-
if (e.key === "Unidentified") {
4129+
if (unidentified_key) {
41264130
no_keydown = true;
41274131
// android swift keyboard have always which == 229 we will triger proper
41284132
// event in input with e.fake == true
41294133
return;
41304134
}
41314135
// meta and os are special keydown triggered by Emoji picker on Windows 10
41324136
// meta is in Google Chrome is is in Firefox
4133-
if (!e.fake && ['meta', 'os'].indexOf(e.key.toLowerCase()) === -1) {
4137+
if (!e.fake && have_key && ['meta', 'os'].indexOf(key) === -1) {
41344138
no_keydown = false;
41354139
}
41364140
no_keypress = true;
41374141
// Meta+V did bind input but it didin't happen because terminal paste
41384142
// prevent native insert action
41394143
clip.$node.off('input', paste);
4140-
var key = get_key(e);
4144+
var shortcut = get_key(e);
41414145
if (is_function(settings.keydown)) {
4142-
e.key = ie_key_fix(e);
4146+
if (have_key) {
4147+
e.key = ie_key_fix(e);
4148+
}
41434149
result = settings.keydown.call(self, e);
41444150
if (result !== undefined) {
41454151
//skip_keypress = true;
@@ -4149,19 +4155,19 @@
41494155
return result;
41504156
}
41514157
}
4152-
if (key !== prev_key) {
4158+
if (shortcut !== prev_shortcut) {
41534159
clear_hold();
41544160
}
41554161
// CTRL+C hanlding is only exception of cmd aware terminal logic
41564162
// cmd need to call CTRL+C keymap when terminal is not enabled
4157-
if (enabled || (key === 'CTRL+C' && is_terminal_selected(self))) {
4163+
if (enabled || (shortcut === 'CTRL+C' && is_terminal_selected(self))) {
41584164
if (hold) {
4159-
prev_key = key;
4160-
key = 'HOLD+' + key;
4165+
prev_shortcut = shortcut;
4166+
shortcut = 'HOLD+' + shortcut;
41614167
if (hold_pause) {
41624168
return;
41634169
}
4164-
if (settings.holdRepeatTimeout > 0 && is_delay_key(key)) {
4170+
if (settings.holdRepeatTimeout > 0 && is_delay_key(shortcut)) {
41654171
hold_pause = true;
41664172
self.oneTime(settings.holdRepeatTimeout, 'delay', function() {
41674173
hold_pause = false;
@@ -4171,7 +4177,7 @@
41714177
self.oneTime(settings.holdTimeout, 'hold', function() {
41724178
hold = true;
41734179
});
4174-
prev_key = key;
4180+
prev_shortcut = shortcut;
41754181
}
41764182
// if e.fake ignore of space is handled in input and next keydown
41774183
// is not triggered this is just in case code since on Android
@@ -4182,18 +4188,18 @@
41824188
skip_keydown = false;
41834189
return false;
41844190
}
4185-
if (mobile_ignore_key(key)) {
4191+
if (mobile_ignore_key(shortcut)) {
41864192
skip_keydown = true;
4187-
} else if (mobile_ignore_key(prev_key)) {
4193+
} else if (mobile_ignore_key(prev_shortcut)) {
41884194
// just in case next key is different then space
41894195
skip_keydown = false;
41904196
}
41914197
}
41924198
restart_animation();
41934199
// CTRL+V don't fire keypress in IE11
4194-
skip_insert = ['CTRL+V', 'META+V'].indexOf(key) !== -1;
4200+
skip_insert = ['CTRL+V', 'META+V'].indexOf(shortcut) !== -1;
41954201
// only enter will reset history (and down arrow on last command)
4196-
if (key.toLowerCase() === 'enter') {
4202+
if (shortcut === 'ENTER') {
41974203
first_up_history = true;
41984204
}
41994205
if (reverse_search && clear_reverse_search_key(e)) {
@@ -4206,8 +4212,8 @@
42064212
if (e.which === 13) {
42074213
keydown_event.call(this, e);
42084214
}
4209-
} else if (is_function(keymap[key])) {
4210-
result = keymap[key](e);
4215+
} else if (is_function(keymap[shortcut])) {
4216+
result = keymap[shortcut](e);
42114217
if (result === true) {
42124218
return;
42134219
}

js/jquery.terminal.js

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
55
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
66
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
7-
* \/ /____/ version 2.44.0
7+
* \/ /____/ version DEV
88
*
99
* This file is part of jQuery Terminal. https://terminal.jcubic.pl
1010
*
@@ -41,7 +41,7 @@
4141
*
4242
* broken image by Sophia Bai from the Noun Project (CC-BY)
4343
*
44-
* Date: Tue, 08 Oct 2024 13:21:22 +0000
44+
* Date: Tue, 08 Oct 2024 20:17:15 +0000
4545
*/
4646
/* global define, Map, BigInt */
4747
/* eslint-disable */
@@ -4077,7 +4077,7 @@
40774077
// we hold text before keydown to fix backspace for Android/Chrome/SwiftKey
40784078
// keyboard that generate keycode 229 for all keys #296
40794079
var prev_command = '';
4080-
var prev_key;
4080+
var prev_shortcut;
40814081
// ---------------------------------------------------------------------
40824082
// :: Keydown Event Handler
40834083
// ---------------------------------------------------------------------
@@ -4111,35 +4111,41 @@
41114111
var result;
41124112
process = (e.key || '').toLowerCase() === 'process' || e.which === 0;
41134113
dead_key = no_keypress && single_key && !is_backspace(e);
4114+
// fake event without key #977
4115+
var have_key = typeof e.key !== 'undefined';
4116+
var key = String(e.key).toLowerCase();
4117+
var unidentified_key = key === 'unidentified';
41144118
// special keys don't trigger keypress fix #293
41154119
try {
41164120
if (!e.fake) {
41174121
single_key = is_single(e);
4122+
no_key = !unidentified_key;
41184123
// chrome on android support key property but it's "Unidentified"
4119-
no_key = String(e.key).toLowerCase() === 'unidentified';
4120-
backspace = is_backspace(e);
4124+
backspace = have_key && is_backspace(e);
41214125
}
41224126
} catch (exception) {}
41234127
// keydown created in input will have text already inserted and we
41244128
// want text before input
4125-
if (e.key === "Unidentified") {
4129+
if (unidentified_key) {
41264130
no_keydown = true;
41274131
// android swift keyboard have always which == 229 we will triger proper
41284132
// event in input with e.fake == true
41294133
return;
41304134
}
41314135
// meta and os are special keydown triggered by Emoji picker on Windows 10
41324136
// meta is in Google Chrome is is in Firefox
4133-
if (!e.fake && ['meta', 'os'].indexOf(e.key.toLowerCase()) === -1) {
4137+
if (!e.fake && have_key && ['meta', 'os'].indexOf(key) === -1) {
41344138
no_keydown = false;
41354139
}
41364140
no_keypress = true;
41374141
// Meta+V did bind input but it didin't happen because terminal paste
41384142
// prevent native insert action
41394143
clip.$node.off('input', paste);
4140-
var key = get_key(e);
4144+
var shortcut = get_key(e);
41414145
if (is_function(settings.keydown)) {
4142-
e.key = ie_key_fix(e);
4146+
if (have_key) {
4147+
e.key = ie_key_fix(e);
4148+
}
41434149
result = settings.keydown.call(self, e);
41444150
if (result !== undefined) {
41454151
//skip_keypress = true;
@@ -4149,19 +4155,19 @@
41494155
return result;
41504156
}
41514157
}
4152-
if (key !== prev_key) {
4158+
if (shortcut !== prev_shortcut) {
41534159
clear_hold();
41544160
}
41554161
// CTRL+C hanlding is only exception of cmd aware terminal logic
41564162
// cmd need to call CTRL+C keymap when terminal is not enabled
4157-
if (enabled || (key === 'CTRL+C' && is_terminal_selected(self))) {
4163+
if (enabled || (shortcut === 'CTRL+C' && is_terminal_selected(self))) {
41584164
if (hold) {
4159-
prev_key = key;
4160-
key = 'HOLD+' + key;
4165+
prev_shortcut = shortcut;
4166+
shortcut = 'HOLD+' + shortcut;
41614167
if (hold_pause) {
41624168
return;
41634169
}
4164-
if (settings.holdRepeatTimeout > 0 && is_delay_key(key)) {
4170+
if (settings.holdRepeatTimeout > 0 && is_delay_key(shortcut)) {
41654171
hold_pause = true;
41664172
self.oneTime(settings.holdRepeatTimeout, 'delay', function() {
41674173
hold_pause = false;
@@ -4171,7 +4177,7 @@
41714177
self.oneTime(settings.holdTimeout, 'hold', function() {
41724178
hold = true;
41734179
});
4174-
prev_key = key;
4180+
prev_shortcut = shortcut;
41754181
}
41764182
// if e.fake ignore of space is handled in input and next keydown
41774183
// is not triggered this is just in case code since on Android
@@ -4182,18 +4188,18 @@
41824188
skip_keydown = false;
41834189
return false;
41844190
}
4185-
if (mobile_ignore_key(key)) {
4191+
if (mobile_ignore_key(shortcut)) {
41864192
skip_keydown = true;
4187-
} else if (mobile_ignore_key(prev_key)) {
4193+
} else if (mobile_ignore_key(prev_shortcut)) {
41884194
// just in case next key is different then space
41894195
skip_keydown = false;
41904196
}
41914197
}
41924198
restart_animation();
41934199
// CTRL+V don't fire keypress in IE11
4194-
skip_insert = ['CTRL+V', 'META+V'].indexOf(key) !== -1;
4200+
skip_insert = ['CTRL+V', 'META+V'].indexOf(shortcut) !== -1;
41954201
// only enter will reset history (and down arrow on last command)
4196-
if (key.toLowerCase() === 'enter') {
4202+
if (shortcut === 'ENTER') {
41974203
first_up_history = true;
41984204
}
41994205
if (reverse_search && clear_reverse_search_key(e)) {
@@ -4206,8 +4212,8 @@
42064212
if (e.which === 13) {
42074213
keydown_event.call(this, e);
42084214
}
4209-
} else if (is_function(keymap[key])) {
4210-
result = keymap[key](e);
4215+
} else if (is_function(keymap[shortcut])) {
4216+
result = keymap[shortcut](e);
42114217
if (result === true) {
42124218
return;
42134219
}
@@ -5336,8 +5342,8 @@
53365342
}
53375343
// -------------------------------------------------------------------------
53385344
$.terminal = {
5339-
version: '2.44.0',
5340-
date: 'Tue, 08 Oct 2024 13:21:22 +0000',
5345+
version: 'DEV',
5346+
date: 'Tue, 08 Oct 2024 20:17:15 +0000',
53415347
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
53425348
color_names: [
53435349
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',

js/jquery.terminal.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/jquery.terminal.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)