@rse/ink-editor 0.0.0-stage → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/.claude/CLAUDE.md +1 -0
  2. package/AGENTS.md +99 -0
  3. package/CHANGELOG.md +9 -0
  4. package/README.md +116 -2
  5. package/dst-stage1/ink-editor-cli.d.ts +2 -0
  6. package/dst-stage1/ink-editor-cli.js +174 -0
  7. package/dst-stage1/ink-editor-engine-emacs.d.ts +103 -0
  8. package/dst-stage1/ink-editor-engine-emacs.js +1530 -0
  9. package/dst-stage1/ink-editor-engine-nano.d.ts +78 -0
  10. package/dst-stage1/ink-editor-engine-nano.js +884 -0
  11. package/dst-stage1/ink-editor-engine-vim.d.ts +124 -0
  12. package/dst-stage1/ink-editor-engine-vim.js +2220 -0
  13. package/dst-stage1/ink-editor-engine-vscode.d.ts +79 -0
  14. package/dst-stage1/ink-editor-engine-vscode.js +850 -0
  15. package/dst-stage1/ink-editor-mode-emacs.d.ts +12 -0
  16. package/dst-stage1/ink-editor-mode-emacs.js +143 -0
  17. package/dst-stage1/ink-editor-mode-nano.d.ts +12 -0
  18. package/dst-stage1/ink-editor-mode-nano.js +140 -0
  19. package/dst-stage1/ink-editor-mode-vim.d.ts +12 -0
  20. package/dst-stage1/ink-editor-mode-vim.js +230 -0
  21. package/dst-stage1/ink-editor-mode-vscode.d.ts +12 -0
  22. package/dst-stage1/ink-editor-mode-vscode.js +133 -0
  23. package/dst-stage1/ink-editor-mode.d.ts +72 -0
  24. package/dst-stage1/ink-editor-mode.js +24 -0
  25. package/dst-stage1/ink-editor-syntax.d.ts +14 -0
  26. package/dst-stage1/ink-editor-syntax.js +149 -0
  27. package/dst-stage1/ink-editor-text.d.ts +38 -0
  28. package/dst-stage1/ink-editor-text.js +177 -0
  29. package/dst-stage1/ink-editor-widget.d.ts +15 -0
  30. package/dst-stage1/ink-editor-widget.js +132 -0
  31. package/dst-stage1/ink-editor.d.ts +13 -0
  32. package/dst-stage1/ink-editor.js +37 -0
  33. package/dst-stage1/tsc.tsbuildinfo +1 -0
  34. package/dst-stage2/ink-editor-cli.esm.js +177 -0
  35. package/dst-stage2/ink-editor.esm.js +5972 -0
  36. package/etc/c8.json +17 -0
  37. package/etc/eslint.mts +84 -0
  38. package/etc/knip.jsonc +51 -0
  39. package/etc/stx.conf +103 -0
  40. package/etc/tsc.json +29 -0
  41. package/etc/vite.mts +79 -0
  42. package/package.d/@typescript-eslint+typescript-estree+8.74.0.patch +12 -0
  43. package/package.d/vite+8.4.1.patch +12 -0
  44. package/package.json +79 -5
  45. package/src/ink-editor-cli.ts +200 -0
  46. package/src/ink-editor-engine-emacs.ts +1648 -0
  47. package/src/ink-editor-engine-nano.ts +978 -0
  48. package/src/ink-editor-engine-vim.ts +2203 -0
  49. package/src/ink-editor-engine-vscode.ts +938 -0
  50. package/src/ink-editor-mode-emacs.ts +137 -0
  51. package/src/ink-editor-mode-nano.ts +135 -0
  52. package/src/ink-editor-mode-vim.ts +223 -0
  53. package/src/ink-editor-mode-vscode.ts +129 -0
  54. package/src/ink-editor-mode.ts +137 -0
  55. package/src/ink-editor-syntax.ts +176 -0
  56. package/src/ink-editor-text.ts +205 -0
  57. package/src/ink-editor-widget.ts +182 -0
  58. package/src/ink-editor.ts +48 -0
  59. package/tst/ink-editor-1-vim.spec.ts +177 -0
  60. package/tst/ink-editor-2-emacs.spec.ts +211 -0
  61. package/tst/ink-editor-3-nano.spec.ts +187 -0
  62. package/tst/ink-editor-4-vscode.spec.ts +187 -0
  63. package/tst/tsc.json +27 -0
