jQuery Command Line Interpreter Plugin - Terminal Emulator

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

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/js-polyfills@latest/keyboard.js"></script>

5. Include optional extensions as per your needs.

  • animation.js: base class for animation
  • 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
  • forms.js: creates interactive forms
  • 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/animation.js"></script>
<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/forms.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,

mousewheel: null,
touchscroll: null,

// 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,

// size of the history
historySize: 60,

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

scrollObject: null,

// 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,

// 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,

// 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],

// unix formatting API options
unixFormatting: {
  escapeBrackets: false,
  ansiParser: {},
  ansiArt: false

// 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,

// e.g. ['HOLD+BACKSPACE']
repeatTimeoutKeys: [],

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);

// JSON-RPC requests
$.jrpc("rpc.php", 'mysql', [command], function(json) {

More Examples:


v2.42.0 (2024-05-20)

  • add reverse style to formatting and XML
  • add XML formatting targets
  • bugfixes

v2.41.2 (2024-05-09)

  • bugfixes

v2.41.1 (2024-04-30)

  • bugfixes

v2.41.0 (2024-04-29)

  • bugfixes
  • allow to use class and other attributes in style XML tags (like <bold/> or <glow/>)
  • allow usage of String instance in greetings

v2.40.6 (2024-04-28)

  • fix resize of text from long animation after finish

v2.40.5 (2024-04-27)

  • fix visible prompt during multiline typing animation

v2.40.4 (2024-04-27)

  • fix flash of old dynamic prompt on enter

v2.40.3 (2024-04-27)

  • fix new_formatter to allow usage of XML tags in formatter

v2.40.2 (2024-04-23)

  • fix usage with libraries that invoke fake click events

v2.40.1 (2024-04-22)

  • fix visible formatting in prompt when return string from command

v2.40.0 (2024-03-21)

  • don't force any attributes when using xml (span, img, and a tags) 
  • alow using attributes in color xml tags
  • Bugfix

v2.39.3 (2024-03-21)

  • fix broken full screen terminal height on Desktop

v2.39.1 (2024-03-20)

  • Bugfixes

v2.39.0 (2024-02-14)

  • Add support for jQuery 4.0

v2.38.0 (2024-02-01)

  • add support for BigInt numbers when parsing commands
  • add --line-thickness CSS variable to cursor animation
  • improve performance with long typing animations
  • Bugfix

v2.37.2 (2023-09-16)

  • bugfix

v2.37.1 (2023-08-03)

  • fix wrong calculation of characters with custom font

v2.37.0 (2023-07-31)

  • add rpc interceptor
  • wait for the custom fonts to load
  • bugfix

v2.36.0 (2023-05-20)

  • split_equal accepts an optional object as 3rd argument with two options trim and keepWords
  • add --padding CSS Variable
  • add CSS transition to links
  • Bugfix

v2.35.3 (2023-02-07)

  • Bugfix

v2.35.2 (2023-01-07)

  • republish for NPM

v2.35.1 (2022-12-24)

  • fix mobile Chrome and Firefox

v2.35.0 (2022-12-13)

  • replace imagePause with externalPause
  • add bulletproof solution for generic selector (* or div) to overwrite terminal style
  • use jsDelivr for emoji that is way faster #810
  • pause terminal when loading iframes #816
  • allow to change or remove target and rel tags on links with JSON attributes
  • allow using transparent background #698
  • register CSS properties so you can use CSS Transition on terminal colors #808
  • add terminal::blur alias #813
  • allow to change scrollbar color with CSS property
  • add process_formatting static helper function
  • add FormattingCanvasRenderer for color animation #819
  • Bugfixes

v2.34.0 (2022-07-11)

  • add term::get_mask method
  • add onReady event to term::read
  • improve performance of typing animation
  • add prefers-reduced-motion into main CSS
  • pause terminal when images are loading
  • allow disable scroll to bottom on resume
  • Bugfixes

v2.33.3 (2022-05-21)

  • fix newline in minified js file

v2.33.2 (2022-05-13)

  • fix scroll to bottom

v2.33.1 (2022-05-06)

  • fix padding removed by minifier

v2.33.0 (2022-05-04)

  • add a color and background attributes to the font tag in the xml formatter
  • add terminal-none animation
  • allow to easily change border-radius on terminal
  • add clear_cache to cmd
  • Bugfix

v2.32.1 (2022-03-09)

  • leading spaces with echo + keepWords
  • fix loading hidden terminal

v2.32.0 (2022-03-09)

  • add insert typing animation
  • add --text-shadow css variable
  • new API method parse_formatting
  • allow to use terminal style of external element
  • Bugfix

v2.31.1 (2022-02-28)

  • fixing low severity self XSS with potential more security implications

v2.31.0 (2021-12-30)

  • remove undocumented echo_command (that was used by old echo_newline extension)
  • scroll to bottom for each line in multiline typing animation
  • allow to use --glow: 1 with default animation
  • new API terminal::enter same as echo_command but supports animation
  • add global option execAnimationDelay default - 100
  • make execAnimation work only with execHash
  • Bugfixes

v2.30.2 (2021-12-24)

  • fix animated exec array with sync commands

v2.30.1 (2021-12-15)

  • fix record built-in commands in URL hash

v2.30.0 (2021-12-15)

  • add span to xml formatting
  • allow to use class attribute in XML formatting (span, link, and img)
  • new API methods clear_buffer() and get_output_buffer()
  • Bugfix

v2.29.5 (2021-10-16)

  • fix empty prompt when no wcwidth is included

v2.29.4 (2021-10-02)

  • fix empty lines when print single multi-line string

v2.29.3 (2021-10-02)

  • Bugfixes

v2.29.2 (2021-09-19)

  • fix & improvement to make + fix build

v2.29.1 (2021-08-24)

  • remove all: unset CSS that was breaking resizing events and visibility of textarea

v2.29.0 (2021-08-22)

  • remove undocumented <large>/<big>/<wide> and add <font> tag to XML formatter
  • add animation to exec and execAnimation option
  • add warning when calling invoke_key on disabled terminal
  • if interpreter returns a promise and it's animating the terminal will not pause (for exec array)
  • allow to use brackets inside extended commands (e.g. JavaScript code to hide commands)
  • expose $.terminal.xml_formatter.tags
  • add --glow conditional hack
  • Bugfixes

v2.28.1 (2021-08-04)

  • Fixed bugs

v2.28.0 (2021-08-04)

  • add forms extension
  • rewrite xml_formatter and add new tags
  • add animation interface
  • use dash - as input file to read from STDIN in from-ansi executable
  • improve auth error message
  • add "enter" typing animation with prefix prompt
  • allow to render ansi in less correctly (using ansi option)
  • nested_formatting inherit styles by default
  • bugfix

v2.27.1 (2021-07-07)

  • fix from_ansi and add option --ansi -a

v2.27.0 (2021-07-06)

  • add CSS and option ansi to echo to properly render ANSI art
  • add typing animation to set_prompt
  • return promise from set_prompt and echo when using typing animation
  • new emoji

v2.26.0 (2021-07-04)

  • Better API for prompt typing animation with term::read and term::echo
  • Bugfixes

v2.25.1 (2021-06-01)

  • fix wrong auth tokens when using exec to login
  • fix exec array for async login
  • fix Auth to nested RPC interpreter without system.describe
  • don't echo falsy values from RPC

v2.25.0 (2021-05-31)

  • Add new API $.rpc for JSON-RPC requests
  • Bugfix

v2.24.0 (2021-05-30)

  • add terminal::typing API method
  • add --font custom property
  • add alt tag to images from formatting
  • improve command parser
  • fix TypeScript types for echo with promises

v2.23.1 (2021-04-23)

  • include echo without newline into the core of the library
  • remove unsafe eval (function constructor) that breaks CSP
  • fix up/down arrow when prompt is empty string
  • fix prompt containing brackets
  • fix ANSI Art (add saving and restoring cursor using ANSI escape code)
  • fix mouse wheel and touch scroll in less when content is smaller than height of the terminal
  • fix regression in copy/paste with right click

v2.23.1 (2021-04-22)

  • fix reversed class in cmd (e.g. in less command)
  • fix hack to reflow the cursor in Firefox from

v2.23.0 (2021-04-18)

  • Include echo without newline into the core of the library
  • Bugfix

v2.22.0 (2021-02-14)

  • make unix formatting and basic tools work in web worker
  • fix scrolling whole page when using mouse wheel in less
  • fix some missing cp_437 characters for ANSI Art
  • fix usage as bookmarklet on StackOverflow (force css of textarea)

v2.21.0 (2021-02-04)

  • add wrap and keepWords option to less
  • add new method geometry to the API
  • fix parsing JSON code inside strings

v2.20.2 (2021-01-20)

  • fix bold background and default color in Unix formatting (another ANSI artwork issue)
  • fix rendering 0x1E in ANSI art
  • fix when browser don't have ES6 Map object
  • fix echo_newline extension
  • fix handling of blink in ANSI Art
  • fix error in prism when calling without options and render flags (e.g.: echo or prompt)
  • fix background color for links that have set background using formatting
  • fix empty cursor on Windows when copy/paste

v2.20.1 (2020-11-28)

  • fix async synchronization of async functions and normal echo
  • fix exception when executing empty command with pipe
  • fix serialization of commands when using pipe operator and function interpreter
  • fix exception in terminal::destroy

v2.20.0 (2020-11-27)

  • set_interpreter return a promise instead of terminal instance
  • add support for echo async functions
  • allow to run exec using onInit that will use pipe
  • fix silent error when executing empty command from hash
  • fix issues with browser that don't support css variables
  • fix exception in IE from formatters

v2.19.1/2 (2020-11-02)

  • fix prism highlighting

v2.19.0 (2020-11-02)

  • add support blink ANSI escape (unix_formatting)
  • new unix formatting API options, ansiArt option change behavior of blinking
  • Bugfix

v2.18.3 (2020-08-31)

  • fix jumping to cursor position on mobile (with code)

v2.18.2 (2020-08-25)

  • fix when page use line-height on body
  • fix glitches in history navigation (visible when using multiline commands in history)

v2.18.0 (2020-08-22)

  • new API to use renderHandler with update
  • new API (apply_formatters function option) to pick where processing of formatting should work
  • allow to toggle formatters in prism (enabled by default only for echo and command)
  • escape slash in escape_formatting/escape_brackets
  • add support for rgb(a) and hsl(a) colors
  • unify Firefox and Webkit (chrome) custom scrollbars
  • bugs fixed

v2.17.6 (2020-07-14)

  • fix adding duplicated prism formatters
  • fix inserting emoji using Windows 10 emoji picker
  • fix position of textarea in multi line command (probably will affect IME or Emoji picker)
  • make jump to bottom on click only when terminal is not enabled 
  • fix init cmd plugin without terminal
  • fix underscore cut off in Firefox (visible in signature)
  • fix combined emoji characters and skin tone variations 
  • fix down arrow at when cursor at the end of broken line

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
  • <

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