bunmicro 0.8.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 (237) hide show
  1. package/LICENSE +22 -0
  2. package/PORTING.md +34 -0
  3. package/README.md +153 -0
  4. package/bmi +5 -0
  5. package/bun.lock +17 -0
  6. package/bunmicro +5 -0
  7. package/hlw.md +5 -0
  8. package/package.json +18 -0
  9. package/runtime/colorschemes/atom-dark.micro +33 -0
  10. package/runtime/colorschemes/bubblegum.micro +31 -0
  11. package/runtime/colorschemes/cmc-16.micro +47 -0
  12. package/runtime/colorschemes/cmc-tc.micro +43 -0
  13. package/runtime/colorschemes/darcula.micro +34 -0
  14. package/runtime/colorschemes/default.micro +1 -0
  15. package/runtime/colorschemes/dracula-tc.micro +49 -0
  16. package/runtime/colorschemes/dukedark-tc.micro +38 -0
  17. package/runtime/colorschemes/dukelight-tc.micro +38 -0
  18. package/runtime/colorschemes/dukeubuntu-tc.micro +38 -0
  19. package/runtime/colorschemes/geany.micro +29 -0
  20. package/runtime/colorschemes/gotham.micro +29 -0
  21. package/runtime/colorschemes/gruvbox-tc.micro +29 -0
  22. package/runtime/colorschemes/gruvbox.micro +26 -0
  23. package/runtime/colorschemes/material-tc.micro +36 -0
  24. package/runtime/colorschemes/monokai-dark.micro +28 -0
  25. package/runtime/colorschemes/monokai.micro +34 -0
  26. package/runtime/colorschemes/one-dark.micro +39 -0
  27. package/runtime/colorschemes/railscast.micro +37 -0
  28. package/runtime/colorschemes/simple.micro +33 -0
  29. package/runtime/colorschemes/solarized-tc.micro +31 -0
  30. package/runtime/colorschemes/solarized.micro +30 -0
  31. package/runtime/colorschemes/sunny-day.micro +29 -0
  32. package/runtime/colorschemes/twilight.micro +40 -0
  33. package/runtime/colorschemes/zenburn.micro +30 -0
  34. package/runtime/help/actions.md +161 -0
  35. package/runtime/help/colors.md +421 -0
  36. package/runtime/help/commands.md +161 -0
  37. package/runtime/help/copypaste.md +149 -0
  38. package/runtime/help/defaultkeys.md +141 -0
  39. package/runtime/help/help.md +63 -0
  40. package/runtime/help/keybindings.md +760 -0
  41. package/runtime/help/linter.md +90 -0
  42. package/runtime/help/options.md +701 -0
  43. package/runtime/help/plugins.md +544 -0
  44. package/runtime/help/tutorial.md +112 -0
  45. package/runtime/jsplugins/chapter/chapter.js +108 -0
  46. package/runtime/jsplugins/diff/diff.js +46 -0
  47. package/runtime/jsplugins/example/example.js +108 -0
  48. package/runtime/jsplugins/linter/linter.js +281 -0
  49. package/runtime/plugins/autoclose/autoclose.lua +75 -0
  50. package/runtime/plugins/ftoptions/ftoptions.lua +17 -0
  51. package/runtime/plugins/literate/README.md +5 -0
  52. package/runtime/plugins/literate/literate.lua +55 -0
  53. package/runtime/plugins/status/help/status.md +21 -0
  54. package/runtime/plugins/status/status.lua +62 -0
  55. package/runtime/syntax/LICENSE +22 -0
  56. package/runtime/syntax/PowerShell.yaml +128 -0
  57. package/runtime/syntax/README.md +63 -0
  58. package/runtime/syntax/ada.yaml +43 -0
  59. package/runtime/syntax/apacheconf.yaml +59 -0
  60. package/runtime/syntax/arduino.yaml +101 -0
  61. package/runtime/syntax/asciidoc.yaml +51 -0
  62. package/runtime/syntax/asm.yaml +123 -0
  63. package/runtime/syntax/ats.yaml +99 -0
  64. package/runtime/syntax/awk.yaml +44 -0
  65. package/runtime/syntax/b.yaml +87 -0
  66. package/runtime/syntax/bat.yaml +57 -0
  67. package/runtime/syntax/c.yaml +60 -0
  68. package/runtime/syntax/caddyfile.yaml +23 -0
  69. package/runtime/syntax/cake.yaml +7 -0
  70. package/runtime/syntax/clojure.yaml +38 -0
  71. package/runtime/syntax/cmake.yaml +42 -0
  72. package/runtime/syntax/coffeescript.yaml +56 -0
  73. package/runtime/syntax/colortest.yaml +19 -0
  74. package/runtime/syntax/conky.yaml +17 -0
  75. package/runtime/syntax/cpp.yaml +91 -0
  76. package/runtime/syntax/crontab.yaml +36 -0
  77. package/runtime/syntax/crystal.yaml +72 -0
  78. package/runtime/syntax/csharp.yaml +52 -0
  79. package/runtime/syntax/css.yaml +44 -0
  80. package/runtime/syntax/csx.yaml +8 -0
  81. package/runtime/syntax/cuda.yaml +68 -0
  82. package/runtime/syntax/cython.yaml +52 -0
  83. package/runtime/syntax/d.yaml +121 -0
  84. package/runtime/syntax/dart.yaml +46 -0
  85. package/runtime/syntax/default.yaml +10 -0
  86. package/runtime/syntax/dockerfile.yaml +36 -0
  87. package/runtime/syntax/dot.yaml +29 -0
  88. package/runtime/syntax/elixir.yaml +30 -0
  89. package/runtime/syntax/elm.yaml +38 -0
  90. package/runtime/syntax/erb.yaml +42 -0
  91. package/runtime/syntax/erlang.yaml +45 -0
  92. package/runtime/syntax/fish.yaml +48 -0
  93. package/runtime/syntax/forth.yaml +34 -0
  94. package/runtime/syntax/fortran.yaml +64 -0
  95. package/runtime/syntax/freebsd-kernel.yaml +14 -0
  96. package/runtime/syntax/fsharp.yaml +48 -0
  97. package/runtime/syntax/gdscript.yaml +61 -0
  98. package/runtime/syntax/gemini.yaml +19 -0
  99. package/runtime/syntax/gentoo-ebuild.yaml +48 -0
  100. package/runtime/syntax/gentoo-etc-portage.yaml +23 -0
  101. package/runtime/syntax/git-commit.yaml +35 -0
  102. package/runtime/syntax/git-config.yaml +14 -0
  103. package/runtime/syntax/git-rebase-todo.yaml +19 -0
  104. package/runtime/syntax/gleam.yaml +69 -0
  105. package/runtime/syntax/glsl.yaml +26 -0
  106. package/runtime/syntax/gnuplot.yaml +15 -0
  107. package/runtime/syntax/go.yaml +62 -0
  108. package/runtime/syntax/godoc.yaml +17 -0
  109. package/runtime/syntax/golo.yaml +73 -0
  110. package/runtime/syntax/gomod.yaml +31 -0
  111. package/runtime/syntax/graphql.yaml +47 -0
  112. package/runtime/syntax/groff.yaml +30 -0
  113. package/runtime/syntax/groovy.yaml +111 -0
  114. package/runtime/syntax/haml.yaml +16 -0
  115. package/runtime/syntax/hare.yaml +52 -0
  116. package/runtime/syntax/haskell.yaml +52 -0
  117. package/runtime/syntax/hc.yaml +52 -0
  118. package/runtime/syntax/html.yaml +70 -0
  119. package/runtime/syntax/html4.yaml +25 -0
  120. package/runtime/syntax/html5.yaml +25 -0
  121. package/runtime/syntax/ini.yaml +23 -0
  122. package/runtime/syntax/inputrc.yaml +14 -0
  123. package/runtime/syntax/java.yaml +37 -0
  124. package/runtime/syntax/javascript.yaml +76 -0
  125. package/runtime/syntax/jinja2.yaml +19 -0
  126. package/runtime/syntax/json.yaml +39 -0
  127. package/runtime/syntax/jsonnet.yaml +92 -0
  128. package/runtime/syntax/julia.yaml +57 -0
  129. package/runtime/syntax/justfile.yaml +40 -0
  130. package/runtime/syntax/keymap.yaml +27 -0
  131. package/runtime/syntax/kickstart.yaml +16 -0
  132. package/runtime/syntax/kotlin.yaml +66 -0
  133. package/runtime/syntax/kvlang.yaml +67 -0
  134. package/runtime/syntax/ledger.yaml +14 -0
  135. package/runtime/syntax/lfe.yaml +17 -0
  136. package/runtime/syntax/lilypond.yaml +26 -0
  137. package/runtime/syntax/lisp.yaml +17 -0
  138. package/runtime/syntax/log.yaml +92 -0
  139. package/runtime/syntax/lua.yaml +111 -0
  140. package/runtime/syntax/mail.yaml +25 -0
  141. package/runtime/syntax/makefile.yaml +38 -0
  142. package/runtime/syntax/man.yaml +12 -0
  143. package/runtime/syntax/markdown.yaml +49 -0
  144. package/runtime/syntax/mc.yaml +23 -0
  145. package/runtime/syntax/meson.yaml +51 -0
  146. package/runtime/syntax/micro.yaml +34 -0
  147. package/runtime/syntax/mpdconf.yaml +13 -0
  148. package/runtime/syntax/msbuild.yaml +6 -0
  149. package/runtime/syntax/nanorc.yaml +16 -0
  150. package/runtime/syntax/nftables.yaml +30 -0
  151. package/runtime/syntax/nginx.yaml +22 -0
  152. package/runtime/syntax/nim.yaml +27 -0
  153. package/runtime/syntax/nix.yaml +32 -0
  154. package/runtime/syntax/nu.yaml +114 -0
  155. package/runtime/syntax/objc.yaml +60 -0
  156. package/runtime/syntax/ocaml.yaml +43 -0
  157. package/runtime/syntax/octave.yaml +83 -0
  158. package/runtime/syntax/odin.yaml +64 -0
  159. package/runtime/syntax/pascal.yaml +45 -0
  160. package/runtime/syntax/patch.yaml +14 -0
  161. package/runtime/syntax/peg.yaml +16 -0
  162. package/runtime/syntax/perl.yaml +58 -0
  163. package/runtime/syntax/php.yaml +60 -0
  164. package/runtime/syntax/pkg-config.yaml +12 -0
  165. package/runtime/syntax/po.yaml +12 -0
  166. package/runtime/syntax/pony.yaml +37 -0
  167. package/runtime/syntax/pov.yaml +21 -0
  168. package/runtime/syntax/privoxy-action.yaml +14 -0
  169. package/runtime/syntax/privoxy-config.yaml +10 -0
  170. package/runtime/syntax/privoxy-filter.yaml +12 -0
  171. package/runtime/syntax/proto.yaml +40 -0
  172. package/runtime/syntax/prql.yaml +84 -0
  173. package/runtime/syntax/puppet.yaml +22 -0
  174. package/runtime/syntax/python2.yaml +60 -0
  175. package/runtime/syntax/python3.yaml +62 -0
  176. package/runtime/syntax/r.yaml +32 -0
  177. package/runtime/syntax/raku.yaml +42 -0
  178. package/runtime/syntax/reST.yaml +18 -0
  179. package/runtime/syntax/renpy.yaml +15 -0
  180. package/runtime/syntax/rpmspec.yaml +43 -0
  181. package/runtime/syntax/ruby.yaml +73 -0
  182. package/runtime/syntax/rust.yaml +78 -0
  183. package/runtime/syntax/sage.yaml +60 -0
  184. package/runtime/syntax/scad.yaml +53 -0
  185. package/runtime/syntax/scala.yaml +33 -0
  186. package/runtime/syntax/sed.yaml +13 -0
  187. package/runtime/syntax/sh.yaml +69 -0
  188. package/runtime/syntax/sls.yaml +15 -0
  189. package/runtime/syntax/smalltalk.yaml +55 -0
  190. package/runtime/syntax/solidity.yaml +41 -0
  191. package/runtime/syntax/sql.yaml +35 -0
  192. package/runtime/syntax/stata.yaml +67 -0
  193. package/runtime/syntax/svelte.yaml +27 -0
  194. package/runtime/syntax/swift.yaml +103 -0
  195. package/runtime/syntax/systemd.yaml +16 -0
  196. package/runtime/syntax/tcl.yaml +18 -0
  197. package/runtime/syntax/terraform.yaml +87 -0
  198. package/runtime/syntax/tex.yaml +32 -0
  199. package/runtime/syntax/toml.yaml +56 -0
  200. package/runtime/syntax/twig.yaml +55 -0
  201. package/runtime/syntax/typescript.yaml +49 -0
  202. package/runtime/syntax/v.yaml +80 -0
  203. package/runtime/syntax/vala.yaml +26 -0
  204. package/runtime/syntax/verilog.yaml +60 -0
  205. package/runtime/syntax/vhdl.yaml +37 -0
  206. package/runtime/syntax/vi.yaml +31 -0
  207. package/runtime/syntax/vue.yaml +64 -0
  208. package/runtime/syntax/xml.yaml +37 -0
  209. package/runtime/syntax/xresources.yaml +14 -0
  210. package/runtime/syntax/yaml.yaml +34 -0
  211. package/runtime/syntax/yum.yaml +12 -0
  212. package/runtime/syntax/zig.yaml +52 -0
  213. package/runtime/syntax/zscript.yaml +72 -0
  214. package/runtime/syntax/zsh.yaml +52 -0
  215. package/src/buffer/buffer.js +126 -0
  216. package/src/buffer/loc.js +38 -0
  217. package/src/buffer/message.js +29 -0
  218. package/src/config/colorscheme.js +109 -0
  219. package/src/config/config.js +118 -0
  220. package/src/config/defaults.js +102 -0
  221. package/src/display/ansi-style.js +60 -0
  222. package/src/highlight/highlighter.js +237 -0
  223. package/src/highlight/parser.js +137 -0
  224. package/src/index.js +5942 -0
  225. package/src/lua/engine.js +38 -0
  226. package/src/platform/archive.js +50 -0
  227. package/src/platform/clipboard.js +160 -0
  228. package/src/platform/commands.js +140 -0
  229. package/src/plugins/js-bridge.js +902 -0
  230. package/src/plugins/manager.js +619 -0
  231. package/src/runtime/registry.js +89 -0
  232. package/src/screen/cell-buffer.js +81 -0
  233. package/src/screen/events.js +263 -0
  234. package/src/screen/screen.js +118 -0
  235. package/src/screen/vt100.js +391 -0
  236. package/src/shell/shell.js +70 -0
  237. package/todo.txt +359 -0