@@ -0,0 +1 @@
1
+ @../AGENTS.md
package/AGENTS.md ADDED
@@ -0,0 +1,99 @@
1
+
2
+ # Overview for AI Agents
3
+
4
+ ## Project Abstract
5
+
6
+ Ink-Editor (`@rse/ink-editor`) is a TypeScript text editor for the terminal,
7
+ built on top of Ink and the Textarea widget of `better-ink-ui`, with the
8
+ four exchangeable editing modes Vim, Emacs, Nano, and VS Code, plus
9
+ Shiki-based syntax highlighting. It is both a CLI application
10
+ (`ink-editor`) and a library (`Editor` widget), built to ESM only
11
+ (Ink is ESM-only), with `ink` and `react` as peer dependencies.
12
+
13
+ ## Technology Stack
14
+
15
+ Build-Tools: npm, @rse/stx, vite, eslint, typescript
16
+ Language: TypeScript
17
+ Libraries: ink, react, better-ink-ui, shiki
18
+ Runtime: Node.js (>= 22.18.0)
19
+
20
+ ## Build Commands
21
+
22
+ Build and development commands use NPM and STX (`@rse/stx`) as the task runner:
23
+
24
+ ```bash
25
+ npm install # install dependencies
26
+
27
+ npm start lint # standard: perform static code analysis
28
+ npm start build # standard: build everything
29
+ npm start test # standard: run unit test suite
30
+
31
+ npm start test-cov # run unit test suite with code coverage
32
+ npm start dev # development watch mode (rebuild on change)
33
+ npm start run # run src/ink-editor-cli.ts via `tsx`
34
+
35
+ npm start clean # remove dst-stage1/ and dst-stage2/
36
+ npm start distclean # remove node_modules/ and package-lock.json
37
+ npm start publish # publish to npm (restricted to maintainer host)
38
+ ```
39
+
40
+ ## Build Pipeline
41
+
42
+ Two-stage build:
43
+
44
+ 1. **Stage 1** — TypeScript → JavaScript + `.d.ts` declarations (output: `dst-stage1/`)
45
+ configured via `etc/tsc.json` (target ES2023, module ESNext, strict mode).
46
+
47
+ 2. **Stage 2** — Vite bundles stage-1 output into ESM (output: `dst-stage2/`):
48
+ `ink-editor.esm.js` (library) and `ink-editor-cli.esm.js` (CLI, the `bin`),
49
+ where the CLI imports the library bundle. All NPM packages and Node.js built-ins stay external.
50
+
51
+ Configuration lives in `etc/`: `tsc.json`, `vite.mts`, `eslint.mts`,
52
+ `knip.jsonc`, `c8.json`, `stx.conf`. NPM patches live in `package.d/`.
53
+ For regression testing always use the all-in-one command `npm start build test`.
54
+
55
+ ## Architecture
56
+
57
+ ### Layering
58
+
59
+ ```
60
+ ink-editor-text — line geometry and text operations (dependency-free)
61
+ ↓ ink-editor-engine-* — editing engines Vim/Emacs/Nano/VS Code on string + key tokens (dependency-free)
62
+ ↓ ink-editor-mode — contract between widget, host, and modes (dependency-free)
63
+ ↓ ink-editor-mode-* — editing modes, adapting the engines to the contract (dependency-free)
64
+ ↓ ink-editor-syntax — Shiki-based syntax highlighting as styled ranges
65
+ ↓ ink-editor-widget — Editor Ink widget on top of the better-ink-ui Textarea
66
+ ↓ ink-editor — library entry point (public API)
67
+ ↓ ink-editor-cli — CLI application (file loading/writing, argument parsing)
68
+ ```
69
+
70
+ ### Key Source Files
71
+
72
+ - `src/ink-editor.ts`: library entry point, re-exports the public API and provides `editorModes`
73
+ - `src/ink-editor-cli.ts`: CLI application, uses only the library entry point
74
+ - `src/ink-editor-text.ts`: line geometry of a text and the `TextOps` of the front end
75
+ - `src/ink-editor-mode.ts`: `EditorMode`, `EditorHost`, `EditorKey`, `EditorStatus` contract types
76
+ - `src/ink-editor-engine-{vim,emacs,nano,vscode}.ts`: the editing engines
77
+ - `src/ink-editor-mode-{vim,emacs,nano,vscode}.ts`: the editing modes (`VimMode`, `EmacsMode`, `NanoMode`, `CodeMode`)
78
+ - `src/ink-editor-syntax.ts`: syntax language detection and highlighting
79
+ - `src/ink-editor-widget.ts`: the `Editor` widget
80
+
81
+ ### Key Test Files
82
+
83
+ - `tst/ink-editor-1-vim.spec.ts`: terminal-free tests of the Vim engine
84
+ - `tst/ink-editor-2-emacs.spec.ts`: terminal-free tests of the Emacs engine
85
+ - `tst/ink-editor-3-nano.spec.ts`: terminal-free tests of the Nano engine
86
+ - `tst/ink-editor-4-vscode.spec.ts`: terminal-free tests of the VS Code-style engine
87
+ - `tst/tsc.json`: TypeScript configuration for the test directory
88
+
89
+ Tests use Mocha and Chai and run via `tsx`.
90
+
91
+ ## Coding Style
92
+
93
+ - 4-space indentation, double quotes, no semicolons
94
+ - Stroustrup brace style (`else`/`catch`/`finally` on new line after closing brace)
95
+ - Comments: `/* ... */` with two leading/trailing spaces; no `//` end-of-line comments
96
+ - Vertical alignment of similar operators on consecutive lines
97
+ - No JSX: React elements are created via `React.createElement` (aliased `h`)
98
+ - Imports of internal modules are extension-less (module resolution "Bundler")
99
+
package/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+
2
+ ChangeLog
3
+ =========
4
+
5
+ 0.9.0 (2026-12-03)
6
+ ------------------
7
+
8
+ (first rough cut of editor application and library)
9
+
package/README.md CHANGED
@@ -1,3 +1,117 @@
1
- # Temporary Holding Version
2
1
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
2
+ Ink-Editor
3
+ ==========
4
+
5
+ Text Editor with Exchangeable Editing Modes for Ink
6
+
7
+ [![github (author stars)](https://img.shields.io/github/stars/rse?logo=github&label=author%20stars&color=%233377aa)](https://github.com/rse)
8
+ [![github (author followers)](https://img.shields.io/github/followers/rse?label=author%20followers&logo=github&color=%234477aa)](https://github.com/rse)
9
+
10
+ About
11
+ -----
12
+
13
+ **Ink-Editor** is a text editor for the terminal, built on top of
14
+ [Ink](https://github.com/vadimdemedes/ink) and the *Textarea* widget of
15
+ [better-ink-ui](https://www.npmjs.com/package/better-ink-ui).
16
+ It provides the four exchangeable editing modes *Vim*, *Emacs*, *Nano*,
17
+ and *VS Code*, plus syntax highlighting via [Shiki](https://shiki.style/).
18
+
19
+ **Ink-Editor** is both a stand-alone text editor application
20
+ (`ink-editor`) and a library, providing the reusable `Editor`
21
+ widget for embedding the editor into your own Ink application.
22
+ The editing engines are dependency-free, i.e., they know nothing
23
+ about React, Ink, or any terminal, and are tested terminal-free.
24
+
25
+ Installation
26
+ ------------
27
+
28
+ **Ink-Editor** is published as a Node Package Manager (NPM) package
29
+ named [`@rse/ink-editor`](https://npmjs.com/@rse/ink-editor). Install it, as an
30
+ application, globally with the help of the NPM Command-Line Interface (CLI):
31
+
32
+ ```shell
33
+ $ npm install -g @rse/ink-editor
34
+ ```
35
+
36
+ Or install it, as a library, together with its peer dependencies Ink and React:
37
+
38
+ ```shell
39
+ $ npm install react ink @rse/ink-editor
40
+ ```
41
+
42
+ Application Usage
43
+ -----------------
44
+
45
+ ```txt
46
+ $ ink-editor [--mode=vim|emacs|nano|vscode] [--no-syntax] [<file>]
47
+ ```
48
+
49
+ - `--mode=<mode>`: the editing mode (default: `vim`).
50
+ - `--no-syntax`: disable the syntax highlighting.
51
+ - `<file>`: the file to edit (optional; created on the first write if it does not exist).
52
+
53
+ Line endings (LF/CRLF) and the final newline of a file are preserved on writing.
54
+
55
+ Library Usage
56
+ -------------
57
+
58
+ ```ts
59
+ import React from "react"
60
+ import { render } from "better-ink-ui"
61
+ import { Editor, editorModes } from "@rse/ink-editor"
62
+
63
+ function App () {
64
+ const [ value, setValue ] = React.useState("Hello World")
65
+ return React.createElement(Editor, {
66
+ value, onChange: setValue, height: 10, mode: editorModes.emacs
67
+ })
68
+ }
69
+ render(React.createElement(App))
70
+ ```
71
+
72
+ The `render` function of better-ink-ui wraps the standard input of Ink
73
+ in order to enable mouse input. The main exports are:
74
+
75
+ - `Editor`: the editor widget, driven by an editing mode.
76
+ Its properties are `value`, `onChange`, `height`, `width`, `focus`, `mode`,
77
+ `host` (file operations and quitting), `file`, and `syntax`.
78
+ - `editorModes`: the editing mode factories, by their name (`vim`, `emacs`, `nano`, `vscode`).
79
+ - `VimMode`, `EmacsMode`, `NanoMode`, `CodeMode`: the editing mode classes.
80
+ - `syntaxLanguage` and `syntaxLoad`: the detection of the language of a file
81
+ and the loading of its Shiki-based syntax highlighting.
82
+ - `EditorMode`, `EditorModeFactory`, `EditorHost`, `EditorResult`, etc.:
83
+ the TypeScript types of the contract between widget, host, and modes.
84
+
85
+ Development
86
+ -----------
87
+
88
+ ```shell
89
+ $ npm install
90
+ $ npm start build test
91
+ $ npm start run -- --mode=nano README.md
92
+ ```
93
+
94
+ License
95
+ -------
96
+
97
+ Copyright &copy; 2026 Dr. Ralf S. Engelschall (http://engelschall.com/)
98
+
99
+ Permission is hereby granted, free of charge, to any person obtaining
100
+ a copy of this software and associated documentation files (the
101
+ "Software"), to deal in the Software without restriction, including
102
+ without limitation the rights to use, copy, modify, merge, publish,
103
+ distribute, sublicense, and/or sell copies of the Software, and to
104
+ permit persons to whom the Software is furnished to do so, subject to
105
+ the following conditions:
106
+
107
+ The above copyright notice and this permission notice shall be included
108
+ in all copies or substantial portions of the Software.
109
+
110
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
111
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
112
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
113
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
114
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
115
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
116
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
117
+
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env node
2
+ /*
3
+ ** Ink-Editor -- Text Editor with Exchangeable Editing Modes for Ink
4
+ ** Copyright (c) 2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
5
+ **
6
+ ** Permission is hereby granted, free of charge, to any person obtaining
7
+ ** a copy of this software and associated documentation files (the
8
+ ** "Software"), to deal in the Software without restriction, including
9
+ ** without limitation the rights to use, copy, modify, merge, publish,
10
+ ** distribute, sublicense, and/or sell copies of the Software, and to
11
+ ** permit persons to whom the Software is furnished to do so, subject to
12
+ ** the following conditions:
13
+ **
14
+ ** The above copyright notice and this permission notice shall be included
15
+ ** in all copies or substantial portions of the Software.
16
+ **
17
+ ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
+ ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
+ ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+ */
25
+ /* text editor application, on top of the editor widget of the library
26
+ Usage: ink-editor [--mode=vim|emacs|nano|vscode] [--no-syntax] [<file>] */
27
+ /* external dependencies */
28
+ import fs from "node:fs";
29
+ import React from "react";
30
+ import { useApp, useWindowSize } from "ink";
31
+ import { render } from "better-ink-ui";
32
+ /* internal dependencies */
33
+ import { Editor, editorModes as modes, syntaxLanguage, syntaxLoad } from "./ink-editor";
34
+ const h = React.createElement;
35
+ /* statistics of the data of a file on disk */
36
+ const stats = (data) => {
37
+ const lines = data === "" ? 0 : data.split("\n").length - (data.endsWith("\n") ? 1 : 0);
38
+ return { lines, bytes: Buffer.byteLength(data) };
39
+ };
40
+ /* load a file, if it exists */
41
+ const load = (name) => {
42
+ if (name === "")
43
+ return { text: "", crlf: false, blank: false, result: null };
44
+ if (!fs.existsSync(name))
45
+ return { text: "", crlf: false, blank: false, result: { name, isNew: true, crlf: false, lines: 0, bytes: 0 } };
46
+ let text;
47
+ try {
48
+ text = fs.readFileSync(name, "utf8");
49
+ }
50
+ catch {
51
+ return { text: "", crlf: false, blank: false, result: { error: "read", detail: name } };
52
+ }
53
+ const info = stats(text);
54
+ const crlf = text.includes("\r\n");
55
+ if (crlf)
56
+ text = text.replaceAll("\r\n", "\n");
57
+ const blank = text === "\n";
58
+ if (text.endsWith("\n"))
59
+ text = text.slice(0, -1);
60
+ return { text, crlf, blank, result: { name, isNew: false, crlf, ...info } };
61
+ };
62
+ /* the editor application */
63
+ function App(props) {
64
+ const app = useApp();
65
+ const { rows } = useWindowSize();
66
+ /* the text */
67
+ const [value, setValue] = React.useState(props.file.text);
68
+ /* the current and saved text, the file name, and the line endings */
69
+ const valueRef = React.useRef(props.file.text);
70
+ const savedRef = React.useRef(props.file.text);
71
+ const nameRef = React.useRef(props.name);
72
+ const crlfRef = React.useRef(props.file.crlf);
73
+ const blankRef = React.useRef(props.file.blank);
74
+ /* the values are read through references, as the commands of the mode run before a re-render */
75
+ const onChange = (v) => {
76
+ valueRef.current = v;
77
+ setValue(v);
78
+ };
79
+ const modified = () => valueRef.current !== savedRef.current;
80
+ /* write the text to a file */
81
+ const write = (file, force, rename = false) => {
82
+ const target = file || nameRef.current;
83
+ if (target === "")
84
+ return { error: "noname", detail: "" };
85
+ const isNew = !fs.existsSync(target);
86
+ if (target !== nameRef.current && !isNew && !force)
87
+ return { error: "exists", detail: target };
88
+ const text = valueRef.current;
89
+ let data = text === "" && !blankRef.current ? "" : text + "\n";
90
+ if (crlfRef.current)
91
+ data = data.replaceAll("\n", "\r\n");
92
+ try {
93
+ fs.writeFileSync(target, data, "utf8");
94
+ }
95
+ catch (err) {
96
+ return { error: "write", detail: err instanceof Error ? err.message : String(err) };
97
+ }
98
+ if (nameRef.current === "" || rename)
99
+ nameRef.current = target;
100
+ if (target === nameRef.current)
101
+ savedRef.current = text;
102
+ return { name: target, isNew, crlf: crlfRef.current, ...stats(data) };
103
+ };
104
+ /* reload the text of the edited file */
105
+ const reload = () => {
106
+ const file = load(nameRef.current);
107
+ if (file.result === null)
108
+ return { error: "noname", detail: "" };
109
+ if ("error" in file.result)
110
+ return file.result;
111
+ valueRef.current = savedRef.current = file.text;
112
+ crlfRef.current = file.crlf;
113
+ blankRef.current = file.blank;
114
+ setValue(file.text);
115
+ return file.result;
116
+ };
117
+ /* the file operations and the quitting for the commands of the mode */
118
+ const host = {
119
+ name: () => nameRef.current,
120
+ modified,
121
+ write,
122
+ reload,
123
+ quit: (failed = false) => {
124
+ if (failed)
125
+ process.exitCode = 1;
126
+ app.exit();
127
+ }
128
+ };
129
+ /* the text area takes all rows except the one of the status line */
130
+ const height = Math.max(1, rows - 1);
131
+ return h(Editor, { value, onChange, height, mode: props.mode, host, file: props.file.result, syntax: props.syntax });
132
+ }
133
+ /* parse the command line */
134
+ let mode = "vim";
135
+ let highlight = true;
136
+ let name = "";
137
+ for (const arg of process.argv.slice(2)) {
138
+ if (arg.startsWith("--mode="))
139
+ mode = arg.slice(7);
140
+ else if (arg === "--no-syntax")
141
+ highlight = false;
142
+ else if (arg === "--syntax")
143
+ highlight = true;
144
+ else if (arg.startsWith("-") && arg !== "-") {
145
+ process.stderr.write(`ink-editor: ERROR: unknown option "${arg}"\nUsage: ink-editor [--mode=vim|emacs|nano|vscode] [--no-syntax] [<file>]\n`);
146
+ process.exit(1);
147
+ }
148
+ else if (name !== "") {
149
+ process.stderr.write("ink-editor: ERROR: only a single file can be edited\n");
150
+ process.exit(1);
151
+ }
152
+ else
153
+ name = arg;
154
+ }
155
+ if (!Object.hasOwn(modes, mode)) {
156
+ process.stderr.write(`ink-editor: ERROR: unknown mode "${mode}" (known: ${Object.keys(modes).join(", ")})\n`);
157
+ process.exit(1);
158
+ }
159
+ /* main entry point */
160
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
161
+ process.stderr.write("ink-editor: ERROR: standard input and output have to be a terminal\n");
162
+ process.exit(1);
163
+ }
164
+ const file = load(name);
165
+ /* load the syntax highlighting of the file's language, and tokenize the text once
166
+ before the first rendering, so editing afterwards re-tokenizes only changed lines */
167
+ const syntax = highlight && name !== "" ? await syntaxLoad(syntaxLanguage(name)) : null;
168
+ syntax?.(file.text);
169
+ const instance = render(h(App, { name, file, mode: modes[mode], syntax }), {
170
+ exitOnCtrlC: false,
171
+ alternateScreen: true
172
+ });
173
+ await instance.waitUntilExit();
174
+ process.exit();
@@ -0,0 +1,103 @@
1
+ import type { TextOps } from "./ink-editor-text";
2
+ export type EmacsOutcome = {
3
+ message: string;
4
+ error: boolean;
5
+ exists?: boolean;
6
+ };
7
+ export interface EmacsFiles {
8
+ name(): string;
9
+ modified(): boolean;
10
+ write(file: string, force: boolean, rename: boolean): EmacsOutcome;
11
+ reload(): EmacsOutcome;
12
+ quit(failed?: boolean): void;
13
+ }
14
+ export declare class Emacs {
15
+ emit: (value: string) => void;
16
+ clip: (text: string) => void;
17
+ files: EmacsFiles | null;
18
+ ops: TextOps;
19
+ height: number;
20
+ value: string;
21
+ off: number;
22
+ mark: number | null;
23
+ active: boolean;
24
+ message: string;
25
+ error: boolean;
26
+ private seen;
27
+ private pend;
28
+ private prefix;
29
+ private bare;
30
+ private esc;
31
+ private cmd;
32
+ private lastCmd;
33
+ private recorded;
34
+ private amalgam;
35
+ private undos;
36
+ private undoPtr;
37
+ private kills;
38
+ private yankRange;
39
+ private yankIdx;
40
+ private markRing;
41
+ private goal;
42
+ private mini;
43
+ private reader;
44
+ private is;
45
+ private qr;
46
+ private lastSearch;
47
+ private lastReplace;
48
+ private history;
49
+ private macroRec;
50
+ private macroStart;
51
+ private macro;
52
+ private depth;
53
+ constructor(value: string, ops: TextOps);
54
+ sync(value: string): void;
55
+ keys(tokens: string[]): boolean;
56
+ paste(text: string): void;
57
+ onText(value: string): void;
58
+ onCursor(cursor: [number, number]): void;
59
+ onSelect(sel: [number, number] | null): boolean;
60
+ selection(): [number, number] | null;
61
+ prompt(): string | null;
62
+ echo(): string;
63
+ searched(): string | null;
64
+ defining(): boolean;
65
+ private dispatch;
66
+ private bufferKey;
67
+ private argument;
68
+ private run;
69
+ private exec;
70
+ private chars;
71
+ private words;
72
+ private vertical;
73
+ private gotoLine;
74
+ private record;
75
+ private replace;
76
+ private insert;
77
+ private convert;
78
+ private fill;
79
+ private pushMark;
80
+ private region;
81
+ private deleteRegion;
82
+ private kill;
83
+ private pushKill;
84
+ private undo;
85
+ private ask;
86
+ private askYN;
87
+ private askYesNo;
88
+ private miniKey;
89
+ private need;
90
+ private outcome;
91
+ private writeFile;
92
+ private find;
93
+ private isearchKey;
94
+ private isearchEnd;
95
+ private queryStart;
96
+ private queryNext;
97
+ private queryReplace;
98
+ private queryEnd;
99
+ private queryKey;
100
+ private replaceAll;
101
+ protected say(text: string): void;
102
+ protected fail(text: string): void;
103
+ }