termlib.js home | multiple terminals | parser | faq | documentation | samples
Text Globbing Sample
> open terminal  
(c) mass:werk,
N. Landsteiner 2005-2009

A Simple Globbing Sample (with dialog)

This sample demonstrates how to back up and restore a terminal's state
in order to implement a special mode (here a dialog).
It also shows how to trap a special key and how to process the current
input of the command line.

Open the terminal, type a some text and hit TAB or ESC for globbing.
Any completions are evaluated from the last word in the line.

Possible completions are stored in an object containing lists (arrays)
per first letter:

var termGlobDict = {
   'a': [
          // put strings beginning with "a" here
   'b': [
          // put strings beginning with "b" here

(Only the max. first 9 hits are displayed as possible options.)

Inside a dialog options may be selected by either

  • typing the according number or
  • by moving the cursor and hitting <ENTER>.