package/todo.txt ADDED
@@ -0,0 +1,359 @@
1
+ bunmicro 1:1 parity TODO
2
+ =========================
3
+
4
+ Goal
5
+ ----
6
+ Make bunmicro self-contained and behaviorally close to the Go micro editor while avoiding native bindings except where explicitly allowed. Runtime assets must stay under bunmicro/.
7
+
8
+ Current handoff notes
9
+ ---------------------
10
+ [x] --cat / --ccat / --bat / --glow flag: syntax-highlight file(s) and write to stdout, then exit.
11
+ - Uses the same detectSyntax path as the editor (path → firstLine/header → signature).
12
+ - .md files rendered via Bun.markdown.ansi.
13
+ - Falls back to raw output when no syntax definition matches.
14
+ - Reads from stdin when no positional args are given; header/shebang/signature detection still applies.
15
+ - Always emits ANSI codes regardless of TTY state.
16
+ - -profile removed from usage (flag parsed but never implemented in Go either; -debug kept for future log.txt work).
17
+ [x] Recent editor UX parity implemented:
18
+ - Tab autocomplete candidate row cycles highlight correctly and only highlights the selected candidate text.
19
+ - Tab autocomplete single-match case fixed: was silently no-op due to acHas=false; now inserts suffix directly.
20
+ - Mouse click on autocomplete candidates no longer moves the editor cursor to the click location.
21
+ - Rapid arrow-key chunks are split into individual key events; Shift+arrows create/extend selection.
22
+ - Mouse wheel scroll moves viewport without moving the cursor, and the cursor may scroll offscreen.
23
+ - Ctrl-R toggles line numbers/ruler.
24
+ - Ctrl-D duplicates line (no selection) or selection (has selection); Go DuplicateLine/Duplicate parity.
25
+ - Ctrl-L opens command bar pre-filled with "goto " (Go parity).
26
+ - Ctrl-Up/Ctrl-Down jump to start/end of file (Go CursorStart/CursorEnd parity).
27
+ - Shift-Ctrl-Up/Shift-Ctrl-Down extend selection to start/end of file.
28
+ - Ctrl-O now opens command bar pre-filled with "open " (consistent with Ctrl-H pre-filling "replace ").
29
+ - openCommandMode() accepts optional initial string parameter.
30
+ - Matchbrace highlights (), {}, [] and statusline column click cycles between matched braces when cursor is on a matched brace.
31
+ - Ctrl-C/Ctrl-X/Ctrl-V/Ctrl-Y work for line and selection clipboard flows; external clipboard failures fall back to the internal register.
32
+ - Copy/cut/paste and similar status messages render on a standalone info row above the statusline.
33
+ [x] replace/replaceall commands aligned with Go behavior:
34
+ - Flags: -a (replace all at once), -l (literal/no-regex, uses RegExp.escape).
35
+ - replace without -a shows interactive Y/N prompt per match (Perform replacement (y,n,esc)).
36
+ - replaceall is an alias for replace -a; both share the same code path.
37
+ - Regex compiled with (?m) always and (?i) when ignorecase setting is true.
38
+ - Capture groups ($1, $2) supported in replacement string (non-literal mode).
39
+ - Replace-to can be empty string via replace foo "" / replace foo '' / replace foo.
40
+ - Message format matches Go: "Replaced N occurrences of SEARCH" / "Nothing matched SEARCH" / "+ in selection".
41
+ - Selection-aware: if a selection is active, search/replace is bounded to that range.
42
+ - shellSplit now correctly emits empty tokens for "" and '' (POSIX-compliant quoted empty strings).
43
+ [x] Prompt history persisted to disk (Go parity):
44
+ - Saved to configDir/buffers/history.json (JSON; Go uses gob binary, not shared between versions).
45
+ - savehistory setting (default true) controls load/save; added to DEFAULT_GLOBAL_ONLY_SETTINGS.
46
+ - Loaded at startup; saved on exit via async stop() using Bun.file/Bun.write.
47
+ - Deduplication: earlier duplicate is removed, new entry appended to tail (matches Go behavior).
48
+ - Max 100 entries per prompt type (matches Go limit).
49
+ [x] Mouse click on Unicode (wide) characters now correctly positions cursor (visualColToCharIdx).
50
+ [x] Horizontal scroll for wide Unicode chars fixed: updateScrollForPane now uses displayWidth-based
51
+ visual column comparison instead of raw char index arithmetic (charIdxForScrollRight helper).
52
+ [x] Info bar message (buf.message) is cleared on every input event, fixing the bug where a "Found:"
53
+ or similar message from find/search would permanently persist after the next keystroke.
54
+ [x] Opening an HTTP/HTTPS URL then saving now prompts "Save as:" pre-filled with the URL basename
55
+ instead of trying to write to the URL string as a local path.
56
+ [x] reopen command supports HTTP/HTTPS buffers by re-fetching through the same backend as open.
57
+ [x] -version flag output now includes TTS command detection result.
58
+ [x] External file reload behavior implemented for active editor buffers: mtime tracking on open/save, reload setting prompt/auto/disabled, prompt text "File changed, reload? (y,n,esc)", y reloads from disk, n accepts disk mtime, esc disables future reload prompts for that buffer.
59
+ [x] Readonly status indication: existing files without write permission and buffers with readonly option render the statusline filename in red.
60
+ [x] Built-in comment behavior implemented natively: comment command, Alt-/ and Ctrl-_ key parsing, single-line and selection toggle, filetype-based comment.type fallback, and settings.json plugin option registration after plugin load.
61
+ [x] Syntax highlight performance improved for large/minified files:
62
+ - Render now uses per-buffer line highlight result/state cache instead of recomputing from line 0 for every visible line.
63
+ - Dirty cache invalidation is wired through main editing paths; structural edits force invalidation to avoid line-index drift.
64
+ - Lines over 300 chars keep their old cached highlight/state when dirtied, mark the row dirty, and defer full rehighlight until Esc.
65
+ - Dirty long lines render red in the gutter and in the statusline row field.
66
+ - Startup and Esc rehighlight show colorful bottom progress by highlighted character count, wrapped with Bun.wrapAnsi.
67
+ [!] Known follow-up: syntax detection still needs Go parity. todo.txt can be misdetected as filetype B because signatures are considered globally instead of only disambiguating filename/header matches.
68
+ [!] Known tool note: apply_patch is currently unreliable in this environment; use Bun scripts for small file edits.
69
+
70
+ Screen / tcell parity
71
+ ---------------------
72
+ [x] Replace current whole-string renderer with CellBuffer-backed rendering and diff flush.
73
+ [x] Implement Screen.SetContent/GetContent/Fill/Show equivalents over CellBuffer.
74
+ [x] Preserve per-cell style and wide-char handling: Cell.filler for double-width right-half, Screen.Show skips filler cells, putText/putCells advance col by visual width, setFillerContent added to Screen/CellBuffer.
75
+ [ ] Preserve combining chars (zero-width combining marks stored alongside base char).
76
+ [ ] Implement fake cursor and multi-cursor reverse styling behavior.
77
+ [ ] Add raw escape registration/unregistration equivalent to tcell RegisterRawSeq.
78
+ [~] Add complete bracketed paste event handling across split input chunks.
79
+ Done: bracketed paste events insert text, replace active selection, and show an info row paste status message.
80
+ Remaining: robust handling when bracketed paste start/end sequences arrive split across stdin chunks.
81
+ [~] Add robust partial escape-sequence buffering for keyboard/mouse input.
82
+ Done: lone ESC buffering exists; parseInputEvents now splits multiple key sequences in one chunk and supports Shift+arrows, Ctrl-A/C/V/X, Ctrl-R.
83
+ Remaining: general partial CSI/mouse sequence buffering across chunks and raw escape binding parity.
84
+ [~] Expand mouse support: drag selection actions, double click, right/middle click, wheel horizontal if available.
85
+ Done: mouse pane focus, drag selection, status/tab/suggestion clicks, wheel scroll without moving cursor and with cursor allowed offscreen.
86
+ Remaining: double click, right/middle actions, horizontal wheel, exact selection/action parity.
87
+ [ ] Add terminal focus/paste/mouse mode lifecycle edge-case cleanup on crash.
88
+ [ ] Add Windows/Android terminal capability fallbacks where ANSI/mouse sequences differ.
89
+
90
+ Buffer / editing model
91
+ ----------------------
92
+ [ ] Replace prototype BufferModel with BufferCore or merge them into one complete buffer implementation.
93
+ [ ] Implement line array equivalent with efficient insert/delete/replace for large files.
94
+ [~] Implement cursor object parity: selections, visual x, multi-cursor, relocation, word movement.
95
+ Done: basic single selection via mouse drag and Shift+arrows; selection rendering; copy/cut/delete/replace selection paths; Ctrl-Left/Right word movement; Shift-Ctrl-Left/Right extend selection by word; autoindent on newline (copies leading whitespace of current line, places cursor after indent).
96
+ Remaining: full cursor object parity, Ctrl-Backspace delete-word, visual x tracking, multi-cursor, relocation semantics.
97
+ [~] Implement undo/redo stack parity, including grouped edits.
98
+ Done: Ctrl-Z undo / Ctrl-Y redo; per-keypress snapshot with consecutive-char coalescing (up to 500 entries); Ctrl-X/K/V/paste/backspace/delete/enter each save their own snapshot; redoStack is cleared on any new edit.
99
+ Done: save-point tracking — each snapshot carries a serial; save() records _savedSerial; undo/redo clears modified flag when serial matches save point.
100
+ Remaining: grouped edits for large operations, undo history persistence.
101
+ [~] Implement save options: fileformat, encoding, eofnewline, rmtrailingws, mkparents, autosu/sucmd behavior.
102
+ Done: eofnewline save behavior exists; fileformat status/toggle exists; encoding decode/reopen supports Bun TextDecoder labels including common CJK encodings, and statusline encoding click pre-fills reopen with encoding completion.
103
+ Done: saving a non-UTF-8-decoded buffer prompts "Save in UTF-8?(y,n)" before converting the buffer to UTF-8 on disk.
104
+ Remaining: non-UTF-8 save/encode, rmtrailingws, mkparents, autosu/sucmd, full fileformat behavior parity.
105
+ [ ] Implement backup recovery and permbackup behavior.
106
+ [~] Implement savecursor and saveundo serialization.
107
+ Done: savecursor saves cursor position to configDir/buffers/cursor_state.json on Ctrl-S and on quit; position is restored when re-opening the same file; syncs from Go micro settings.json.
108
+ Done: savecursor restore now vertically centers the viewport on the restored cursor position (deferred via _pendingCenterScroll flag, resolved on first render after layout is computed; handles softwrap/non-softwrap via _ttsScrollToCenter).
109
+ Remaining: saveundo serialization.
110
+ [x] Implement reload prompt/auto/disabled behavior when file changes externally.
111
+ [x] Implement readonly handling (full):
112
+ - readonly status indication: filename rendered red for non-writable files / readonly buffers.
113
+ - save blocked with "Can't save under readonly mode" for all save paths (Ctrl-S, save command, save <file>).
114
+ - save -f bypasses readonly check (force save).
115
+ - open -r flag opens file in readonly mode; combinable with -f (open -f -r / open -r -f).
116
+ - set readonly is buffer-local only (LOCAL_SETTINGS); never written to global config file.
117
+ - LOCAL_SETTINGS = {readonly, filetype}: set command treats these as setlocal; saveSettings() strips them.
118
+ [x] Implement diff base and diff gutter rendering fully.
119
+ SetDiffBase/getDiffMarkers/computeDiffMarkers all implemented; diff.js JS plugin fetches git HEAD on onBufferOpen;
120
+ gutter renders ▌(add/mod) and ▔(del) markers using diff-added/diff-modified/diff-deleted colorscheme styles.
121
+ [~] Improve Unicode: East Asian width (isWideCodePoint covers CJK/Hangul/Kana/Emoji ranges, charWidth returns 2), surrogate-pair-safe moveLeft/moveRight/backspace/deleteForward/prompt-backspace all use codePointAt/charCodeAt surrogate detection, renderHighlightedCells iterates by code point not code unit.
122
+ Done: mouse click column-to-char mapping uses visualColToCharIdx (wide-char aware); horizontal scroll uses displayWidth comparison and charIdxForScrollRight instead of raw char index arithmetic.
123
+ Remaining: grapheme cluster support (combining marks, ZWJ sequences), visual x vs byte x cursor split.
124
+
125
+ Actions / commands / keybindings
126
+ --------------------------------
127
+ [~] Port full action command registry from internal/action/defaults.go and command.go.
128
+ Done: all 122 non-macro/non-multicursor BufPane actions registered in ACTIONS map (js-bridge.js).
129
+ Done: act / action command — calls any registered action by name; Tab-completes action names.
130
+ Done: raw command — toggles raw key inspection mode; each keypress shows key name + hex in statusbar; ESC exits.
131
+ Done: key bindings refactored to call registered actions where applicable.
132
+ Done: ctrl-w pane switch fixed (KEY_MAP was missing \x17 → "ctrl-w" mapping).
133
+ Done: ctrl-k (CutLine) cursor now resets to column 0 after cut, matching Go parity.
134
+ Done: alt-k/alt-j = MoveLinesUp/Down; alt-p/alt-t = PreviousTab/NextTab.
135
+ Missing (non-macro/multicursor): DeleteSubWordLeft, DeleteSubWordRight.
136
+ Remaining: bind/unbind runtime keybinding system, keybinding parser/tree, platform default binding files.
137
+ [ ] Port keybinding parser/tree, including raw escape bindings.
138
+ [ ] Port default keybindings for all supported platforms.
139
+ [~] Implement command bar, completions, history, and help/options completions.
140
+ Done: prompt history (in-memory and persisted to disk), command-name completion, set/setlocal option-name completion, file completion, buffer Tab autocomplete candidate bar with cycling and mouse selection.
141
+ Done: set colorscheme / theme command now have Tab completion listing all available colorschemes from runtime registry (context.runtime was missing from context — fixed).
142
+ Done: toggle/tog/togglelocal completion lists only toggleable options (boolean + 2-choice OPTION_CHOICES).
143
+ Done: reset completion lists all valid option names.
144
+ Done: help topic completion — Tab after "help " lists all runtime help files and -vsplit/-hsplit flags.
145
+ Remaining: richer option value completion, complete command-specific completion parity.
146
+ [x] Implement Ctrl-E CommandMode command bar with command/history/completion behavior.
147
+ [x] Implement filename completion in open/save prompts.
148
+ [~] Implement command execution semantics: set/setlocal, bind/unbind, open, save, quit, replace, find, help, plugin commands, etc.
149
+ Done: set/setlocal, open, save, quit/q, goto, find, replace (interactive Y/N + -a/-l flags), replaceall, cd/pwd, tab, vsplit/hsplit, term, tts, help.
150
+ Done: toggle/tog/togglelocal (Go parity): flips boolean options, cycles 2-choice options, errors on non-toggleable; toggle/tog save globally, togglelocal is buffer-local only.
151
+ Done: reset — resets option to default value, saves globally; handles colorscheme reload.
152
+ Done: theme command as alias for set colorscheme: loads and applies colorscheme immediately, saves to settings.json.
153
+ Done: set colorscheme now applies immediately (was broken: context.colorscheme not updated at runtime).
154
+ Done: jump — relative line jump from current cursor position (±offset).
155
+ Done: tabmove — moves current tab to absolute (1-based) or relative (±n) position.
156
+ Done: tabswitch — switches to tab by 1-based index or name.
157
+ Done: textfilter — pipes selection (or current line) through shell command, replaces with stdout.
158
+ Done: reload — reloads syntax definitions and colorscheme from runtime, re-attaches syntax to all open buffers.
159
+ Done: run — fixed to background execution (stdout+stderr shown in infobar), matching Go behavior.
160
+ Done: open command now replaces current pane buffer (Go parity); prompts Save?(y,n,esc) if modified.
161
+ Done: exit command — exit [code], skips save prompts, calls stop(code) directly.
162
+ Done: help command fully ported — topic args, -vsplit/-hsplit flags, helpsplit setting (default hsplit),
163
+ multiple topics force splits, "Sorry, no help for <topic>" error, replace-in-pane when already a help pane.
164
+ Done: open -r flag opens readonly; open -f -r combinable; save -f force-saves bypassing readonly.
165
+ Done: ttsspeed / ttspitch commands — set TTS_SPEED / TTS_PITCH env vars; no-arg shows current value.
166
+ Remaining: bind/unbind (stubs only — keybinding system not yet implemented), plugin commands, log/raw/help flags and full Go command semantics.
167
+ [x] Implement basic open/save/find/goto/quit prompt actions in the prototype editor loop.
168
+ [~] Implement tabs, splits, panes, BufPane/InfoPane/RawPane/TermPane APIs.
169
+ Done: vsplit/hsplit commands (Pane+SplitNode+Tab tree), term command (PTY pane),
170
+ Ctrl-W focus cycling, mouse pane focus, split divider rendering.
171
+ Done: Ctrl-Q / quit command now closes only the current pane when multiple panes exist in the tab;
172
+ falls back to closing the whole tab (or exiting) only when it is the last pane.
173
+ [x] Implement basic Ctrl-T AddTab, previous/next tab switching, clickable tabbar, and Ctrl-O replacement of empty untitled tabs.
174
+ [~] Implement statusline formatting expansion and status info functions fully.
175
+ Done: basic status row with filename/modified mark, cursor position, filetype, fileformat, encoding, keymenu toggle, clickable zones; messages now render in a separate info row above statusline.
176
+ Done: first three statusline field separators changed from | to ⧉ € $ (each clickable: ctrl-t addtab, ctrl-e cmdmode, ctrl-b shellmode).
177
+ Remaining: statusformat expansion, right-aligned format, plugin status info functions, inactive-pane status styling.
178
+ [~] Implement InfoBar prompt/message behavior close to Go micro.
179
+ Done: command/open/save/find/goto prompts, yes/no prompt (with onCancel callback), prompt history, incremental find prompt updates, completion candidate display, standalone info row for copy/cut/paste and other messages; buf.message cleared on every input event.
180
+ Done: Prompt now supports onCompletionSelect callback (fired on Tab/up/down selection change); used for live theme preview in command mode — Esc restores original colorscheme.
181
+ Done: Esc/Ctrl-C in non-YN prompts now correctly invokes onCancel.
182
+ Remaining: full InfoPane model, all prompt modes and completion behavior parity.
183
+
184
+ Lua plugin parity
185
+ -----------------
186
+ [~] Complete wasmoon bridge for import("micro"), import("micro/config"), import("micro/buffer"), import("micro/shell"), import("micro/util").
187
+ Done: wasmoon engine loads; import() dispatch exists for micro/config/buffer/shell/util plus a few stdlib-like shims; config runtime-file helpers and basic shell/buffer/util calls exist.
188
+ Remaining: many micro APIs are stubs or missing, shell jobs are not implemented, command/keybinding/config semantics are incomplete.
189
+ [~] Expose real BufPane, Cursor, Buffer, Tab, TabList objects with methods expected by plugins.
190
+ Done: minimal Buf/BufPane/Cursor adapters support autoclose-style Line/Insert/Replace/cursor movement and option access.
191
+ Remaining: real BufPane/Cursor/Buffer object parity, selections, multi-cursor, Tab/TabList APIs, InfoPane/Log/Raw buffers.
192
+ [~] Implement all plugin lifecycle hooks: preinit, init, postinit, onRune, preInsertNewline, preBackspace, onSave, onBufferOpen, onBufferOptionChanged, onAnyEvent, etc.
193
+ Done: preinit/init/postinit, onRune, preInsertNewline, preBackspace, onSave, onBufferOpen, onSetActive/onBufferClose are dispatched in current editor paths.
194
+ Remaining: onBufferOptionChanged, onAnyEvent, deinit/reload hooks, full action hook coverage, exact args/return behavior.
195
+ [~] Ensure Lua return values can cancel operations where Go micro expects bool false.
196
+ Done: PluginManager.runBool treats false as cancellation and is wired for preBackspace/preInsertNewline.
197
+ Remaining: all cancellable actions/hooks need to use the same path and match Go micro semantics.
198
+ [~] Implement Lua module/package behavior closely enough for existing micro plugins.
199
+ Done: module(name, package.seeall) compatibility shim and per-plugin environment loading.
200
+ Remaining: package/searcher behavior, require/import edge cases, plugin reload/unload compatibility.
201
+ [ ] Implement timers for micro.After with safe event-loop callback dispatch.
202
+ [~] Add plugin error reporting matching Go micro behavior.
203
+ Done: load/call errors are captured on plugin.error/loadError and plugin load failures disable/report during startup.
204
+ Remaining: InfoBar/log buffer reporting, per-plugin stack formatting, reload-time reporting parity.
205
+ [ ] Add tests loading built-in plugins and representative third-party plugins.
206
+
207
+ JS plugin API (js-bridge.js)
208
+ -----------------------------
209
+ [x] Flat buffer helpers: getLine, putLine, delLine, getLines, getLinesCount.
210
+ [x] getAllText() — entire buffer content as a single "\n"-joined string.
211
+ [x] putAllText(text) — replace entire buffer; normalises line endings, pushes undo.
212
+ [x] getSelection() / putSelection(text).
213
+ [x] micro.shell.<CMD>(...args) — Proxy that calls runInteractiveShell([cmd, ...args]);
214
+ args passed as array directly to Bun.spawn (no shellSplit, no quoting needed); async.
215
+ runInteractiveShell() accepts string (shellSplit path) or array (direct spawn).
216
+ [x] micro.action.<NAME>() Proxy for registered editor actions.
217
+ [x] micro.cmd.<name>() Proxy for handleCommand.
218
+ [x] micro.MakeCommand, micro.RegisterAction, micro.TermMessage, micro.alert, micro.Log,
219
+ micro.GetOption, micro.SetOption, micro.CurPane(), micro.on() hook registration.
220
+ [ ] micro.After(ms, fn) — timer callback dispatched safely into editor event loop.
221
+ [ ] Richer pane/buffer adapter methods on CurPane() result.
222
+
223
+ Built-in plugins
224
+ ----------------
225
+ [x] autoclose: wire onRune/preInsertNewline/preBackspace into real editing actions.
226
+ Fixed double-indent bug: autoclose preInsertNewline provides raw indent via buf:Insert, so
227
+ buffer.insert() now calls newline(false) to skip autoindent duplication.
228
+ [x] comment: implement command, selection handling, comment.type behavior, keybindings.
229
+ [x] diff: implement git HEAD base lookup, diff calculation, gutter rendering.
230
+ [~] ftoptions: already partially works on onBufferOpen; verify all filetype cases and option semantics.
231
+ [x] linter: full pipeline implemented.
232
+ - JobSpawn(cmd, luaArgs, onStdout, onStderr, onExit, ...userArgs) — Bun.spawn pipe, per-chunk
233
+ stdout/stderr streaming, onExit(output, userArgsTable) on exit (Go parity).
234
+ - JobStart(cmdStr, ...) — shell-splits string, same callback semantics.
235
+ - luaSeqToArray: normalises 0-indexed wasmoon array → plain JS array for argv building.
236
+ - Gutter message column (2 cols, Go parity): editorGutterWidth adds msgW=2 when buf.Messages
237
+ non-empty; renderGutter draws '> ' with gutter-error/warning/info colorscheme styles.
238
+ - diff and line-number columns shift right by msgW; existing click behavior unchanged.
239
+ - Clicking message column shows message text in infobar (buf.message).
240
+ - onBufferOptionChanged hook: SetOption/DoSetOptionNative capture oldValue and fire
241
+ _onOptionChange callback; attachSyntax wires _onOptionChange → plugins.run for every
242
+ buffer, covering filetype-change message cleanup and all other option-change plugins.
243
+ [ ] literate: support AddRuntimeFileFromMemory, Reload, UpdateRules, syntax re-detection.
244
+ [ ] status: implement SetStatusInfoFn and all status functions in statusline renderer.
245
+
246
+ Syntax highlighting / colors
247
+ ----------------------------
248
+ [~] Finish highlighter parity for nested regions, limit-group semantics, skip behavior, and state caching.
249
+ Done: per-buffer line result/state cache, render-time cache reuse, and optional progress callback inside highlighter regex scans.
250
+ Remaining: exact Go state propagation semantics, all nested/limit-group/skip corner cases, and complete syntax correctness parity.
251
+ [~] Add incremental rehighlight states/matches instead of recomputing from top for each rendered line.
252
+ Done: visible rendering no longer recomputes from top for every line; cache invalidates from edited line and lazily rebuilds.
253
+ Done: long dirty lines (>300 chars) retain old state/match until Esc, matching the intended minified-file responsiveness tradeoff.
254
+ Remaining: Go-style edit-time ReHighlightStates that scans down until state stabilizes, plus configurable long-line policy.
255
+ [ ] Reduce remaining regex compile failures from Go regexp syntax to JS regexp syntax.
256
+ [ ] Verify all runtime/syntax YAML files load and highlight representative examples.
257
+ [x] Handle multiline strings/comments exactly like Go highlighter.
258
+ Fixed root cause: scanTop re-entered the closing delimiter as a new region start after scanRegion
259
+ returned null. Fix: return null immediately after scanRegion closes (inner scanTop already handled rest of line).
260
+ [x] Connect colorscheme styles to CellBuffer cell styles rather than raw ANSI strings.
261
+ [~] Implement colorcolumn, cursor-line, match-brace, trailing whitespace, tab error, hlsearch, and gutter styles.
262
+ Done: search highlighting/incremental search; matchbrace for (), {}, [] with underline/highlight style and status-col click jumps between matched braces; cursor-line bg highlight (active pane, all visual rows in softwrap, pads full line width from colorscheme cursor-line style).
263
+ Done: trailing whitespace — trailingws setting (default false) controls highlighting; renderHighlightedCells applies "trailingws" colorscheme style (fallback: red+underline) to trailing spaces/tabs, overridden by search/brace/selection.
264
+ Remaining: colorcolumn, current-line-number gutter style, tab error, full gutter styles, hlsearch option parity.
265
+
266
+ Clipboard / platform integration
267
+ --------------------------------
268
+ [~] Verify Linux clipboard backends: wl-copy/wl-paste, xclip, xsel.
269
+ Done: backend detection and command wrappers exist; external read/write failures now fall back to internal register instead of breaking copy/paste.
270
+ Remaining: real platform verification for wl-copy/wl-paste, xclip, xsel.
271
+ [ ] Verify Android behavior only when process.platform reports android; Linux must not use Termux clipboard commands.
272
+ [ ] Verify macOS pbcopy/pbpaste and Windows PowerShell Set-Clipboard/Get-Clipboard.
273
+ [ ] Implement terminal OSC 52 clipboard method.
274
+ [ ] Implement primary selection behavior for Linux where applicable.
275
+ [~] Implement internal multi-register clipboard and multi-cursor clipboard parity.
276
+ Done: internal register map exists and is used as fallback; Ctrl-C/Ctrl-X/Ctrl-V/Ctrl-Y handle current selection and line copy/cut/paste.
277
+ Remaining: Go micro multi-register semantics, primary selection parity, multi-cursor clipboard behavior.
278
+
279
+ Shell / jobs / terminal pane
280
+ ----------------------------
281
+ [~] Complete shellquote.Split parity or improve POSIX shell lexer.
282
+ Done: shellSplit handles empty quoted tokens ("" / ''), backslash escapes, single/double quotes correctly.
283
+ Remaining: here-doc, process substitution, and other advanced shell constructs not needed for command bar.
284
+ [ ] Implement JobStart/JobSpawn/JobStop/JobSend with callbacks and user args.
285
+ [ ] Implement background job queue equivalent to shell.Jobs.
286
+ [ ] Implement interactive shell temp screen fini/start behavior.
287
+ [x] Implement Ctrl-B ShellMode prompt and shell command execution with temporary screen fini/start behavior.
288
+ [x] Improve Bun PTY terminal pane rendering using terminal state/cell emulation instead of raw line log.
289
+ VT100 class in src/screen/vt100.js: CSI cursor/erase/SGR/scroll, CPR response, OSC strip.
290
+ [ ] Implement terminal selection/copy and close behavior parity.
291
+ [ ] Verify Bun.spawn stdio usage everywhere; PTY terminal option remains separate.
292
+ [x] Shared HTTP backend in platform/commands.js: fetchHttp(url) and downloadFile(url, outPath).
293
+ Priority: Bun.which detects curl (curl -kL --silent --fail) or wget (wget --no-check-certificate -q -O -),
294
+ falls back to native fetch(). _httpBackend module-level cache so detection runs once.
295
+ Used by both loadBufferForPath (open URL) and plugin manager download paths.
296
+ [x] TTS platform parameters fully wired:
297
+ - Android termux-tts-speak: -p <pitch> -r <speed> (unchanged).
298
+ - macOS say: -r <wpm> (175×speed); pitch via [[pbas n]] text prefix (48×pitch, 0-127); applied via textTransform after sanitization.
299
+ - Windows SAPI: .Rate = n (±10, from speed); pitch via SSML <prosody pitch="+n%"> using SecurityElement.Escape for XML safety.
300
+ - Linux espeak/espeak-ng: --speed=<wpm> --pitch=<n> (0-99, 50=normal).
301
+ - ttsspeed / ttspitch commands set Bun.env.TTS_SPEED / TTS_PITCH; no-arg shows current value.
302
+
303
+ Runtime / config / plugin installer
304
+ -----------------------------------
305
+ [x] Keep all runtime assets self-contained under bunmicro/runtime.
306
+ [ ] Implement clean config behavior.
307
+ [x] Implement plugin install/remove/update/search/available/list fully.
308
+ pluginCommand dispatches: list, available (alias: avail), search, install, remove, update.
309
+ _fetchAllPackages fetches channel.json (JSON5) → repo URLs → PluginPackage arrays; cached in _packages.
310
+ _downloadAndInstall: downloadFile + extractAndStrip + write _installed_version.txt.
311
+ _installedVersion: reads _installed_version.txt or scans JSON metadata files in plugin dir.
312
+ [x] Implement plugin channel fetch, semver/version checks, zip extraction policy.
313
+ channel.json parsed with Bun.JSON5.parse (supports // comments). _compareSemver for version ordering.
314
+ extractAndStrip: extracts zip to temp dir, strips single top-level prefix directory, renames to destDir.
315
+ [x] Use macOS/Windows built-in tar for zip extraction; Linux/Android require unzip if not present.
316
+ extractZip: darwin/win32 use tar -xf; linux/android check hasCommand("unzip") and throw if missing.
317
+ [~] Implement runtime file override order exactly: user files override built-in assets.
318
+ Done: RuntimeRegistry loads user colorschemes/syntax/help before bundled runtime and skips duplicate bundled names.
319
+ Remaining: verify plugin/runtime kind parity and exact Go lookup ordering for every runtime kind.
320
+ [~] Implement settings write-back, modified/volatile settings, global/local/ft/glob settings.
321
+ Done: set writes global options to settings.json through Config.saveSettings; setlocal applies buffer-local values without global write-back.
322
+ Done: LOCAL_SETTINGS = {readonly, filetype} — set treats these as setlocal; saveSettings() never writes them; also strips any leaked keys from parsedSettings on next save.
323
+ Remaining: ft:/glob: settings application/write-back, exact Go modified/volatile semantics, and plugin option edge cases.
324
+ [~] Validate encodings and colorscheme names like Go micro.
325
+ Done: encoding values are validated with TextDecoder support.
326
+ Remaining: colorscheme validation and exact Go htmlindex encoding-name parity.
327
+
328
+ Display / UI behavior
329
+ ---------------------
330
+ [~] Implement softwrap, wordwrap, horizontal scrolling, scrollmargin, scrollbar.
331
+ Done: softwrap and wordwrap rendering (both non-softwrap and softwrap paths); softwrap/wordwrap settings now initialized from config on startup and persisted via set command.
332
+ Done additionally: scrollmargin applied in non-softwrap updateScrollForPane (keeps N lines of margin at top/bottom); softwrap scrollmargin deferred (needs backward row counting).
333
+ Fixed softwrap scroll-down cursor bug: cursor above scroll position now produces negative visualRowOffset
334
+ (using negated slocDiff) so cursorVisible=false, matching non-softwrap scroll-without-cursor behavior.
335
+ Remaining: horizontal scrolling, scrollbar.
336
+ [~] Implement line numbers/current-line-number/relative ruler behavior.
337
+ Done: ruler setting controls gutter visibility, Ctrl-R toggles line numbers with Go-style messages, relative ruler text is supported when setting is enabled.
338
+ Remaining: current-line-number styling and exact ruler option parity.
339
+ [~] Implement tabs display, split dividers, help split behavior, tab highlighting/reverse options.
340
+ Done: tabbar rendering with active tab style, split divider rendering, Ctrl-G help split toggle.
341
+ Done: help command fully ported — topics, -vsplit/-hsplit flags, helpsplit setting (default hsplit),
342
+ Ctrl-G uses hsplit, replace-in-pane when already a help buffer, "Sorry, no help for X" error.
343
+ Remaining: all tabbar/highlight/reverse options and exact help split policy parity.
344
+ [x] Implement basic tabbar display and active-tab highlighting for the current one-buffer-per-tab model.
345
+ [ ] Implement InfoPane/help/log/raw/info buffers.
346
+ [ ] Implement gutter messages with styles and line alignment.
347
+ [x] Implement search highlighting and incremental search.
348
+ [~] Implement matchbrace behavior and styles.
349
+ Done: brace matching/highlighting for (), {}, [] and statusline column click jump/cycle are implemented.
350
+ Remaining: exact Go style option parity and broader integration with gutter/cursor-line styling.
351
+
352
+ Testing / quality
353
+ -----------------
354
+ [ ] Add automated tests for platform command stdio, clipboard backend selection, archive policy.
355
+ [ ] Add tests for config JSON5, glob/ft settings, runtime registry override order.
356
+ [ ] Add tests for syntax detection/highlighting and colorscheme include/default style behavior.
357
+ [ ] Add tests for mouse SGR/X10 parsing, bracketed paste, key parsing, Shift+arrow selection, clipboard fallback, and partial sequence buffering.
358
+ [ ] Add tests for buffer editing, undo/redo, save/load, Unicode width, selection delete/copy/paste, and matchbrace.
359
+ [ ] Add smoke tests that run without depending on parent Go repo.