Skip to content

Commit

Permalink
don't complete default commands as argument #465
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Feb 7, 2019
1 parent 4ae2858 commit f60b224
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 24 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## 2.2.0
### Features
* Handle unclosed entities [#462](https://github.com/jcubic/jquery.terminal/issues/462)
### Bugfix
* don't complete default commands as argument [#465](https://github.com/jcubic/jquery.terminal/issues/465)

## 2.1.2
### Bugfix
Expand Down
19 changes: 12 additions & 7 deletions js/jquery.terminal-2.1.2.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* emoji regex v7.0.1 by Mathias Bynens
* MIT license
*
* Date: Sun, 03 Feb 2019 10:47:01 +0000
* Date: Thu, 07 Feb 2019 16:06:55 +0000
*/
/* global location, jQuery, setTimeout, window, global, localStorage, sprintf,
setImmediate, IntersectionObserver, MutationObserver, ResizeObserver,
Expand Down Expand Up @@ -813,6 +813,7 @@
var first = true;
if (window.ResizeObserver) {
resizer = new ResizeObserver(function() {
console.log(arguments);
if (!first) {
resize_handler();
}
Expand Down Expand Up @@ -3459,7 +3460,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Sun, 03 Feb 2019 10:47:01 +0000',
date: 'Thu, 07 Feb 2019 16:06:55 +0000',
// colors from http://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -6808,6 +6809,7 @@
var sensitive = options.caseSensitive;
// cursor can be in the middle of the command
// so we need to get the text before the cursor
var command = self.before_cursor(false);
var string = self.before_cursor(options.word).replace(/\\"/g, '"');
var quote = false;
if (options.word) {
Expand All @@ -6822,11 +6824,14 @@
}
// local copy
commands = commands.slice();
if (settings.clear && $.inArray('clear', commands) === -1) {
commands.push('clear');
}
if (settings.exit && $.inArray('exit', commands) === -1) {
commands.push('exit');
// default commands should not match for arguments
if (!command.match(/\s/)) {
if (settings.clear && $.inArray('clear', commands) === -1) {
commands.push('clear');
}
if (settings.exit && $.inArray('exit', commands) === -1) {
commands.push('exit');
}
}
if (tab_count % 2 === 0) {
command = self.before_cursor(options.word);
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal-2.1.2.min.js

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions js/jquery.terminal-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,7 @@
var first = true;
if (window.ResizeObserver) {
resizer = new ResizeObserver(function() {
console.log(arguments);
if (!first) {
resize_handler();
}
Expand Down Expand Up @@ -6808,6 +6809,7 @@
var sensitive = options.caseSensitive;
// cursor can be in the middle of the command
// so we need to get the text before the cursor
var command = self.before_cursor(false);
var string = self.before_cursor(options.word).replace(/\\"/g, '"');
var quote = false;
if (options.word) {
Expand All @@ -6822,11 +6824,14 @@
}
// local copy
commands = commands.slice();
if (settings.clear && $.inArray('clear', commands) === -1) {
commands.push('clear');
}
if (settings.exit && $.inArray('exit', commands) === -1) {
commands.push('exit');
// default commands should not match for arguments
if (!command.match(/\s/)) {
if (settings.clear && $.inArray('clear', commands) === -1) {
commands.push('clear');
}
if (settings.exit && $.inArray('exit', commands) === -1) {
commands.push('exit');
}
}
if (tab_count % 2 === 0) {
command = self.before_cursor(options.word);
Expand Down
19 changes: 12 additions & 7 deletions js/jquery.terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* emoji regex v7.0.1 by Mathias Bynens
* MIT license
*
* Date: Sun, 03 Feb 2019 10:47:01 +0000
* Date: Thu, 07 Feb 2019 16:06:55 +0000
*/
/* global location, jQuery, setTimeout, window, global, localStorage, sprintf,
setImmediate, IntersectionObserver, MutationObserver, ResizeObserver,
Expand Down Expand Up @@ -813,6 +813,7 @@
var first = true;
if (window.ResizeObserver) {
resizer = new ResizeObserver(function() {
console.log(arguments);
if (!first) {
resize_handler();
}
Expand Down Expand Up @@ -3459,7 +3460,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Sun, 03 Feb 2019 10:47:01 +0000',
date: 'Thu, 07 Feb 2019 16:06:55 +0000',
// colors from http://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -6808,6 +6809,7 @@
var sensitive = options.caseSensitive;
// cursor can be in the middle of the command
// so we need to get the text before the cursor
var command = self.before_cursor(false);
var string = self.before_cursor(options.word).replace(/\\"/g, '"');
var quote = false;
if (options.word) {
Expand All @@ -6822,11 +6824,14 @@
}
// local copy
commands = commands.slice();
if (settings.clear && $.inArray('clear', commands) === -1) {
commands.push('clear');
}
if (settings.exit && $.inArray('exit', commands) === -1) {
commands.push('exit');
// default commands should not match for arguments
if (!command.match(/\s/)) {
if (settings.clear && $.inArray('clear', commands) === -1) {
commands.push('clear');
}
if (settings.exit && $.inArray('exit', commands) === -1) {
commands.push('exit');
}
}
if (tab_count % 2 === 0) {
command = self.before_cursor(options.word);
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 f60b224

Please sign in to comment.