Skip to content

Commit

Permalink
don't prevent all shortcuts when terminal is paused #1005
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Feb 22, 2025
1 parent 9a8444e commit f0a61a9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
15 changes: 13 additions & 2 deletions js/jquery.terminal-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -4212,6 +4212,7 @@
var have_key = typeof e.key !== 'undefined';
var key = String(e.key).toLowerCase();
var unidentified_key = key === 'unidentified';
var skip_keymap;
// special keys don't trigger keypress fix #293
try {
if (!e.fake) {
Expand Down Expand Up @@ -4249,7 +4250,11 @@
if (!result) {
skip_insert = true;
}
return result;
if (result === true) {
skip_keymap = true;
} else {
return result;
}
}
}
if (shortcut !== prev_shortcut) {
Expand Down Expand Up @@ -4326,6 +4331,10 @@
// this will prevent for instance backspace to go back one page
//skip_keypress = true;
//e.preventDefault();
} else if (skip_keymap && is_function(keymap[shortcut])) {
// when terminal is disabled/paused we only want to prevent
// terminal shortcuts, see: #1005
return false;
}
}
function clear_hold() {
Expand Down Expand Up @@ -9396,7 +9405,9 @@
}
self.resume();
}
return false;
// tell cmd keydown to prevent default only terminal shortcuts
// see #1005
return true;
}
}
}
Expand Down
19 changes: 15 additions & 4 deletions js/jquery.terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Sat, 22 Feb 2025 15:06:30 +0000
* Date: Sat, 22 Feb 2025 15:55:40 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -4212,6 +4212,7 @@
var have_key = typeof e.key !== 'undefined';
var key = String(e.key).toLowerCase();
var unidentified_key = key === 'unidentified';
var skip_keymap;
// special keys don't trigger keypress fix #293
try {
if (!e.fake) {
Expand Down Expand Up @@ -4249,7 +4250,11 @@
if (!result) {
skip_insert = true;
}
return result;
if (result === true) {
skip_keymap = true;
} else {
return result;
}
}
}
if (shortcut !== prev_shortcut) {
Expand Down Expand Up @@ -4326,6 +4331,10 @@
// this will prevent for instance backspace to go back one page
//skip_keypress = true;
//e.preventDefault();
} else if (skip_keymap && is_function(keymap[shortcut])) {
// when terminal is disabled/paused we only want to prevent
// terminal shortcuts, see: #1005
return false;
}
}
function clear_hold() {
Expand Down Expand Up @@ -5439,7 +5448,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Sat, 22 Feb 2025 15:06:30 +0000',
date: 'Sat, 22 Feb 2025 15:55:40 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -9396,7 +9405,9 @@
}
self.resume();
}
return false;
// tell cmd keydown to prevent default only terminal shortcuts
// see #1005
return true;
}
}
}
Expand Down
4 changes: 2 additions & 2 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 f0a61a9

Please sign in to comment.