.\" Automatically generated by Pandoc 3.9.0.2 .\" .TH "CHA-API" "7" .SH Chawan\(cqs command API As described in \f[B]cha\-config\f[R](5), users can bind keypress combinations to actions. Such an action can be either a JavaScript expression, or a command defined in the \f[CR][cmd]\f[R] section of config.toml. .PP For example, the following works: .IP .EX \(aqg p n\(aq = \(aqn => pager.alert(n)\(aq # e.g. 2gpn prints \(ga2\(aq to the status line .EE .PP Note however, that JavaScript functions must be called with an appropriate \f[CR]this\f[R] value. So e.g.\ the following does not work: .IP .EX \(aqg p n\(aq = \(aqpager.alert\(aq # broken!!! .EE .PP To work around this limitation, actions have to wrap the target function in a closure, as above. However, this has poor reusability; for more complex actions, you would have to copy and paste the entire function every time you re\-bind it or call it from a different function. .PP To fix this, it is possible to define a command in the \f[CR][cmd]\f[R] section: .IP .EX \f[B][cmd.my.namespace]\f[R] showNumber = \(aqn => pager.alert(n)\(aq .EE .PP \f[CR]my.namespace\f[R] can be anything you want; it is to avoid collisions when including multiple configs. The only restriction is that the first component (in this case, \(lqmy\(rq) must not contain an upper\-case letter. .PP Now you can call \f[CR]cmd.my.namespace.showNumber()\f[R] from any other function, or include it in a keybinding (in that case, \f[CR]cmd.\f[R] is optional): .IP .EX \(aqg p n\(aq = \(aqmy.namespace.showNumber\(aq \f[I]# same as\f[R] \(aqg p n\(aq = \(aqcmd.my.namespace.showNumber\(aq .EE .SS Interfaces Note that there are also many private functions not documented here. Such functions have no stability guarantee and may disappear at any time, so using them is not recommended. .SS Client The global object (\f[CR]globalThis\f[R]) implements the \f[CR]Client\f[R] interface. Public functions of this are: .TP \f[CR]quit()\f[R] Exit the browser. .TP \f[CR]suspend()\f[R] Temporarily suspend the browser, by delivering the client process a SIGTSTP signal. .RS Note: this suspends all processes, including buffers, the loader and CGI. .RE .TP \f[CR]readFile(path)\f[R] Read a file at \f[CR]path\f[R]. .RS Returns the file\(cqs content as a string, or null if the file does not exist. .RE .TP \f[CR]writeFile(path, content)\f[R] Write \f[CR]content\f[R] to the file at \f[CR]path\f[R]. .RS Throws a TypeError if this failed for whatever reason. .RE .TP \f[CR]getenv(name, fallback = null)\f[R] Get an environment variable by \f[CR]name\f[R]. .RS Returns \f[CR]fallback\f[R] if the variable does not exist. .RE .TP \f[CR]setenv(name, value)\f[R] Set an environment variable by \f[CR]name\f[R]. .RS Throws a \f[CR]TypeError\f[R] if the operation failed (e.g.\ because the variable\(cqs size exceeded an OS\-specified limit.) .RE .TP \f[CR]pager\f[R] The pager object. Implements \f[CR]Pager\f[R], as described below. .TP \f[CR]line\f[R] The line editor. Implements \f[CR]LineEdit\f[R], as described below. .TP \f[CR]config\f[R] The config object. .RS A currently incomplete interface for retrieving and setting configuration options. In general, names are the same as in config.toml, except all \f[CR]\-\f[R] (ASCII hyphen) characters are stripped and the next character is upper\-cased. e.g.\ \f[CR]external.cgi\-dir\f[R] can be queried as \f[CR]config.external.cgiDir\f[R], etc. Setting individual options sometimes works, but sometimes they do not get propagated as expected. Consider this an experimental API. Currently, \f[CR]siteconf\f[R] and \f[CR]omnirule\f[R] values are not exposed to JS. The configuration directory itself can be queried as \f[CR]config.dir\f[R]. .RE .PP \f[CR]Client\f[R] also implements various web standards normally available on the \f[CR]Window\f[R] object on websites, e.g.\ fetch(). Note however that it does \f[I]not\f[R] give access to JS objects in buffers, so e.g.\ \f[CR]globalThis.document\f[R] is not available. .SS Pager \f[CR]Pager\f[R] is a separate interface from \f[CR]Client\f[R] that gives access to the pager (i.e.\ browser chrome). It is accessible as \f[CR]globalThis.pager\f[R], or simply \f[CR]pager\f[R]. .PP Note that there is a quirk of questionable value, where accessing properties that do not exist on the pager will dispatch those to the current buffer (\f[CR]pager.buffer\f[R]). So if you see e.g.\ \f[CR]pager.url\f[R], that is actually equivalent to \f[CR]pager.buffer.url\f[R], because \f[CR]Pager\f[R] has no \f[CR]url\f[R] getter. .PP Following properties (functions/getters) are defined by \f[CR]Pager\f[R]: .TP \f[CR]load(url = pager.buffer.url)\f[R] Put the specified address into the URL bar, and optionally load it. .RS Note that this performs auto\-expansion of URLs, so Chawan will expand any matching omni\-rules (e.g.\ search), try to open schemeless URLs with the default scheme/local files, etc. Opens a prompt with the current URL when no parameters are specified; otherwise, the string passed is displayed in the prompt. .RE .TP \f[CR]loadSubmit(url)\f[R] Act as if \f[CR]url\f[R] had been entered to the URL bar. \f[CR]loadSubmit\f[R] differs from \f[CR]gotoURL\f[R] in that it also evaluates omni\-rules, tries to prepend a scheme, etc. .TP \f[CR]gotoURL(url, options = {replace: null, contentType: null, save: false, charset: null})\f[R] Go to the specified URL immediately (without a prompt). This differs from \f[CR]loadSubmit\f[R] in that it loads the exact URL as passed (no prepending https, etc.) .RS When \f[CR]replace\f[R] is set, the new buffer may replace the old one if it loads successfully. When \f[CR]contentType\f[R] is set, the new buffer\(cqs content type is forcefully set to that string. When \f[CR]save\f[R] is true, the user is prompted to save the resource instead of displaying it in a buffer. When \f[CR]charset\f[R] is not null, the specified charset label is forced instead of regular charset detection. .RE .TP \f[CR]traverse(dir)\f[R] Switch to the next buffer in direction \f[CR]dir\f[R], interpreted as in \f[CR]Buffer#find\f[R]. .TP \f[CR]nextBuffer()\f[R], \f[CR]prevBuffer()\f[R] Same as \f[CR]traverse(\(dqnext\(dq)\f[R] and \f[CR]traverse(\(dqprev\(dq)\f[R]. .TP \f[CR]dupeBuffer()\f[R] Duplicate the current buffer by loading its source in a new buffer. .TP \f[CR]discardBuffer(buffer = pager.buffer, dir = pager.navDirection)\f[R] Discard \f[CR]buffer\f[R], then move back to the buffer opposite to \f[CR]dir\f[R] (interpreted as in \f[CR]Buffer#find\f[R]). .TP \f[CR]discardTree()\f[R] Discard all subsequent siblings of the current buffer. This function is deprecated, and may be removed in the future. .TP \f[CR]addTab(target)\f[R] Open a new tab. .RS If \f[CR]target\f[R] is a buffer, it is removed from its current tab and added to the newly created tab. Otherwise, \f[CR]target\f[R] is interpreted as a URL to open with \f[CR]gotoURL\f[R]. .RE .TP \f[CR]prevTab()\f[R], \f[CR]nextTab()\f[R] Switch to the previous/next tab in the tab list. .TP \f[CR]discardTab()\f[R] Discard the current tab. .TP \f[CR]reload()\f[R] Open a new buffer with the current buffer\(cqs URL, replacing the current buffer. .TP \f[CR]reshape()\f[R] Reshape the current buffer (=render the current page anew.) .TP \f[CR]redraw()\f[R] Redraw screen contents. Useful if something messed up the display. .TP \f[CR]toggleSource()\f[R] If viewing an HTML buffer, open a new buffer with its source. Otherwise, open the current buffer\(cqs contents as HTML. .TP \f[CR]lineInfo()\f[R] Display information about the current line. .TP \f[CR]searchForward()\f[R], \f[CR]searchBackward()\f[R] Search forward/backward for a string in the current buffer. .TP \f[CR]isearchForward()\f[R], \f[CR]isearchBackward()\f[R] Incremental\-search forward/backward for a string, highlighting the first result. .TP \f[CR]gotoLine(n?)\f[R] Go to the line passed as the first argument. .RS If no arguments were specified, an input window for entering a line is shown. .RE .TP \f[CR]searchNext(n = 1)\f[R], \f[CR]searchPrev(n = 1)\f[R] Jump to the nth next/previous search result. .TP \f[CR]peek()\f[R] Display an alert message of the current URL. .TP \f[CR]peekCursor()\f[R] Display an alert message of the URL or title under the cursor. Multiple calls allow cycling through the two. (i.e.\ by default, press u once \-> title, press again \-> URL) .TP \f[CR]showFullAlert()\f[R] Show the last alert inside the line editor. .TP \f[CR]ask(prompt)\f[R] Ask the user for confirmation. Returns a promise which resolves to a boolean value indicating whether the user responded with yes. .RS Can be used to implement an exit prompt like this: .IP .EX q = \(aqpager.ask(\(dqDo you want to exit Chawan?\(dq).then(x => x ? pager.quit() : void 0)\(aq .EE .RE .TP \f[CR]askChar(prompt)\f[R] Ask the user for any character. .RS Like \f[CR]pager.ask\f[R], but the return value is a character. .RE .TP \f[CR]clipboardWrite(s)\f[R] Write \f[CR]s\f[R] to the clipboard (copy). By default, it tries using OSC 52; if that fails, it tries to run \f[CR]external.copy\-cmd\f[R] (defaults to \f[CR]xsel\f[R]). .RS Returns true if the copy succeeded, false otherwise. (There may be false positives in case OSC 52 is used and the terminal doesn\(cqt consume the text, although Chawan will try its best to avoid this.) .RE .TP \f[CR]extern(cmd, options = {env: { ... }, suspend: true, wait: false})\f[R] Run an external command \f[CR]cmd\f[R]. .RS By default, the \f[CR]$CHA_URL\f[R] and \f[CR]$CHA_CHARSET\f[R] variables are set; change this using the \f[CR]env\f[R] option. \f[CR]options.suspend\f[R] suspends the pager while the command is being executed, and \f[CR]options.wait\f[R] makes it so the user must press a key before the pager is resumed. Returns true if the command exited successfully, false otherwise. .RE .TP \f[CR]externCapture(cmd)\f[R] Like \f[CR]extern()\f[R], but redirect the command\(cqs stdout string into the result. \f[CR]null\f[R] is returned if the command wasn\(cqt executed successfully, or if the command returned a non\-zero exit value. .TP \f[CR]externInto(cmd, ins)\f[R] Like \f[CR]extern()\f[R], but redirect \f[CR]ins\f[R] into the command\(cqs standard input stream. \f[CR]true\f[R] is returned if the command exits successfully, \f[CR]false\f[R] otherwise. .TP \f[CR]externFilterSource(cmd, buffer = null, contentType = null)\f[R] Redirects the specified (or if \f[CR]buffer\f[R] is null, the current) buffer\(cqs source into \f[CR]cmd\f[R]. .RS Then, it pipes the output into a new buffer, with the content type \f[CR]contentType\f[R] (or, if \f[CR]contentType\f[R] is null, the original buffer\(cqs content type). Returns \f[CR]undefined\f[R]. (It should return a promise; TODO.) .RE .TP \f[CR]openEditor(text)\f[R] Open \(lqtext\(rq in the command configured as \f[CR]external.editor\f[R] (this is typically just \f[CR]$EDITOR\f[R].) .RS If the editor signals an error (crash or non\-zero exit code), \f[CR]null\f[R] is returned. Otherwise, the user\(cqs input is returned as a string. .RE .TP \f[CR]openMenu(x = pager.cursorx \- pager.fromx, y = pager.cursory \- pager.fromy)\f[R] Opens the context menu at the specified x/y positions. .TP \f[CR]closeMenu()\f[R] Closes the menu if it is opened. .TP \f[CR]buffer\f[R] Getter for the currently displayed buffer. Returns a \f[CR]Buffer\f[R] object; see below. .TP \f[CR]menu\f[R] Getter for the currently displayed menu. Returns a \f[CR]Select\f[R] object. .TP \f[CR]navDirection\f[R] The direction the user last moved in the buffer list using \f[CR]traverse\f[R]. Possible values are \f[CR]prev\f[R], \f[CR]next\f[R], \f[CR]any\f[R]. .TP \f[CR]revDirection\f[R] Equivalent to \f[CR]Pager.oppositeDir(pager.navDirection)\f[R]. .PP Also, the following static function is defined on \f[CR]Pager\f[R] itself: .TP \f[CR]Pager.oppositeDir(dir)\f[R] Return a string representing the direction opposite to \f[CR]dir\f[R]. .RS For \(lqnext\(rq, this is \(lqprev\(rq; for \(lqprev\(rq, \(lqnext\(rq; for \(lqany\(rq, it\(cqs the same. .RE .SS Buffer Each buffer is exposed as an object that implements the \f[CR]Buffer\f[R] interface. To get a reference to the currently displayed buffer, use \f[CR]pager.buffer\f[R]. .PP Note the quirk mentioned above where \f[CR]Pager\f[R] dispatches unknown properties onto the current buffer. .PP Following properties (functions/getters) are defined by \f[CR]Buffer\f[R]: .TP \f[CR]cursorUp(n = 1)\f[R], \f[CR]cursorDown(n = 1)\f[R] Move the cursor upwards/downwards by \f[CR]n\f[R] lines, or if \f[CR]n\f[R] is unspecified, by 1. .TP \f[CR]cursorLeft(n = 1)\f[R], \f[CR]cursorRight(n = 1)\f[R] Move the cursor to the left/right by \f[CR]n\f[R] cells, or if \f[CR]n\f[R] is unspecified, by 1. .RS Note: \f[CR]n\f[R] right now represents cells, but really it should represent characters. (The difference is that numbered cursorLeft or cursorRight is currently broken for double\-width chars.) .RE .TP \f[CR]cursorLineBegin()\f[R], \f[CR]cursorLineEnd()\f[R] Move the cursor to the first/last cell of the line. .TP \f[CR]cursorLineTextStart()\f[R] Move the cursor to the first non\-blank character of the line. .TP \f[CR]cursorNextWord()\f[R], \f[CR]cursorNextViWord()\f[R], \f[CR]cursorNextBigWord()\f[R] Move the cursor to the beginning of the next word. .TP \f[CR]cursorPrevWord()\f[R], \f[CR]cursorPrevViWord()\f[R], \f[CR]cursorPrevBigWord()\f[R] Move the cursor to the end of the previous word. .TP \f[CR]cursorWordEnd()\f[R], \f[CR]cursorViWordEnd()\f[R], \f[CR]cursorBigWordEnd()\f[R] Move the cursor to the end of the current word, or if already there, to the end of the next word. .TP \f[CR]cursorWordBegin()\f[R], \f[CR]cursorViWordBegin()\f[R], \f[CR]cursorBigWordBegin()\f[R] Move the cursor to the beginning of the current word, or if already there, to the end of the previous word. .TP \f[CR]async getCurrentWord(x = this.cursorx, y = this.cursory)\f[R] Returns the word currently under the cursor as a string. .TP \f[CR]cursorNextLink()\f[R], \f[CR]cursorPrevLink()\f[R] Move the cursor to the beginning of the next/previous clickable element. .TP \f[CR]cursorLinkNavDown(n = 1)\f[R], \f[CR]cursorLinkNavUp(n = 1)\f[R] Move the cursor to the beginning of the \f[CR]n\f[R]th next/previous clickable element. Buffer scrolls pagewise, wrap to beginning/end if content is less than one page length. .TP \f[CR]cursorNextParagraph(n = 1)\f[R], \f[CR]cursorPrevParagraph(n = 1)\f[R] Move the cursor to the beginning/end of the nth next/previous paragraph. .TP \f[CR]cursorNthLink(n = 1)\f[R] Move the cursor to the nth link of the document. .TP \f[CR]cursorRevNthLink(n = 1)\f[R] Move the cursor to the nth link of the document, counting backwards from the document\(cqs last line. .TP \f[CR]pageUp(n = 1)\f[R], \f[CR]pageDown(n = 1)\f[R], \f[CR]pageLeft(n = 1)\f[R], \f[CR]pageRight(n = 1)\f[R] Scroll up/down/left/right by n pages. .TP \f[CR]halfPageUp(n = 1)\f[R], \f[CR]halfPageDown(n = 1)\f[R], \f[CR]halfPageLeft(n = 1)\f[R], \f[CR]halfPageRight(n = 1)\f[R] Scroll up/down/left/right by n half pages. .TP \f[CR]scrollUp(n = 1)\f[R], \f[CR]scrollDown(n = 1)\f[R], \f[CR]scrollLeft(n = 1)\f[R], \f[CR]scrollRight(n = 1)\f[R] Scroll up/down/left/right by n lines. .TP \f[CR]click(n = 1)\f[R] Click the HTML element currently under the cursor. \f[CR]n\f[R] controls the number of clicks, e.g.\ \f[CR]n = 2\f[R] is a double click. (The number of clicks is only relevant in JS apps.) .TP \f[CR]cursorFirstLine()\f[R], \f[CR]cursorLastLine()\f[R] Move to the first/last line in the buffer. .TP \f[CR]cursorTop()\f[R], \f[CR]cursorMiddle()\f[R], \f[CR]cursorBottom()\f[R] Move to the first/middle/bottom line on the screen. (Equivalent to H/M/L in vi.) .TP \f[CR]lowerPage(n = this.cursory)\f[R] Move cursor to line n, then scroll up so that the cursor is on the top line on the screen. (\f[CR]zt\f[R] in vim.) .TP \f[CR]lowerPageBegin(n = this.cursory)\f[R] Move cursor to the first non\-blank character of line n, then scroll up so that the cursor is on the top line on the screen. (\f[CR]z\f[R] in vi.) .TP \f[CR]centerLine(n = this.cursory)\f[R] Center screen around line n.\ (\f[CR]zz\f[R] in vim.) .TP \f[CR]centerLineBegin(n = this.cursory)\f[R] Center screen around line n, and move the cursor to the line\(cqs first non\-blank character. (\f[CR]z.\f[R] in vi.) .TP \f[CR]raisePage(n = this.cursory)\f[R] Move cursor to line n, then scroll down so that the cursor is on the top line on the screen. (\f[CR]zb\f[R] in vim.) .TP \f[CR]raisePageBegin(n = this.cursory)\f[R] Move cursor to the first non\-blank character of line n, then scroll up so that the cursor is on the last line on the screen. (\f[CR]z\(ha\f[R] in vi.) .TP \f[CR]nextPageBegin(n = this.cursory)\f[R] If n was given, move to the screen before the nth line and raise the page. Otherwise, go to the previous screen\(cqs last line and raise the page. (\f[CR]z+\f[R] in vi.) .TP \f[CR]cursorLeftEdge()\f[R], \f[CR]cursorMiddleColumn()\f[R], \f[CR]cursorRightEdge()\f[R] Move to the first/middle/last column on the screen. .TP \f[CR]centerColumn()\f[R] Center screen around the current column. .TP \f[CR]findPrevMatch(regex, x, y, wrap = false, n = 1)\f[R], \f[CR]findNextMatch(regex, x, y, wrap = false, n = 1)\f[R] Find the previous/next match for a regex. .RS \f[CR]regex\f[R] is a RegExp object (e.g.\ from \f[CR]/this syntax/\f[R]). \f[CR]x\f[R] and \f[CR]y\f[R] are the starting position in the buffer, \f[CR]wrap\f[R] determines whether or not the search should wrap over the document, and \f[CR]n\f[R] is the count of occurrences to be found. Returns an array of the elements \f[CR][x, y, w]\f[R] where \f[CR]x\f[R] and \f[CR]y\f[R] are the matched coordinates and \f[CR]w\f[R] the width of the matched text. If no match is found, the result is \f[CR][\-1, \-1, 0]\f[R]. .RE .TP \f[CR]findNextMark(x = this.cursorx, y = this.cursory)\f[R], \f[CR]findPrevMark(x = this.cursorx, y = this.cursory)\f[R] Find the next/previous mark after/before \f[CR]x\f[R], \f[CR]y\f[R], if any; and return its id (or null if none were found.) .TP \f[CR]setMark(id, x = this.cursorx, y = this.cursory)\f[R] Set a mark at (x, y) using the name \f[CR]id\f[R]. .RS Returns true if no other mark exists with \f[CR]id\f[R]. If one already exists, it will be overridden and the function returns false. .RE .TP \f[CR]clearMark(id)\f[R] Clear the mark with the name \f[CR]id\f[R]. Returns true if the mark existed, false otherwise. .TP \f[CR]gotoMark(id)\f[R] If the mark \f[CR]id\f[R] exists, jump to its position and return true. Otherwise, do nothing and return false. .TP \f[CR]gotoMarkY(id)\f[R] If the mark \f[CR]id\f[R] exists, jump to the beginning of the line at its Y position and return true. Otherwise, do nothing and return false. .TP \f[CR]getMarkPos(id)\f[R] If the mark \f[CR]id\f[R] exists, this returns its position as an array where the first element is the X position and the second element is the Y position. Otherwise it returns \f[CR]null\f[R]. .TP \f[CR]cursorToggleSelection(n = 1, opts = {selectionType: \(dqnormal\(dq})\f[R] Start a vim\-style visual selection. The cursor is moved to the right by \f[CR]n\f[R] cells. .RS selectionType may be \(lqnormal\(rq (regular selection), \(lqline\(rq (line\-based selection) and \(lqcolumn\(rq (column\-based selection). .RE .TP \f[CR]getSelectionText()\f[R] Get the currently selected text. .RS Returns a promise, so consumers must \f[CR]await\f[R] it to get the text. .RE .TP \f[CR]markURL()\f[R] Convert URL\-like strings to anchors on the current page. .TP \f[CR]showLinkHints()\f[R] Display link hints on the page. Mainly intended for the built\-in toggleLinkHints command. .RS Returns an array of objects with \f[CR]x\f[R] representing the x position, \f[CR]y\f[R] the y position of a link. .RE .TP \f[CR]toggleImages()\f[R] Toggle display of images in this buffer. .TP \f[CR]saveLink()\f[R] Save URL pointed to by the cursor. .TP \f[CR]saveSource()\f[R] Save the source of this buffer. .TP \f[CR]setCursorX(x)\f[R], \f[CR]setCursorY(y)\f[R], \f[CR]setCursorXY(x, y)\f[R], \f[CR]setCursorXCenter(x)\f[R], \f[CR]setCursorYCenter(y)\f[R], \f[CR]setCursorXYCenter(x, y)\f[R] Set the cursor position to \f[CR]x\f[R] and \f[CR]y\f[R] respectively, scrolling the view if necessary. .RS Variants that end with \(lqCenter\(rq will also center the screen around the position if it is outside the screen. .RE .TP \f[CR]setFromX(x)\f[R], \f[CR]setFromY(y)\f[R], \f[CR]setFromXY(x, y)\f[R] Set the starting position of the displayed area on the screen. .TP \f[CR]find(dir)\f[R] Find the next buffer in the list in a specific direction. .RS Possible values of \f[CR]dir\f[R] are \(lqprev\(rq, \(lqnext\(rq, and \(lqany\(rq. \(lqnext\(rq and \(lqprev\(rq return the next/previous buffer respectively, while \(lqany\(rq returns either \(lqprev\(rq, or if it\(cqs null, \(lqnext\(rq. .RE .TP \f[CR]url\f[R] Getter for the buffer\(cqs URL. Note: this returns a \f[CR]URL\f[R] object, not a string. .TP \f[CR]hoverTitle\f[R], \f[CR]hoverLink\f[R], \f[CR]hoverImage\f[R] Getter for the string representation of the element title/link/image currently under the cursor. Returns the empty string if no title is found. .TP \f[CR]cursorx\f[R], \f[CR]cursory\f[R] The x/y position of the cursor inside the buffer. .RS Note that while the status line display is 1\-indexed, these values are 0\-indexed (i.e.\ \f[CR]cursory = 0\f[R] is the first line). .RE .TP \f[CR]fromx\f[R], \f[CR]fromy\f[R] The x/y position of the first line displayed on the screen. .TP \f[CR]numLines\f[R] The number of lines currently loaded in the buffer. .TP \f[CR]width\f[R], \f[CR]height\f[R] The width and height of the buffer\(cqs window (i.e.\ the visible part of the canvas). .TP \f[CR]process\f[R] The process ID of the buffer. .TP \f[CR]title\f[R] Text from the \f[CR]title\f[R] element, or the buffer\(cqs URL if there is no title. .TP \f[CR]next\f[R] Next buffer in the buffer list. May be \f[CR]null\f[R]. .TP \f[CR]prev\f[R] Previous buffer in the buffer list. May be \f[CR]null\f[R]. .TP \f[CR]select\f[R] Reference to the current \f[CR]select\f[R] element\(cqs widget, or null if no \f[CR]select\f[R] element is open. .RS This object implements the \f[CR]Select\f[R] interface, which is somewhat compatible with the \f[CR]Buffer\f[R] interface with some exceptions. (TODO: elaborate) .RE .SS LineEdit The line editor at the bottom of the screen is exposed to the JavaScript context as \f[CR]globalThis.line\f[R], or simply \f[CR]line\f[R], and implements the \f[CR]LineEdit\f[R] interface. .PP Note that there is no single \f[CR]LineEdit\f[R] object; a new one is created every time the line editor is opened, and when the line editor is closed, \f[CR]globalThis.line\f[R] simply returns \f[CR]null\f[R]. .PP Following properties (functions/getters) are defined by \f[CR]LineEdit\f[R]: .TP \f[CR]submit()\f[R] Submit line. .TP \f[CR]cancel()\f[R] Cancel operation. .TP \f[CR]backspace()\f[R] Delete character before cursor. .TP \f[CR]delete()\f[R] Delete character after cursor. .TP \f[CR]clear()\f[R] Clear text before cursor. .TP \f[CR]kill()\f[R] Clear text after cursor. .TP \f[CR]clearWord()\f[R] Delete word before cursor. .TP \f[CR]killWord()\f[R] Delete word after cursor. .TP \f[CR]backward()\f[R], \f[CR]forward()\f[R] Move cursor backward/forward by one character. .TP \f[CR]nextWord()\f[R], \f[CR]prevWord()\f[R] Move cursor to the next/previous word by one character. .TP \f[CR]begin()\f[R], \f[CR]end()\f[R] Move cursor to the beginning/end of the line. .TP \f[CR]escape()\f[R] Ignore keybindings for next character. .TP \f[CR]nextHist()\f[R], \f[CR]prevHist()\f[R] Jump to the previous/next history entry. .TP \f[CR]text\f[R] The currently entered text. .SS See also \f[B]cha\f[R](1) \f[B]cha\-config\f[R](5)