Skip to content

Commit

Permalink
merge with devel
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Oct 8, 2024
2 parents 97d1eec + 6dee610 commit 4cbe4da
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 46 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.44.1
### Bugfix
* fix errors with form autofill outside of the terminal [#977](https://github.com/jcubic/jquery.terminal/issues/977)

## 2.44.0
### Features
* new API `terminal::animation()` and `terminal::delay()` [#683](https://github.com/jcubic/jquery.terminal/issues/683)
Expand Down
44 changes: 25 additions & 19 deletions js/jquery.terminal-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -4077,7 +4077,7 @@
// we hold text before keydown to fix backspace for Android/Chrome/SwiftKey
// keyboard that generate keycode 229 for all keys #296
var prev_command = '';
var prev_key;
var prev_shortcut;
// ---------------------------------------------------------------------
// :: Keydown Event Handler
// ---------------------------------------------------------------------
Expand Down Expand Up @@ -4111,35 +4111,41 @@
var result;
process = (e.key || '').toLowerCase() === 'process' || e.which === 0;
dead_key = no_keypress && single_key && !is_backspace(e);
// fake event without key #977
var have_key = typeof e.key !== 'undefined';
var key = String(e.key).toLowerCase();
var unidentified_key = key === 'unidentified';
// special keys don't trigger keypress fix #293
try {
if (!e.fake) {
single_key = is_single(e);
no_key = !unidentified_key;
// chrome on android support key property but it's "Unidentified"
no_key = String(e.key).toLowerCase() === 'unidentified';
backspace = is_backspace(e);
backspace = have_key && is_backspace(e);
}
} catch (exception) {}
// keydown created in input will have text already inserted and we
// want text before input
if (e.key === "Unidentified") {
if (unidentified_key) {
no_keydown = true;
// android swift keyboard have always which == 229 we will triger proper
// event in input with e.fake == true
return;
}
// meta and os are special keydown triggered by Emoji picker on Windows 10
// meta is in Google Chrome is is in Firefox
if (!e.fake && ['meta', 'os'].indexOf(e.key.toLowerCase()) === -1) {
if (!e.fake && have_key && ['meta', 'os'].indexOf(key) === -1) {
no_keydown = false;
}
no_keypress = true;
// Meta+V did bind input but it didin't happen because terminal paste
// prevent native insert action
clip.$node.off('input', paste);
var key = get_key(e);
var shortcut = get_key(e);
if (is_function(settings.keydown)) {
e.key = ie_key_fix(e);
if (have_key) {
e.key = ie_key_fix(e);
}
result = settings.keydown.call(self, e);
if (result !== undefined) {
//skip_keypress = true;
Expand All @@ -4149,19 +4155,19 @@
return result;
}
}
if (key !== prev_key) {
if (shortcut !== prev_shortcut) {
clear_hold();
}
// CTRL+C hanlding is only exception of cmd aware terminal logic
// cmd need to call CTRL+C keymap when terminal is not enabled
if (enabled || (key === 'CTRL+C' && is_terminal_selected(self))) {
if (enabled || (shortcut === 'CTRL+C' && is_terminal_selected(self))) {
if (hold) {
prev_key = key;
key = 'HOLD+' + key;
prev_shortcut = shortcut;
shortcut = 'HOLD+' + shortcut;
if (hold_pause) {
return;
}
if (settings.holdRepeatTimeout > 0 && is_delay_key(key)) {
if (settings.holdRepeatTimeout > 0 && is_delay_key(shortcut)) {
hold_pause = true;
self.oneTime(settings.holdRepeatTimeout, 'delay', function() {
hold_pause = false;
Expand All @@ -4171,7 +4177,7 @@
self.oneTime(settings.holdTimeout, 'hold', function() {
hold = true;
});
prev_key = key;
prev_shortcut = shortcut;
}
// if e.fake ignore of space is handled in input and next keydown
// is not triggered this is just in case code since on Android
Expand All @@ -4182,18 +4188,18 @@
skip_keydown = false;
return false;
}
if (mobile_ignore_key(key)) {
if (mobile_ignore_key(shortcut)) {
skip_keydown = true;
} else if (mobile_ignore_key(prev_key)) {
} else if (mobile_ignore_key(prev_shortcut)) {
// just in case next key is different then space
skip_keydown = false;
}
}
restart_animation();
// CTRL+V don't fire keypress in IE11
skip_insert = ['CTRL+V', 'META+V'].indexOf(key) !== -1;
skip_insert = ['CTRL+V', 'META+V'].indexOf(shortcut) !== -1;
// only enter will reset history (and down arrow on last command)
if (key.toLowerCase() === 'enter') {
if (shortcut === 'ENTER') {
first_up_history = true;
}
if (reverse_search && clear_reverse_search_key(e)) {
Expand All @@ -4206,8 +4212,8 @@
if (e.which === 13) {
keydown_event.call(this, e);
}
} else if (is_function(keymap[key])) {
result = keymap[key](e);
} else if (is_function(keymap[shortcut])) {
result = keymap[shortcut](e);
if (result === true) {
return;
}
Expand Down
52 changes: 29 additions & 23 deletions js/jquery.terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
* \/ /____/ version 2.44.0
* \/ /____/ version DEV
*
* This file is part of jQuery Terminal. https://terminal.jcubic.pl
*
Expand Down Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Tue, 08 Oct 2024 13:21:22 +0000
* Date: Tue, 08 Oct 2024 20:17:15 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -4077,7 +4077,7 @@
// we hold text before keydown to fix backspace for Android/Chrome/SwiftKey
// keyboard that generate keycode 229 for all keys #296
var prev_command = '';
var prev_key;
var prev_shortcut;
// ---------------------------------------------------------------------
// :: Keydown Event Handler
// ---------------------------------------------------------------------
Expand Down Expand Up @@ -4111,35 +4111,41 @@
var result;
process = (e.key || '').toLowerCase() === 'process' || e.which === 0;
dead_key = no_keypress && single_key && !is_backspace(e);
// fake event without key #977
var have_key = typeof e.key !== 'undefined';
var key = String(e.key).toLowerCase();
var unidentified_key = key === 'unidentified';
// special keys don't trigger keypress fix #293
try {
if (!e.fake) {
single_key = is_single(e);
no_key = !unidentified_key;
// chrome on android support key property but it's "Unidentified"
no_key = String(e.key).toLowerCase() === 'unidentified';
backspace = is_backspace(e);
backspace = have_key && is_backspace(e);
}
} catch (exception) {}
// keydown created in input will have text already inserted and we
// want text before input
if (e.key === "Unidentified") {
if (unidentified_key) {
no_keydown = true;
// android swift keyboard have always which == 229 we will triger proper
// event in input with e.fake == true
return;
}
// meta and os are special keydown triggered by Emoji picker on Windows 10
// meta is in Google Chrome is is in Firefox
if (!e.fake && ['meta', 'os'].indexOf(e.key.toLowerCase()) === -1) {
if (!e.fake && have_key && ['meta', 'os'].indexOf(key) === -1) {
no_keydown = false;
}
no_keypress = true;
// Meta+V did bind input but it didin't happen because terminal paste
// prevent native insert action
clip.$node.off('input', paste);
var key = get_key(e);
var shortcut = get_key(e);
if (is_function(settings.keydown)) {
e.key = ie_key_fix(e);
if (have_key) {
e.key = ie_key_fix(e);
}
result = settings.keydown.call(self, e);
if (result !== undefined) {
//skip_keypress = true;
Expand All @@ -4149,19 +4155,19 @@
return result;
}
}
if (key !== prev_key) {
if (shortcut !== prev_shortcut) {
clear_hold();
}
// CTRL+C hanlding is only exception of cmd aware terminal logic
// cmd need to call CTRL+C keymap when terminal is not enabled
if (enabled || (key === 'CTRL+C' && is_terminal_selected(self))) {
if (enabled || (shortcut === 'CTRL+C' && is_terminal_selected(self))) {
if (hold) {
prev_key = key;
key = 'HOLD+' + key;
prev_shortcut = shortcut;
shortcut = 'HOLD+' + shortcut;
if (hold_pause) {
return;
}
if (settings.holdRepeatTimeout > 0 && is_delay_key(key)) {
if (settings.holdRepeatTimeout > 0 && is_delay_key(shortcut)) {
hold_pause = true;
self.oneTime(settings.holdRepeatTimeout, 'delay', function() {
hold_pause = false;
Expand All @@ -4171,7 +4177,7 @@
self.oneTime(settings.holdTimeout, 'hold', function() {
hold = true;
});
prev_key = key;
prev_shortcut = shortcut;
}
// if e.fake ignore of space is handled in input and next keydown
// is not triggered this is just in case code since on Android
Expand All @@ -4182,18 +4188,18 @@
skip_keydown = false;
return false;
}
if (mobile_ignore_key(key)) {
if (mobile_ignore_key(shortcut)) {
skip_keydown = true;
} else if (mobile_ignore_key(prev_key)) {
} else if (mobile_ignore_key(prev_shortcut)) {
// just in case next key is different then space
skip_keydown = false;
}
}
restart_animation();
// CTRL+V don't fire keypress in IE11
skip_insert = ['CTRL+V', 'META+V'].indexOf(key) !== -1;
skip_insert = ['CTRL+V', 'META+V'].indexOf(shortcut) !== -1;
// only enter will reset history (and down arrow on last command)
if (key.toLowerCase() === 'enter') {
if (shortcut === 'ENTER') {
first_up_history = true;
}
if (reverse_search && clear_reverse_search_key(e)) {
Expand All @@ -4206,8 +4212,8 @@
if (e.which === 13) {
keydown_event.call(this, e);
}
} else if (is_function(keymap[key])) {
result = keymap[key](e);
} else if (is_function(keymap[shortcut])) {
result = keymap[shortcut](e);
if (result === true) {
return;
}
Expand Down Expand Up @@ -5336,8 +5342,8 @@
}
// -------------------------------------------------------------------------
$.terminal = {
version: '2.44.0',
date: 'Tue, 08 Oct 2024 13:21:22 +0000',
version: 'DEV',
date: 'Tue, 08 Oct 2024 20:17:15 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down
6 changes: 3 additions & 3 deletions js/jquery.terminal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/jquery.terminal.min.js.map

Large diffs are not rendered by default.

0 comments on commit 4cbe4da

Please sign in to comment.