Skip to content

Commit

Permalink
fix keepWord option in echo of last line #497
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Jun 2, 2019
1 parent f5e7690 commit a4a2d28
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 25 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.6.2
### Bugfix
* fix CTRL+C when terminal is not in focus (it should bypass enabled flag only when select text is inside terminal) [#499](https://github.com/jcubic/jquery.terminal/issues/499)
* fix keepWord option in echo of last line [#497](https://github.com/jcubic/jquery.terminal/issues/497)

## 2.6.1
### Bugfix
Expand All @@ -21,7 +22,6 @@
* fix CTR+C when inside of single echo output is selected
* fix paste + key on Mac/Chrome [#493](https://github.com/jcubic/jquery.terminal/issues/493)


## 2.5.1
### Bugfix
* fix 1px black space in style of selection after prism token
Expand Down
13 changes: 6 additions & 7 deletions js/jquery.terminal-2.6.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* emoji regex v7.0.1 by Mathias Bynens
* MIT license
*
* Date: Sun, 02 Jun 2019 13:01:27 +0000
* Date: Sun, 02 Jun 2019 14:09:48 +0000
*/
/* global location, setTimeout, window, global, sprintf, setImmediate,
IntersectionObserver, ResizeObserver, module, require, define,
Expand Down Expand Up @@ -3905,7 +3905,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Sun, 02 Jun 2019 13:01:27 +0000',
date: 'Sun, 02 Jun 2019 14:09:48 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -4329,12 +4329,11 @@
// TODO: this need work
if (keep_words && data.space !== -1) {
// replace html entities with characters
var stripped = text(line).slice(data.space_count);
var stripped = text(line).substring(data.space_count);
// real length, not counting formatting
var text_len = stripped.length;
var limit = data.count + length + 1;
stripped = stripped.slice(0, limit).trim();
if (stripped.match(/\s/) || limit < text_len) {
stripped = stripped.slice(0, length).trim();
var text_len = strlen(stripped);
if (stripped.match(/\s/) || text_len < length) {
can_break = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal-2.6.1.min.js

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions js/jquery.terminal-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -4329,12 +4329,11 @@
// TODO: this need work
if (keep_words && data.space !== -1) {
// replace html entities with characters
var stripped = text(line).slice(data.space_count);
var stripped = text(line).substring(data.space_count);
// real length, not counting formatting
var text_len = stripped.length;
var limit = data.count + length + 1;
stripped = stripped.slice(0, limit).trim();
if (stripped.match(/\s/) || limit < text_len) {
stripped = stripped.slice(0, length).trim();
var text_len = strlen(stripped);
if (stripped.match(/\s/) || text_len < length) {
can_break = true;
}
}
Expand Down
13 changes: 6 additions & 7 deletions js/jquery.terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* emoji regex v7.0.1 by Mathias Bynens
* MIT license
*
* Date: Sun, 02 Jun 2019 13:01:27 +0000
* Date: Sun, 02 Jun 2019 14:09:48 +0000
*/
/* global location, setTimeout, window, global, sprintf, setImmediate,
IntersectionObserver, ResizeObserver, module, require, define,
Expand Down Expand Up @@ -3905,7 +3905,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Sun, 02 Jun 2019 13:01:27 +0000',
date: 'Sun, 02 Jun 2019 14:09:48 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -4329,12 +4329,11 @@
// TODO: this need work
if (keep_words && data.space !== -1) {
// replace html entities with characters
var stripped = text(line).slice(data.space_count);
var stripped = text(line).substring(data.space_count);
// real length, not counting formatting
var text_len = stripped.length;
var limit = data.count + length + 1;
stripped = stripped.slice(0, limit).trim();
if (stripped.match(/\s/) || limit < text_len) {
stripped = stripped.slice(0, length).trim();
var text_len = strlen(stripped);
if (stripped.match(/\s/) || text_len < length) {
can_break = 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 a4a2d28

Please sign in to comment.