Skip to content

Commit d6f4ed8

Browse files
committed
fix exception when cmd fit the width of the terminal #1026
1 parent b74b093 commit d6f4ed8

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![npm](https://img.shields.io/badge/npm-DEV-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
99
![bower](https://img.shields.io/badge/bower-DEV-yellow.svg)
1010
[![Build and test](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml/badge.svg?branch=devel&event=push)](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml)
11-
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&cf31f8d07b83a900b429078810ab1c5e)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
11+
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&e1634d1f9a832d04e5a48e61b1f2fa0c)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
1212
![NPM Downloads](https://img.shields.io/npm/dm/jquery.terminal.svg?style=flat)
1313
[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/jquery.terminal/badge?style=rounded&n=1)](https://www.jsdelivr.com/package/npm/jquery.terminal)
1414
[![Paid Support](https://img.shields.io/badge/paid-support-354465.svg)](https://support.jcubic.pl/)

js/jquery.terminal-src.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2864,7 +2864,11 @@
28642864
var lines = simple_split_command_line(command);
28652865
prev = lines[line - 1];
28662866
// line don't exist, line fit the width and cursor at 0 #1026
2867-
var left_over = lines[line].substring(col).length;
2867+
if (line === lines.length) {
2868+
left_over = 0;
2869+
} else {
2870+
left_over = lines[line].substring(col).length;
2871+
}
28682872
var diff;
28692873
if (left_over > 0) {
28702874
diff = col;

js/jquery.terminal.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
*
4242
* broken image by Sophia Bai from the Noun Project (CC-BY)
4343
*
44-
* Date: Sun, 04 Jan 2026 11:32:30 +0000
44+
* Date: Sun, 04 Jan 2026 14:36:18 +0000
4545
*/
4646
/* global define, Map, BigInt */
4747
/* eslint-disable */
@@ -2864,7 +2864,11 @@
28642864
var lines = simple_split_command_line(command);
28652865
prev = lines[line - 1];
28662866
// line don't exist, line fit the width and cursor at 0 #1026
2867-
var left_over = lines[line].substring(col).length;
2867+
if (line === lines.length) {
2868+
left_over = 0;
2869+
} else {
2870+
left_over = lines[line].substring(col).length;
2871+
}
28682872
var diff;
28692873
if (left_over > 0) {
28702874
diff = col;
@@ -5491,7 +5495,7 @@
54915495
// -------------------------------------------------------------------------
54925496
$.terminal = {
54935497
version: 'DEV',
5494-
date: 'Sun, 04 Jan 2026 11:32:30 +0000',
5498+
date: 'Sun, 04 Jan 2026 14:36:18 +0000',
54955499
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
54965500
color_names: [
54975501
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',

js/jquery.terminal.min.js

Lines changed: 2 additions & 2 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)