jQuery Command Line Interpreter Plugin - Terminal Emulator

jQuery Command Line Interpreter Plugin - Terminal Emulator
File Size: 949 KB
Views Total: 12846
Last Update:
Publish Date:
Official Website: Go to website
License: MIT

A simple jQuery based terminal emulator that makes it easy to create command line interpreter for your website or web application.

Command Line Interpreter is a blanket term for a certain class of programs designed to read lines of text entered by a user, thus implementing a command-line interface.(More info about Command Line Interpreter on WIKI). 

Licensed under GNU LGPL Version 3 license.

You might also like:

Main Features:

  • Automatically call JSON-RPC service.
  • You can provide your own function in which you can parse user command.
  • Command Tree supported
  • Command line history supported
  • Tab completion supported
  • Keyboard shortcut like CTRL+A, CTRL+D, CTRL+E etc, supported
  • Authentication supported
  • Multiple Command Line Interpreters on one page supported


$ npm install jquery.terminal

# Bower
$ bower install jquery.terminal

Basic Usage:

1. Include jQuery JavaScript library and the terminal emulator plugin's files on your page.

<link href="css/jquery.terminal.min.css" rel="stylesheet" />
<script src="/path/to/cdn/jquery.min.js"></script>
<script src="js/jquery.terminal.min.js"></script>

2. Or from a CDN.

<link href="https://unpkg.com/jquery.terminal/css/jquery.terminal.min.css" rel="stylesheet" />
<script src="https://unpkg.com/jquery.terminal/js/jquery.terminal.min.js"></script>

3. Include the Mouse Wheel plugin for the mousewheel support (for legacy browsers).

<script src="/path/to/jquery.mousewheel-min.js"></script>

4. Include the optional polyfills for legacy browsers.

<script src="https://unpkg.com/[email protected]/keyboard.js"></script>

5. Include optional extensions as per your needs.

  • ascii_table.js: renders simple ascii table, like the one from mysql cli tool
  • autocomplete_menu.js: create autocomplete menu in Terminal
  • dterm.js: jQuery UI dialog extension for Terminal
  • echo_newline.js: add newlinew option for echo method inside Terminal
  • emoji.js: add support for emoji
  • less.js: create less like command in Terminal
  • pipe.js: add pipe operator and redirects to commands
  • prism.js: formatter to be used with PrismJS
  • unix_formatting.js: convert UNIX ANSI escapes to terminal and display them as html
  • xml_formatting.js: allow to use xml like syntax with colors as tags
<script src="js/ascii_table.js"></script>
<script src="js/autocomplete_menu.js"></script>
<script src="js/dterm.js"></script>
<script src="js/echo_newline.js"></script>
<script src="js/emoji.js"></script>
<script src="js/less.js"></script>
<script src="js/pipe.js"></script>
<script src="js/prism.js"></script>
<script src="js/unix_formatting.js"></script>
<script src="js/xml_formatting.js"></script>

6. Create an element for the terminal and generate a basic terminal using the following JS codes.

