Skip to content

Commit

Permalink
fix handling long prompt #919
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Apr 9, 2024
1 parent c526ea5 commit 9c07162
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
7 changes: 4 additions & 3 deletions js/jquery.terminal-src.js
Expand Up @@ -3184,7 +3184,8 @@
}
// ---------------------------------------------------------------------
function is_multiline(str) {
return strlen(text(str)) > num_chars - prompt_len - 1 ||
var len = strlen(text(str));
return len > 0 && len > num_chars - prompt_len - 1 ||
str.match(/\n/);
}
// ---------------------------------------------------------------------
Expand Down Expand Up @@ -3516,7 +3517,7 @@
function format_prompt(prompt) {
if (!prompt) {
just_prompt_len = 0;
prompt_len = just_prompt_len + prompt_offset;
prompt_len = prompt_offset;
return prompt;
}
var prompt_marker = get_prompt_marker();
Expand Down Expand Up @@ -3934,8 +3935,8 @@
}
if (num_chars !== new_num_chars || arguments[0] === true) {
num_chars = new_num_chars;
redraw();
draw_prompt();
redraw();
}
return self;
},
Expand Down
11 changes: 6 additions & 5 deletions js/jquery.terminal.js
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Sun, 07 Apr 2024 17:14:01 +0000
* Date: Tue, 09 Apr 2024 18:42:45 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -3184,7 +3184,8 @@
}
// ---------------------------------------------------------------------
function is_multiline(str) {
return strlen(text(str)) > num_chars - prompt_len - 1 ||
var len = strlen(text(str));
return len > 0 && len > num_chars - prompt_len - 1 ||
str.match(/\n/);
}
// ---------------------------------------------------------------------
Expand Down Expand Up @@ -3516,7 +3517,7 @@
function format_prompt(prompt) {
if (!prompt) {
just_prompt_len = 0;
prompt_len = just_prompt_len + prompt_offset;
prompt_len = prompt_offset;
return prompt;
}
var prompt_marker = get_prompt_marker();
Expand Down Expand Up @@ -3934,8 +3935,8 @@
}
if (num_chars !== new_num_chars || arguments[0] === true) {
num_chars = new_num_chars;
redraw();
draw_prompt();
redraw();
}
return self;
},
Expand Down Expand Up @@ -5305,7 +5306,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Sun, 07 Apr 2024 17:14:01 +0000',
date: 'Tue, 09 Apr 2024 18:42:45 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
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 9c07162

Please sign in to comment.