<div id="example"></div>
jQuery(function($, undefined) {
  $('#example').terminal(function(command) {
      if (command !== '') {
          try {
              var result = window.eval(command);
              if (result !== undefined) {
                  this.echo(new String(result));
          } catch(e) {
              this.error(new String(e));
      } else {
  }, {
     // options here

7. Config the terminal with the following options and callbacks.

// you can set it to string or function with one parameter which is callback that must be called with string for your prompt (you can use ajax call to get prompt from the server
prompt: '> ',

// whether or not to store commands
history: true,

// if this option is set to false it don't use CTRL+D to exit from terminal and don't include 'exit' command
exit: true,

// whether or not to include 'clear' command
clear: true,

// enable/disable terminal
enabled: true,

// mask character
maskChar: '*',

// if set to false terminal will not wrap long lines (it can be overwritten by echo option)
wrap: true,

// if set to true it will check number of arguments in functions and in JSON-RPC if service return system.describe
checkArity: true,

// it will allow to display raw html
raw: false,

// tab index
tabindex: 1,

// enable using terminal and cmd methods in extended commands of echo
invokeMethods: false,

// executed instead of default print exception on terminal.
exceptionHandler: null,

// if set to false keypress, keydown and keymap will be executed when terminal is paused
pauseEvents: true,

// if set to true it will not hide command line when paused, usefull if you want to have progress animation using propmt
softPause: false,

// use localStorage nor Cookies and save everything in memory only
memory: false,

// cancelable AJAX requests
cancelableAjax: true,

// if set to true it will process arguments when using an object (replace regex with real regex object number with numbers and process escape characters in double quoted strings - like \x1b \033 will be Escape for ANSI codes) - default true
// if you pass function you can parse command line by yourself - it have one argument with string without name of the function and you need to return an array.
processArguments: true,

// whether or not to set noreferrer on links
linksNoReferrer: false,

// enable to enter links other than ftp or http(s) in echo
anyLinks: false,

// add nofolllow attribute to links
linksNoFollow: false,

// callback function that will be use with any result returned by JSON-RPC. So you can create better handler
processRPCResponse: null,

completionEscape: true,

// convert urls to tags
convertLinks: true,

// if set to true it will delete word when you hold key that should delete character e.g. delete or backspace key
mobileDelete: true,

// properties of this object are added to main interpreter 
extra: {},

// tab size
tabs: 4,

// used if you want to distinguish two or more terminals on one page or on one server
// if name them differently they will have different history and authentication
name: '',

// fixed number of rows and cols
numChars: null,
numRows: null,

// size of the history
historySize: 60,
scrollObject: null,

// whether or not to record all commands in url hash.
historyState: false,

// whether or not to import history in import_view exported by export_view
importHistory: false,

// if you return false in this function command will not be added into history.
historyFilter: null,

// if set to false terminal will not echo command you enter with prompt
echoCommand: true,

// indicate if terminals should scroll to bottom on echo or flush
// if set to false it will scroll to bottom if terminal was at the bottom
scrollOnEcho: true,

// can be function, string or boolean. 
// Function must have 3 arguments login password and callback which must be called with token (if login and password match) or falsy value (if authentication fail). 
// If interpreter is string with valid URI JSON-RPC service you can set login option to true (it will use login remote method) or name of RPC method. this in login function is terminal object.
login: null,

// If non negative it will limit the printing lines on terminal. 
If set to 0 it will print only lines that fit on one page (it will not create scrollbar if it's enabled). 
outputLimit: -1,

// formatters
formatters: [$.terminal.nested_formatting],

// enable image paste
pasteImage: true,

// indicate offset from bottom in which terminal will consider at bottom of the terminal
scrollBottomOffset: 20,

// if set to false it will autocomplete whole command before cursor, default set to true to autocomplete only word.
wordAutocomplete: true,
caseSensitiveAutocomplete: true,
caseSensitiveSearch: true,

// timeout in milliseconds
clickTimeout: 200,
holdTimeout: 400,
holdRepeatTimeout: 200,

repeatTimeoutKeys: ['HOLD+BACKSPACE'],
mobileIngoreAutoSpace: [],

// function executed when you press tab twice and there are more then one completion. 
// The function have 3 arguments completing string, array of completions and echo_command function. 
// If you pass false it will disable double tab.
doubleTab: null,

doubleTabEchoCommand: false,

// function with a callback that need to be executed with list of commands for tab completion (you need to pass array of commands to callback function)
// you can also use true (it will take completion from object or RPC, if it have system.describe, as interpreter) or array if you know what your commands are and don't need to call ajax to get them
completion: false,

// object where keys are uppercase shortcuts like CTRL+ALT+C and value is function execute on that shortcut
// the order of modifiers is CTRL, META, SHIFT, ALT
keymap: {},

request: $.noop, // parameters: jxhr, terminal, request
response: $.noop, // parameters: jxhr, terminal, response
processRPCResponse: null,
// It should be dot separated string that point to filed that have list of procedures, if you have normal JSON-RPC method you can use "result" or "result.procs". 
// It can be empty string it that case response will be taken as array of procedures. If the value is set to false it will not call system.describe method,
describe: 'procs',
keypress: $.noop,
keydown: $.noop,

// allowed attributes
allowedAttributes: ['title', /^aria-/, 'id', /^data-/],

// custom render handler
renderHandler: null,

// callbacks
onAfterCommand: $.noop, // parameter: command
onAfterLogout: $.noop, 
onAjaxError: null, // parameters: xhr, status, error
onBeforeCommand: $.noop, // parameter: command
onBeforeLogin: $.noop, , // parameter: terminal
onBeforeLogout: $.noop, 
onBeforeLogin: null,
onAfterLoginL null,
onBeforeEcho: null,
onAfterEcho: null,
onCommandNotFound: $.noop, // parameters: command, terminal
onInit: $.noop, // parameter: terminal
onClear: $.noop,
onBlur: $.noop,
onPause: $.noop,
onFocus: $.noop, // parameter: terminal
onTerminalChange: $.noop,
onExit: $.noop, // parameter: command
onResize: $.noop, // parameter: terminal
onResume: $.noop,
onExport: $.noop,
onImport: $.noop,
onPush: $.noop,
onPop: $.noop,
onRPCError: null,
onAfterRedraw: $.noop,
onEchoCommand: $.noop,
onCommandChange: null, // parameters: command, terminal
onPositionChange: null, // parameters: command, terminal
onFlush: $.noop,

// custom strings
strings: {
  comletionParameters: 'From version 1.0.0 completion function need to' +
      ' have two arguments',
  wrongPasswordTryAgain: 'Wrong password try again!',
  wrongPassword: 'Wrong password!',
  ajaxAbortError: 'Error while aborting ajax call!',
  wrongArity: "Wrong number of arguments. Function '%s' expects %s got" +
      ' %s!',
  commandNotFound: "Command '%s' Not Found!",
  oneRPCWithIgnore: 'You can use only one rpc with describe == false ' +
      'or rpc without system.describe',
  oneInterpreterFunction: "You can't use more than one function (rpc " +
      'without system.describe or with option describe == false count' +
       's as one)',
  loginFunctionMissing: "You didn't specify a login function",
  noTokenError: 'Access denied (no token)',
  serverResponse: 'Server responded',
  wrongGreetings: 'Wrong value of greetings parameter',
  notWhileLogin: "You can't call `%s' function while in login",
  loginIsNotAFunction: 'Authenticate must be a function',
  canExitError: "You can't exit from main interpreter",
  invalidCompletion: 'Invalid completion',
  invalidSelector: 'Sorry, but terminal said that you use invalid ' +
  invalidTerminalId: 'Invalid Terminal ID',
  login: 'login',
  password: 'password',
  recursiveCall: 'Recursive call detected, skip',
  notAString: '%s function: argument is not a string',
  redrawError: 'Internal error, wrong position in cmd redraw',
  invalidStrings: 'Command %s have unclosed strings',
  defunctTerminal: "You can't call method on terminal that was destroyed"

6. API methods.

// autologin if you get username and token in other way, like in sysend event.
instance.autologin([username, token])

// gets the string before the cursor

// if you pass string it will set name of the command line (name is use for tracking command line history) or if you call without argument it will return name.

// clears the terminal

// clears saved history state

// returns instance of history object.

// sets command line (optional parameter is is set to true will not change cursor position)
instance.set(string, [bool])

// inserts string to command line in place of the cursor if second argument is set to true it will not change position of the cursor
instance.insert(string, [bool])

// returns current command.

// returns number of characters and number of lines of the terminal

// utomplete text based on array
instance.complete([array, options])

// sets or gets function that will be called when user hit enter.

// destroy the plugin

// moves virtual cursor to specied position or relative to curent position if second argument is true
instance.display_position([number], [boolean])

// sets prompt to function or string
// if called without argument it will return current prompt

// sets or gets position of the cursor

// sets numbers of characters

// if argument is true it will mask all typed characters with provided string
// if called without argument it will return current mask.

// displays string on terminal
instance.echo([string|function], [options])

// enable/disable the terminal

// displayes error string

// displays exception with stack trace on terminal 
instance.exception(Error, [Label])

// Executes command that like you where type it into terminal (it will execute user defined function). 
// second argument is optional if set to true, it will not display prompt and command that you execute. 
// If you want to have proper timing of executed function when commands are asynchronous (use ajax) then you need to call pause and resume (make sure that you call pause before ajax call and resume as last in ajax response).
instance.exec([string, bool])

// return object that can be use to restore the view using import_view.

// if you echo using option flush: false (it will not display text immediately) then you can send that text to the terminal output using this function.

// it will activate next terminal if argument is false or disable previous terminal and activate current one

// disable/enable terminal that can't be enabled by clicking on terminal, frozen check if terminal has been frozen by freeze command.

// get current command

// return string contains whatever was print on terminal, if argument is set to true it will return raw lines data.

// get current prompt

// same as token().

// return command line History object

// disable or enable history sate save in hash. You can create commads that will start or stop the recording of commands, the commands itself will not be recorded.

// restore the view of the terminal using object returned prevoiusly by export_view.

// insert text in cursor position.

// invoke shortcut, terminal.invoke_key('CTRL+L') will clear terminal.

// return true if terminal scroll is at the bottom. It use scrollBottomOffset option to calculate how much from bottom it will consider at bottom.

// return index of last line that can be use with update method after you echo something and you lost the reference using -1

// return how deeply nested in interpreters you correctly in (It start from 1).

// Execute login function the same as login option but first argument need to be a function. 
// The function will be called with 3 arguments, user, password and a function that need to be called with truthy value that will be stored as token. 
// Each interpreter can have it's own login function (you will need call push function and then login. 
// The token will be stored localy, you can get it passing true to token function. 
// Second argument indicate if terminal should ask for login and password infinitely.
instance.login([function(user, password, callback), boolean])

// return login name which was use in authentication. This is set to null if there is no login option.

// if you use authentication it will logout from terminal. If you don't set login option this function will throw exception.

// return name of the interpreter.

// if you have more then one terminal instance it will switch to next terminal (in order of creation) and return reference to that terminal.

// If your command will take some time to compute (like in AJAX call) you can pause terminal (terminal will be disable and command line will be hidden) and resume it in AJAX response is called. (if you want proper timing when call exec on array of commands you need to use those functions). 
// From version 0.11.1 pause accept optional boolean argument that indicate if command line should be visible (this can be used with animation).

// return true if terminal is paused.

// remove current interpreter from the stack and run previous one.

// return name that is used for localStorage keys, if argument is true it will return name of local interpreter (added by push() method).

// remove all local storage left by terminal. 
// It will act like logout because it will remove login and token from local storage but you will not be logout until you refresh the page.

// Push next interpreter on the stack and call that interpreter. 
// First argument is new interpreter (the same as first argument to terminal). 
// The second argument is a list of options as folow:
// name — to distinguish interpreters using command line history.
// prompt — new prompt for this terminal.
// onExit — callback function called on Exit.
// onStart — callback function called on Start.
// keydown — interpreter keydown event.
// historyFilter — the same as in terminal in next version.
// completion — the same as in terminal.
// login — same as login main option or calling login method after push.
// keymap — same as keymap in terminal.
// mousewheel — interpreter based mousewheel handler.
// infiniteLogin — if set to true it will ask infinetly for username and password if login is set.
instance.push([string|function], {object}) 

// wrapper over push, it set prompt to string and wait for text from user then call user function with entered string. 
// The function also return a promise that can be used interchangeably with callback functions. from version 1.16.0 read disable history.
instance.read([string, success_fn, cancel_fn])

// reset the terminal

// resize the terminal
instance.resize([width, height]

// save current state of the terminal and update the hash
// if second argument is true it will not update hash.
instance.save_state([command, boolean])

// scroll the terminal

// scroll the terminal to the bottom

// set command

// override the current interpreter.
instance.set_interpreter([interpreter, login])

// toogle mask of command line if argument is true it will use maskChar as mask.

// change the prompt

// set prompt

// update token
instance.set_token([string, boolean])

// return settings object

// return JQuery Singature depending on size of terminal.

// return token which was set in authentication process or by calling login function. 
// This is set to null if there is no login option. If you pass true as an argument you will have local token for the interpreter (created using push function) it will return null if that interpreter don't have token.

// update line with specified number with given string. The line number can be negative (-1 will change last line) the lines are indexed from 0.
instance.update(line, string)

More Examples:


v2.17.5 (2020-07-05)

  • fix eating last bracket from split_equal
  • fix false positive recursive echo error

v2.17.3/4 (2020-07-01)

  • fix jumping on right click near bottom and/or right edge when terminal is not full screen
  • fix double event fire on right mouse click
  • fix scrollbar size in Chrome
  • fix for font-family wildcard css rule
  • fix cursor on scrollbar
  • fix broken html with wide characters without formatting
  • fix jumping to address bar on CTRL+L
  • fix issue in less when only one image get rendered
  • fix jumping on focus on mobile when terminal content scrolled down
  • fix detecting iPad iOS 13as mobile
  • fix return false from onPaste to disable insert from clipboard
  • fix paste in command mode of less plugin
  • fix jumping when click near bottom and/or right edge

v2.17.2 (2020-06-12)

  • fix cursor on strings in prism

v2.17.1 (2020-06-01)

  • fix regressions in text selection, cursor and CSS variables
  • unify selection on font icons (fontawesome) and emoji

v2.16.1 (2020-05-23)

  • fix disappearing cursor when use up down arrow in multi line CMD
  • fix broken color CSS variables
  • fix swallowed escape bracket as input in CMD

v2.16.0 (2020-05-16)

  • style of scrollbars in WebKit
  • integration with fontawesome icons added using formatting
  • bugfix

v2.15.4 (2020-04-18)

  • fix jumping when you scrolled down the div terminal

v2.15.3 (2020-04-17)

  • fix broken formatting in prism.js when processing brackets

v2.15.2 (2020-03-21)

  • fix toggle keyboard on multiple terminals on same page
  • fix jumping to prompt on press CTRL+C when terminal scrolled to top
  • don't scroll to bottom when click on terminal that already in focus

v2.15.1 (2020-03-16)

  • add new API event touchscroll for mobile (use it in less)
  • mobile paste
  • cmd::clip API method used internally, mostly for mobile
  • bugs fixed

v2.14.1 (2020-02-24)

  • fix empty rows size

v2.14.0 (2020-02-18)

  • Allow to return promise from renderHandler
  • Allow to extend the ansiParser in unix_formatting
  • Add a way to to handle Sixel terminal image format
  • Improve performance of cmd render when moving cursor
  • Implement H cursor movement #553
  • Unix formatting ANSI character replacements modes
  • Bugfixed

v2.12.0 (2019-12-23)

  • improve performance
  • add cache for formatting and processing lines
  • big improvements to less plugin re-rendering (e.g. when scrolling text with keyboard)
  • cursor movement in unix formatting (virtual cursor not supported in cmd, because it make no sense)
  • fix empty lines in less
  • fix split_equal with keep works and formatting at the end.
  • fix searching inside links in less

v2.10.1 (2019-12-23)

  • fix glow effect of prompt when it don't have formatting
  • fix exec commands from echo
  • fix echo formatting with newline and bracket at the end
  • fix single wide character exception
  • fix substring after string when string have bracket at the end
  • fix images & style from formatters inside cmd

v2.10.0 (2019-12-19)

  • improve performance by adding function $.terminal.partition
  • allow to use force resize cmd::resize(true) (to update init command line with emoji)
  • add glow style
  • Bugfix

v2.9.0 (2019-08-30)

  • allow to return a promise from greetings function
  • call onClear before clear and allow to cancel
  • new renderHandler option
  • allow to echo DOM nodes and jQuery objects
  • handle broken images in terminal and less (svg and error message respectively)
  • terminal have terminal-less class when less runs
  • pipe extension monkey patch terminal like echo newline, and it allow to use standard interpreter (old API work the same).
  • Bugfix

v2.8.0 (2019-08-30)

  • new events onBeforeLogin, onAfterLogin, onBeforeEcho and onAfterEcho
  • inherit of style in nesting formatter (with flag __inherit__ = true on nested_formatting)
  • image formatting
  • new echo_command API method (for echo_newline default action)
  • mobile delete disabled by default + option toggle
  • fix Emoji
  • fix nesting with prism formatter

v2.7.1 (2019-08-14)

  • fix invoking methods by typing it into terminal
  • don't remove extended command when using echo with exec: false

v2.7.0 (2019-08-11)

  • All classes are prefixed with cmd or terminal except .token (PrimsJS internals) and .emoji (this may be feature that fix some bugs, that also may break user code - but it's internal html structure and it's not documented as API)
  • Fix issue with space in IE and Edge #507
  • Fixed multiple bracket escaping issues

v2.6.3 (2019-06-03)

  • fix mobile keypress invocation when no keypress (Android)
  • fix sizing issue with underscores

v2.6.2 (2019-06-03)

  • fix CTRL+C when terminal is not in focus (it should bypass enabled flag only when select text is inside terminal)
  • fix keepWord option in echo of last line
  • fix broken formatting in Prism

v2.6.1 (2019-05-27)

  • fix sourcemaps
  • fix prism + --size
  • fix echo double slashes
  • escape options to $.terminal.format (default to true - same behavior) to fix previous error

v2.5.2 (2019-05-18)

  • fix CTR+C when inside of single echo output is selected
  • fix paste + key on Mac/Chrome

v2.5.1 (2019-05-17)

  • fix 1px black space in style of selection after prism token
  • additional validate instead of just throw and capture JSON errors in format function (devtools improvement)
  • fix typescript types for version 3.3.29 and freeze the version

v2.5.0 (2019-05-08)

  • Better API option doubleTabEchoCommand so you don't need to call echo_command() function in doubleTab.
  • new API Cmd::column(boolean): number
  • moving cursor up down in multiline command (like in Chrome Dev tools)
  • More bugs fixed

v2.4.1 (2019-04-19)

  • fix show terminal content after it's resized when initially not visible (fix jumping of text)
  • fix pipe when using read + echo in first command and read in next
  • fix issue with jumping of terminal on keypress
  • fix hold key when key change fast (manifested by jumping to address bar on ALT+D)
  • fix scroll page when terminal don't have scrollbar #484
  • fix issue with call .complete(['cd']); because of default "clear" (moved code outside of complete)
  • fix Prism formatter when highlighted code have brackets
  • fix few async prompt issues including

v2.4.0 (2019-04-14)

  • improvements to performance of rendering and navigating longer command lines
  • CTRL+C now retain newlines inside cmd and terminal output (modern browsers only)
  • more control over server side calls by using invokeMethods option in echo
  • warn users when they try to complete commands with newlines and word complete is set
  • bugfix

v2.3.0 (2019-04-06)

  • add experimental $.terminal.pipe function
  • allow to return string from onPaste (not only a promise)
  • add CTRL+Home and CTRL+End keys + HOME and END move cursor to the end and beginning of the line
  • zoom page when using mousewheel + CTRL key (browser default)
  • allow to set attributes from formatting with filtering options (to prevent unwanted onclick or other attrs by echo untrusted text)
  • bugfix

v2.1.2 (2019-02-10)

  • bugfix

v2.1.1 (2019-01-27)

  • bugfix

v2.1.0 (2019-01-21)

  • cursor glow animation
  • add invoke_key to cmd
  • onPaste event
  • integrate emoji into terminal
  • fix wrapping when command have & and ; but it's not entity
  • fix wrapping when css style created using id
  • fix calculating number of characters on init in bare cmd
  • fix .inverted class
  • fix background color on selection (when using --color)
  • fix hidden bar cursor when command is empty
  • fix copy terminal output to clipboard (newlines issue)
  • remove weird space between lines of selection
  • fix jumping of cursor with underline animation
  • fix selection of command line
  • fix error color when --color is used
  • fix ANSI art issue

v2.0.2 (2018-12-23)

  • fix ansi escapes in unix formatting for sequence 5;1;47m that fixes rendering ANSI art
  • fix cutting of underline from ASCII art
  • fix cutting ASCII art underscores in Codepen/Linux/Chromium on GNU/LINUX
  • fix ascii_table when text have \r
  • fix prism highlighting in echo (terminal rules were stronger than Prism)

v2.0.1 (2018-11-18)

  • new option repeatTimeoutKeys with default of HOLD+BACKSPACE that should have delay when deleting words
  • use setTimeout instead of alert to show exception that can be shown in terminal
  • allow to move cursor when regex formatter don't change length of the string
  • don't style links if they don't have href
  • new plugin isFullyInViewport (link to source in comment)
  • scroll terminal to always view cursor in multiline command
  • add onPositionChange to option to terminal
  • add tabindex option to cmd and terminal
  • bugfixes

v1.23.2 (2018-10-21)

  • New options & Bugfixes.

v1.23.2 (2018-09-19)

  • fix too tall cursor (blink included underline)

v1.23.1 (2018-09-18)

  • ES6 iterator helper that iterate over string that handle formatting, emoji and extra chars
  • Bugfixes

v1.22.7 (2018-09-14)

  • fix selection of command line
  • fix issue with \r in command line and cursor position
  • fix underline and bar animation after fix for prism
  • disable selecting artificial last character in line for cmd
  • fix cursor animation on background for toggle animation dynamically

v1.22.4 (2018-09-13)

  • fix cursor in prism when on token in next line
  • reverse css animations so the prompt is visible when you hold key

v1.22.2 (2018-09-11)

  • reverse css animations so the prompt is visible when you hold key
  • persistent function prompt don't render on enable and on init
  • fix duplicated line when prompt have more then one line
  • iterate_formatting to handle emoji like substring and split_equal

v1.22.0 (2018-09-09)

  • add sourcemaps to min js and css files
  • new option holdRepeatTimeout - which is number of the delay between keypress repeat when holding key
  • selection to change background color based on formatting like in Bash
  • embed emoji regex by Mathias Bynens for better emoji detection
  • allow to execute extended commands including terminal and cmd methods from formatters
  • support for true colors (24bit) in unix formatting
  • expose split_characters in $.terminal namespace
  • cmd commands option functions to have cmd as this context
  • Bugfixes

v1.21.0 (2018-08-21)

  • add option invokeMethods that disable by default executing terminal and cmd methods from echo
  • HOLD keymap modifier + HOLD+[SHIFT]+BACKSPACE/DELETE to delete word before and after the cursor
  • align tabs like in unix terminal
  • tabs terminal options change tab length, not only columns/arrays
  • add tabs option for cmd
  • improve performance of display_position (when you click on character in long command that change length)
  • Bugfix: fix &) in scheme prism formatting
  • Bugfix: don't process keys other then enter in reverse search
  • Bugfix: fix issue with background in Prismjs css
  • Bugfix: insert prism syntax formatter before nested formatting so it work for html if included with unix_formatting
  • Bugfix: fix emoji and Unicode surrogate pairs

v1.20.5 (2018-08-21)

  • bugfix

v1.20.2 (2018-08-20)

  • escape formatting when using unix formatting in cmd
  • fix cursor on links
  • one more fix cursor position

v1.19.1 (2018-07-24)

  • fix type definition to match types from @types/jquery
  • fix infinite loop in regex formatter with loop option

v1.19.0 (2018-07-22)

  • add TypeScript definition file
  • update formatters API to have a way to return position after replace from function formatter
  • regex formatters and $.tracking_replace now accept function as replacement
  • update unix formatters to use new API so they work with command line
  • set exit to false if no login provided
  • bugfixed

v1.18.0 (2018-07-08)

  • looping regex formatters that replace until they don't match the regex
  • add tracking_replace to $.terminal namespace
  • $.terminal.syntax helper
  • new language for prism: "website" that handle html, javascript and css syntax
  • bugfix

v1.17.0 (2018-07-02)

  • add ascii_table utility in separated file
  • per user command line history
  • add $.terminal.parse_options which return same object as yargs parser
  • $.jrpc helper now return its own created promise instead of $.ajax
  • add wcwidth as dependency so it will always show wider characters correctly (in browsers will work the same as optional)
  • expose terminal exception in $.terminal namespace
  • new API option doubleTab
  • Bugfix

v1.16.1 (2018-06-05)

  • fix paste/select all when click below .cmd
  • second fix to jumping on right click (context menu)
  • change $.terminal.prism_formatting to $.terminal.prism

v1.16.0 (2018-06-03)

  • allow to have limited import when export is save and restored from JSON
  • add support for new u and s regex flags when parsing commands
  • add less plugin based on the one from leash
  • supports for promises returned from completion function
  • add prism.js file that include monkey patch for PrismJS library (for syntax highlight) to output terminal formatting
  • better read method
  • handle promises returned from login and async login function
  • add history option for push for easy disabling history for new interpreter
  • add scrollObject option, so you can use body when terminal is on full screen div without height
  • fix resizer in Firefox
  • fix $.terminal.columns and echo array
  • fix $.terminal.columns for wider characters and terminal formatting
  • fix rows() when using --size
  • fix null in JSON hash
  • fix jumping on right click (context menu)
  • fix formatting inside brackets
  • fix async interpreter
  • use window resize when terminal added to body

v1.15.0 (2018-05-13)

  • allow to invoke terminal and cmd methods from extended commands ([[ terminal::set_prompt(">>> ") ]])
  • new API method invoke_key that allow to invoke shortcut terminal.invoke_key('CTRL+L') will clear the terminal
  • shift+backspace now do the same thing as backspace
  • bugfix

v1.14.0 (2018-03-25)

  • pass options to formatters and accept option unixFormattingEscapeBrackets in unix_formatting 
  • improve performance of repaint and layout whole page when changing content of the terminal
  • use ch unit for wide characters if browser support it (it have wide support then css variables)
  • keymap terminal method and allow to set shortcuts on runtime
  • fix newline as first character in formatting
  • fix error when echo undefined (it will echo string undefined since it's converted to string)
  • fix first argument to keymap function, it's now keypress event
  • fix resizing issue when scrollbar appear/disappear while you type
  • fix cut of cursor when command line had full length lines and it was at the end

v1.12.1 (2018-03-10)

  • fix minified css file + fix scrollbar
  • Revert "Fix for fields wrapped in a label"

v1.12.0 (2018-03-03)

  • default options for cmd plugin
  • caseSensitiveSearch option for both terminal and cmd plugins
  • bugfixes

v1.11.4 (2018-01-28)

  • handle non string and functions in error the same as in echo
  • fix selection for raw output
  • hide font resizer so you actually can select text starting from top left

v1.11.2 (2017-12-28)

  • fix issue with --char-width == 0 if terminal have display:none
  • fix DELETE numpad key on IE
  • ignore invalid procedures description in system.describe
  • fix font resizer and init resizers when terminal hidden initialy
  • fix broken wrapping in new feature of updating divs on resize

v1.11.1 (2017-12-26)

  • fix IE inconsistency in key property for numpad calc keys
  • fix completion skipping letters
  • fix issue with last character in line being closing bracket

v1.11.0 (2017-11-09)

  • update API method accept options 3rd argument
  • speed up refresh on resize by checking character size in font resizer (reported by @artursOs)
  • change command line num chars on resize + settings.numChars (reported by @artursOs #353)
  • add remove api method that call update(line, null);
  • don't call scroll to bottom on resize/refresh/update/remove
  • improve scroll_element plugin by using document.scrollingElement if present and cache the value
  • resizer plugin use ResizeObserver if defined
  • remove fake call to finalize in echo to catch potential error
  • silent boolean 3rd argument to cmd::set and 2nd to terminal::set_command
  • handy classed to change cursor animation in IE
  • bugfixes

v1.10.0 (2017-11-09)

  • fix scroll to bottom on scrolling when terminal is disabled

v1.10.0 (2017-11-08)

  • new api for formatters Array with 2 elements regex and replacement string (it fix issue when formatters change length of string - emoji demo)
  • normalize IE key property for keymap + always use +SPACEBAR if there is any control key
  • cursor text for terminal and cmd
  • onEchoCommand callback gets second argument command
  • cmd keymap api function, along with object and no arguments, accept string as first argument and function as second
  • only one exception per callback event
  • select all context menu (based on idea from CodeMirror)
  • bugfix

v1.9.0 (2017-10-10)

  • new api utils $.terminal.length and $.terminal.columns
  • echo array (resizable in columns that fit the width, using settings.tabs as pad right)
  • callback function parseObject that's called on object different then string (on render)
  • calling option method with numRows or numChars redraw terminal output (for testing)
  • onFlush callback (called when text is rendered on screen in flush method)
  • regex helper $.terminal.formatter created using Symbols can be use instead of regex
  • new option pasteImage (default true)
  • CTRL+C cancel command like in bash if no selection
  • refresh API method
  • new api method display_position in cmd plugin that return corrected position of the cursor if cursor in the middle of the word that got replaced by longer or shorter string in formatting function (fix for emoji demo)

v1.8.0 (2017-09-24)

  • allow to return promise from prompt + fix promise in echo
  • add back context menu paste that was removed by mistake
  • make terminal work in Data URI (access to cookies was throwing exception in Chrome)
  • fix case insensitive autocomplete when there is single completion
  • fix completion error when more then one completion
  • fix artificialy triggered click
  • fix focus issue when you have multiple terminals
  • fix css animations
  • fix move cursor on click
  • fix quick click to focus + CTRL+V 
  • fix outputLimit
  • fix exception that sometimes happen on mouseup

v1.7.2 (2017-09-17)

  • fix blur when click ouside terminal when element you click is on top of terminal
  • this is terminal instance inside echo function
  • fix localStorage exception and empty line height while creating terminal from data URI
  • refocus when click on terminal (fix for :focus-within)

v1.6.4 (2017-08-31)

  • build

v1.6.3 (2017-08-28)

  • bugfix

v1.6.2 (2017-08-20)

  • fix altGr+key issue

v1.6.1 (2017-08-15)

  • don't call encode in escape_formatting

v1.6.0 (2017-08-11)

  • new API method apply_formatters
  • add UMD (requested by @fazelfarajzade)
  • add new events: onEchoCommand and onAfterRedraw

v1.5.3 (2017-08-01)

  • fix cursor over entity
  • fix space scroll page

v1.5.2 (2017-08-01)

  • keep formatting when cursor is over one
  • fix jumping prompt when it have newlines

v1.5.1 (2017-07-29)

  • fix autofocus with position: fixed
  • fix input method using sogou keyboard on windows
  • fix long line wrapping and click to move cursor with wider characters like Chinese

v1.5.0 (2017-07-10)

  • run fake keypress and keydown created in input when not fired by the browser (android)
  • improve perfomance by calculating char size only on resize and init (issue reported by @artursOs)
  • new cmd delegate method get_position/set_position added to terminal
  • resolve promises returned from intrpreter in jQuery 2.x
  • allow to use newlines in prompt
  • don't rethrow user exception when exceptionHandler is set (mainly for testing that option)
  • add option describe that is a string mapping procs from system.describe procs (default "procs") it can be "result" or "result.procs" if system.describe is normal JSON-RPC method
  • add option to cmd::disable to not blur so it don't hide android keyboard on pause
  • don't enable terminal on init on Android
  • fix next key after CTRL+V that was triggering input event (reported by @artursOs)
  • fix parsing strings
  • don't hide virtual keyboard on Android when called pause()
  • fix input on Firefox with google keyboard (reported by Filip Wieland)
  • disable terminal on resume event in cordova (is the terminal is disabled when no virutal keyboard)
  • fix moving cursor on click (after multiline command) and the height of the cmd plugin
  • fix escape completion (that enabled by default)
  • remove hardcoded DemoService from json-rpc system.describe

v1.4.3 (2017-06-18)

  • don't execute keypress callback when terminal is disabled
  • fix android (input event was not bind)
  • disable keypress when you press CTRL+key and caps-lock is on

v1.4.2 (2017-05-18)

  • fix context menu pasting and pasting images when terminal not in focus

v1.4.1 (2017-05-16)

  • add rel="noopener" to all links
  • remove anonymous function name that was duplicating parameter with the same name

v1.4 (2017-05-10)

  • fix recursive exception when finalize echo function throw exception
  • fix underline animation
  • add paste using context menu
  • fix wordAutocomplete and add completionEscape option
  • improve parsing commands (it now convert "foo"bar'baz' to foobarbaz like bash)
  • fix normalize and substring
  • remove empty formatting in normalize function

v1.3.1 (2017-05-05)

  • fix cols/rows that was causing signature to not show

v1.3.0 (2017-05-04)

  • remove onPop event from main interpreter (with null as next)
  • add args_quotes to parse_/split_ command api utilities
  • mousewheel work without jQuery mousewheel and fix jumps of text
  • paste of images (using echo) in browsers that support clipboard event
  • fix number of rows after adding underline animation
  • fix outputLimit
  • element resizer (as jQuery plugin) that work inside iframe
  • add IntersectionObserver to add resizer and call resize (not all browser support it,
  • polyfill exists)
  • add MutationObserver to detect when terminal is added/removed from DOM and
  • call IntersectionObserver when added
  • fix calculation of cols and rows
  • New API utiltites normalize, substring, unclosed_strings and helper iterate_formatting
  • strings object are not longer saved in variable on terminal creation so you can
  • change it dynamically after terminal is created (use command to change language)
  • when using rpc or object interpreter it will throw exception when there are
  • unclosed strings
  • add default formatter that handle nested formatting

v1.2.0 (2017-04-22)

  • make terminal accessible to screen readers

v1.1.4 (2017-04-18)

  • fix size with css var with underline animation
  • fix minified css (cssnano was removing unused animations)

v1.1.3 (2017-04-16)

  • fix click to change position when command have newlines

v1.1.2 (2017-04-12)

  • from pauseEvents option form cmd plugin - it always execute keyboard events

v1.1.1 (2017-04-09)

  • don't fire keymap when terminal paused
  • fix delete in IE11
  • restore order of keymap/keydown - keydown is executed first

v1.1.0 (2017-04-09)

  • fix delete in IE11
  • fix CMD+V on MacOS chrome
  • add stay option to insert same as in cmd plugin
  • add option pauseEvents - default set to true
  • fix exception when calling purge more then once
  • fix history: false option
  • keymap have priority over keydown so you can overwrite with CTRL+D keymap function
  • Fix list of contributors in package.json and add script that display json list of them

v1.0.15 (2017-03-24)

  • fix echo command when press tab twice and there are more then one completion
  • fix CTRL+D when paused (it now resume the interpreter)
  • focus don't enable terminal when paused (it was hidden by you could enter text)

v1.0.14 (2017-03-15)

  • fix moving of the content on focus/blur when command line at the bottom
  • don't move cursor on click when focusing
  • throw exception about key property polyfill on init of cmd plugin

v1.0.12 (2017-03-12)

  • fix cursor position when click on word completion on Android

v1.0.11 (2017-03-11)

  • fix dead keys logic (for special keys that don't trigger keypress like delete)

v1.0.10 (2017-03-04)

  • fix dead_keys logic (when keypress after special keys like arrows)

v1.0.8 (2017-02-28)

  • fix paste in IE and Edge

v1.0.7 (2017-02-27)

  • fix exec when pause called in onInit
  • fix reverse search
  • fix 3 argument in completion error
  • fix login from hash for async JSON-RPC
  • fix focus(false)/disable in exec from hash
  • fix regression of pasting in MacOS
  • scroll to bottom in insert method
  • remove default extra property from interpreter (all properties are saved in interperter)
  • and make main options extra pass to intepterer not using extra property
  • fix completion when text have spaces (escaped or inside quotes)
  • fix dead keys on MacOSX (testing shortcuts now require keydown and keypress events)

v1.0.6 (2017-02-17)

  • fix AltGr on non US keyboard layouts

v1.0.5 (2017-02-11)

  • fix CTRL+D to delete forward one character
  • don't use user agent sniffing to get scroll element if terminal attached to body
  • fix & on French layout

v1.0.4 (2017-02-09)

  • fix keypress with key polyfill
  • fix CTRL+V in Firefox and IE
  • fix issue in jQuery >= 3.0
  • fix space, backspace, resize and arrows in IE
  • fix middle mouse paste on GNU/Linux
  • fix signature

v1.0.0 (2017-02-06)

  • simplify changing of terminal colors using css variables
  • always export history and import when importHistory option is true
  • add bar and underline cursor animations and a way to enable it with single css variable
  • recalcualate cols and rows on terminal resize (not only window)
  • request/response and onPush/onPop callbacks
  • all callbacks have terminal as `this` (terminal in parameter stay the same)
  • add option softPause to control pause visible option - it don't hide the prompt when set to true
  • add wordAutocomplete option (default true)
  • add complete and before_cursor api methods and use it for autocomplete
  • formatting for command line (you can't type formatting but you can use $.terminal.formatters to
  • format command you're writing)
  • new option formatters for echo (error method by default disable formatters)
  • interpeter and terminal accept extra option that can be use in onPop or onPush
  • add keymap option to cmd, terminal and interpreter where you can add shortcuts
  • clicking on character, in cmd plugin, move cursor to that character
  • BUGS fixed
  • completion function now have two arguments string and callback and terminal is in this
  • removed setInterpreter, parseArguments, splitArguments, parseCommand and splitCommand
  • if you execute keydown event manualy to trigger terminal/cmd shortcuts you need to pass key property with key name
  • see spec/terminalSpec.js file

v0.11.23 (2017-01-08)

  • add scrollBottomOffset option

v0.11.22 (2016-12-10)

  • scroll to bottom of the terminal when option scrollOnEcho is set to false but the terminal is at the bottom, add new api methods is_bottom and scroll_to_bottom.

v0.11.21 (2016-11-29)

  • don't scroll to terminal (using caret plugin) when it's disabled
  • don't convert links to formatting when raw option is true
  • fix getting data from local storage
  • remove spell check and auto capitalize from textarea

v0.11.18 (2016-11-22)

  • fix getting data from local storage
  • remove spell check and auto capitalize from textarea

v0.11.18 (2016-11-19)

  • fix input method

v0.11.17 (2016-11-15)

  • fix echo when line is short and have newlines
  • add global and echo option wrap to disable long line wrapping
  • don't send warning when mime for JSON-RPC is text/json

v0.11.15 (2016-11-12)

  • replace json_stringify with JSON.stringify
  • fix focus on desktop and mobile
  • allow only memory storage with memory option set to true

v0.11.12 (2016-11-05)

  • Add memory option that allow to not use localStorage nor Cookies

v0.11.12 (2016-11-03)

  • Fix focus on mobile

v0.11.11 (2016-10-08)

  • fix do not enable the terminal on click if it's frozen

v0.11.10 (2016-09-29)

  • fix focus on click

v0.11.9 (2016-09-23)

  • fix outputLimit option

v0.11.8 (2016-09-22)

  • add scrollOnEcho option

v0.11.7 (2016-09-18)

  • fix History::last

v0.11.6 (2016-09-16)

  • fix flush new API method $.terminal.last_id
  • fix focus on Android

v0.11.4 (2016-09-11)

  • allow to change completion using option API method

v0.11.3 (2016-09-06)

  • Add echoCommand option

v0.11.2 (2016-09-05)

  • allow to select text using double click

v0.10.11 (2016-06-06)

  • More fixes.

v0.10.10 (2016-06-02)

  • Escape brackets while echo completion strings

v0.10.9 (2016-05-12)

  • fix issue with jQuery Timers when page included another jQuery after initialization

v0.10.7 (2016-05-12)

  • fix if interpreter is an array and have function

v0.10.6 (2016-05-11)

  • Fix exit build in command and make all builtin case sensitive

v0.10.5 (2016-05-06)

  • Prevent infinite loop in terminal::active when no terminal

v0.10.3 (2016-05-03)

  • keepWords option to echo and words parameter in split_equal
  • Fix login for nested intepreters
  • Fix destroy of cmd plugin
  • Fix url regex for formatting
  • Fix saving commands in hash
  • Allow to disable completion in nested interpreter
  • Change position of cursor in reverse history search
  • Fix pasting in Firefox
  • Exec is adding command to history
  • Fix execHash in FireFox
  • Testsing terminal and cmd plugin + call from command line
  • Fix exec for nested login rpc command
  • Fix exec from hash if commands use pause/resume
  • Fix exec for build in commands
  • Fix other various exec from hash issues
  • Fix local logout and login command
  • mousewheel and resize options for interpreter
  • use MIT license
  • onExport and onImport events

v0.9.3 (2015-12-25)

  • Change settings to method
  • Fix process_commands and escape_regex
  • Fix login from hash
  • Fix raw echo
  • Don't print empty string after removing extended commands strings
  • Fix history_state method

v0.9.2 (2015-12-17)

  • Don't change command line history if ctrl key is pressed
  • Fix middle mouse copy on linux
  • fix resize issue

v0.9.1 (2015-12-13)

  • Add freeze and frozen API methods

v0.8.8 (2014-07-11)

  • Fix 2 json rpc bugs

v0.8.7 (2014-03-22)

  • Space after fully completed command

v0.8.6 (2014-03-13)

  • Space after fully completed command

v0.8.5 (2014-03-11)

  • Fix colors regex and names (from css), use case insensitive regex in formatting

v0.8.4 (2014-03-09)

  • Fix redraw lines on import_view, fix calculating rows

v0.8.3 (2014-03-07)

  • update

v0.8.2 (2014-02-26)

  • update

v0.8.1 (2014-02-24)

  • update

v0.8.0 (2014-02-24)

  • CTRL+L Clear terminal
  • Shift+Enter insert newline
  • Remove tabcompletion option (now completion can be true, array or function)
  • Add onRPCError callback
  • Interpreter can be an array
  • ignoreSystemDescribe option
  • Handle invalid JSON-RPC
  • CSS style for standalone cmd plugin
  • using CSS3 Animation for blinking if supported
  • Fix [0m
  • Better error handling (all messages are in $.terminal.defaults.strings)
  • Named colors for terminal formatting
  • expose settings and login function
  • more tools in $.terminal
  • paste kill text with CTRL+Y
  • paste text from selection using middle mouse button
  • Fix login, history and exec
  • Disable few things when in login function
  • All Strings are in $.terminal.defaults.strings
  • more functions in $.terminal object

v0.7.12 (2013-12-13)

  • Don't calcualte num of chars when terminal is not visible
  • Add rest property to parseCommand

v0.7.11 (2013-12-13)

  • Fix last history command

v0.7.10 (2013-11-30)

  • Fix reverse search

v0.7.9 (2013-11-29)

  • Don't show version when calling terminal from source file, allow for terminal without interpreter

v0.7.5 (2013-08-13)

  • Fix flush, add option linksNoReferer

v0.7.4 (2013-08-11)

  • Fix interpreter when there is not system.describe in JSON-RPC
  • Add method flush and fix refresh

This awesome jQuery plugin is developed by jcubic. For more Advanced Usages, please check the demo page or visit the official website.