vimamsa 0.1.26 → 0.1.28
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.
- checksums.yaml +4 -4
- data/.github/workflows/appimage.yml +93 -0
- data/.gitignore +4 -1
- data/Dockerfile +7 -4
- data/README.md +195 -99
- data/custom_example.rb +59 -17
- data/doc/TODO.md +678 -0
- data/doc/action_names_plan.md +442 -0
- data/doc/bundling_plan.md +570 -0
- data/doc/delta_syntax_plan.md +293 -0
- data/doc/demo_recording_plan.md +288 -0
- data/doc/design_goals.md +27 -0
- data/doc/intro_page_plan.md +266 -0
- data/doc/key_bindings_report_plan.md +213 -0
- data/doc/line_tree_plan.md +89 -0
- data/doc/missing_vim_bindings.md +61 -0
- data/doc/modules_settings_plan.md +433 -0
- data/doc/refactor_dedup_plan.md +117 -0
- data/doc/registries_plan.md +202 -0
- data/doc/startup_speed_plan.md +97 -0
- data/doc/treap_visualizer.html +585 -0
- data/doc/unused_code_plan.md +120 -0
- data/doc/vim_compatibility_plan.md +451 -0
- data/doc/vimlike_vim_conflicts.md +262 -0
- data/doc/vm_snapshots_plan.md +146 -0
- data/doc/wysiwyg_plan.md +231 -0
- data/exe/run_tests.rb +124 -3
- data/exe/vimamsa +68 -5
- data/fonts/OFL-Oxanium.txt +93 -0
- data/fonts/Oxanium[wght].ttf +0 -0
- data/help/intro.txt +30 -0
- data/help/vim_intro.txt +31 -0
- data/icon.png +0 -0
- data/img/demo.gif +0 -0
- data/img/demo.mp4 +0 -0
- data/lang/hyperplaintext.lang +7 -1
- data/lib/vimamsa/ack.rb +13 -1
- data/lib/vimamsa/actions.rb +385 -37
- data/lib/vimamsa/appimage_env.rb +35 -0
- data/lib/vimamsa/audio.rb +2 -5
- data/lib/vimamsa/bookmarks.rb +302 -0
- data/lib/vimamsa/buffer.rb +675 -118
- data/lib/vimamsa/buffer_changetext.rb +150 -68
- data/lib/vimamsa/buffer_cursor.rb +7 -0
- data/lib/vimamsa/buffer_list.rb +6 -2
- data/lib/vimamsa/buffer_manager.rb +10 -7
- data/lib/vimamsa/bundled_fonts.rb +32 -0
- data/lib/vimamsa/cli_help.rb +75 -0
- data/lib/vimamsa/clipboard.rb +9 -3
- data/lib/vimamsa/conf.rb +68 -3
- data/lib/vimamsa/constants.rb +3 -0
- data/lib/vimamsa/crash_handler.rb +149 -0
- data/lib/vimamsa/debug.rb +6 -3
- data/lib/vimamsa/demo_player.rb +458 -0
- data/lib/vimamsa/demo_recorder.rb +277 -0
- data/lib/vimamsa/desktop_install.rb +96 -0
- data/lib/vimamsa/diff_buffer.rb +40 -11
- data/lib/vimamsa/dot_repeat.rb +104 -0
- data/lib/vimamsa/easy_jump.rb +57 -3
- data/lib/vimamsa/editor.rb +327 -78
- data/lib/vimamsa/encrypt.rb +78 -29
- data/lib/vimamsa/file_finder.rb +4 -19
- data/lib/vimamsa/file_history.rb +4 -1
- data/lib/vimamsa/file_manager.rb +46 -31
- data/lib/vimamsa/fold.rb +226 -0
- data/lib/vimamsa/form_input.rb +388 -0
- data/lib/vimamsa/gui.rb +603 -119
- data/lib/vimamsa/gui_command_line.rb +247 -0
- data/lib/vimamsa/gui_dialog.rb +94 -42
- data/lib/vimamsa/gui_file_panel.rb +356 -25
- data/lib/vimamsa/gui_form_generator.rb +75 -40
- data/lib/vimamsa/gui_func_panel.rb +67 -22
- data/lib/vimamsa/gui_image.rb +3 -0
- data/lib/vimamsa/gui_key_hint.rb +165 -0
- data/lib/vimamsa/gui_keylog_panel.rb +408 -0
- data/lib/vimamsa/gui_menu.rb +84 -53
- data/lib/vimamsa/gui_select_window.rb +80 -75
- data/lib/vimamsa/gui_settings.rb +86 -41
- data/lib/vimamsa/gui_sourceview.rb +280 -92
- data/lib/vimamsa/gui_sourceview_autocomplete.rb +319 -90
- data/lib/vimamsa/gui_text.rb +63 -2
- data/lib/vimamsa/gui_theme.rb +615 -0
- data/lib/vimamsa/hook.rb +5 -0
- data/lib/vimamsa/hyper_plain_text.rb +3 -0
- data/lib/vimamsa/intro_page.rb +368 -0
- data/lib/vimamsa/key_actions.rb +382 -193
- data/lib/vimamsa/key_binding_tree.rb +467 -273
- data/lib/vimamsa/key_bindings_notepad.rb +45 -0
- data/lib/vimamsa/key_bindings_report.rb +484 -0
- data/lib/vimamsa/key_bindings_vim.rb +104 -0
- data/lib/vimamsa/key_bindings_vimlike.rb +353 -289
- data/lib/vimamsa/key_names.rb +80 -0
- data/lib/vimamsa/langservp.rb +271 -54
- data/lib/vimamsa/line_tree.rb +367 -0
- data/lib/vimamsa/macro.rb +23 -3
- data/lib/vimamsa/main.rb +14 -8
- data/lib/vimamsa/rbvma.rb +41 -1
- data/lib/vimamsa/registers.rb +125 -0
- data/lib/vimamsa/run_ruby.rb +64 -0
- data/lib/vimamsa/search.rb +3 -0
- data/lib/vimamsa/search_replace.rb +15 -14
- data/lib/vimamsa/string_util.rb +134 -40
- data/lib/vimamsa/terminal.rb +3 -0
- data/lib/vimamsa/test_framework.rb +28 -2
- data/lib/vimamsa/tests.rb +11 -8
- data/lib/vimamsa/text_objects.rb +310 -0
- data/lib/vimamsa/text_transforms.rb +18 -0
- data/lib/vimamsa/tmp_user_dir.rb +39 -0
- data/lib/vimamsa/user_dirs.rb +83 -0
- data/lib/vimamsa/util.rb +46 -7
- data/lib/vimamsa/version.rb +1 -1
- data/lib/vimamsa/vim_core.rb +355 -0
- data/lib/vimamsa/vim_operators.rb +365 -0
- data/lib/vimamsa.rb +0 -1
- data/modules/calculator/calculator.rb +5 -5
- data/modules/color_highlight/color_highlight.rb +118 -0
- data/modules/color_highlight/color_highlight_info.rb +3 -0
- data/modules/dictation/dictation.rb +1054 -0
- data/modules/dictation/dictation_info.rb +3 -0
- data/modules/dictation/whisper_worker.py +273 -0
- data/modules/ollama/ollama.rb +107 -0
- data/modules/ollama/ollama_info.rb +3 -0
- data/modules/terminal/terminal.rb +5 -5
- data/modules/tts/tts.rb +119 -0
- data/modules/tts/tts_info.rb +3 -0
- data/run_e2e_vm.sh +28 -0
- data/run_tests_vm.rb +138 -0
- data/scripts/appimage/AppRun +54 -0
- data/scripts/appimage/Dockerfile +18 -0
- data/scripts/appimage/build.sh +19 -0
- data/scripts/appimage/build_in_container.sh +192 -0
- data/scripts/appimage/smoke_test.sh +27 -0
- data/scripts/demo/demo_easyjump_steps.txt +60 -0
- data/scripts/demo/demo_files_steps.txt +52 -0
- data/scripts/demo/demo_steps.txt +67 -0
- data/scripts/demo/notes.txt +6 -0
- data/scripts/demo/record_demo.rb +156 -0
- data/scripts/demo/report.rb +7 -0
- data/scripts/demo/shapes.rb +29 -0
- data/scripts/demo/square/shapes.rb +29 -0
- data/scripts/demo/square/steps.txt +185 -0
- data/scripts/lib/perf_startup.rb +138 -0
- data/scripts/lib/script_helpers.rb +53 -0
- data/scripts/perf_compare.rb +34 -0
- data/scripts/profile_startup.rb +72 -0
- data/styles/134272-molokai.xml +3 -0
- data/styles/molokai_cyber.xml +48 -0
- data/styles/molokai_edit.xml +1 -0
- data/tests/support/virtual_keyboard.rb +254 -0
- data/tests/support/virtual_mic.rb +67 -0
- data/tests/test_ack.rb +22 -0
- data/tests/test_action_ids.rb +232 -0
- data/tests/test_auto_format.rb +122 -0
- data/tests/test_autocomplete.rb +211 -0
- data/tests/test_autosave.rb +145 -0
- data/tests/test_basic_editing.rb +46 -16
- data/tests/test_bookmarks.rb +206 -0
- data/tests/test_bracket_match.rb +88 -0
- data/tests/test_bundling.rb +92 -0
- data/tests/test_cli_help.rb +64 -0
- data/tests/test_color_highlight.rb +92 -0
- data/tests/test_command_line.rb +79 -0
- data/tests/test_command_line_file.rb +27 -0
- data/tests/test_context_menu_file.rb +147 -0
- data/tests/test_copy_paste.rb +106 -26
- data/tests/test_crash_handler.rb +39 -0
- data/tests/test_custom_two_phase.rb +92 -0
- data/tests/test_demo_player.rb +301 -0
- data/tests/test_demo_recorder.rb +202 -0
- data/tests/test_dialog_callback_errors.rb +44 -0
- data/tests/test_dictation.rb +294 -0
- data/tests/test_diff_buffer_name.rb +51 -0
- data/tests/test_dot_repeat.rb +88 -0
- data/tests/test_double_click.rb +41 -0
- data/tests/test_drag_selection.rb +125 -0
- data/tests/test_e2e_cmdline.rb +116 -0
- data/tests/test_e2e_dictation.rb +98 -0
- data/tests/test_e2e_replace_char.rb +58 -0
- data/tests/test_easy_jump.rb +93 -0
- data/tests/test_extract_file_links.rb +55 -0
- data/tests/test_file_format.rb +217 -0
- data/tests/test_file_manager.rb +72 -0
- data/tests/test_file_panel.rb +269 -0
- data/tests/test_flash.rb +78 -0
- data/tests/test_fold.rb +111 -0
- data/tests/test_font_refresh.rb +56 -0
- data/tests/test_form_input.rb +203 -0
- data/tests/test_func_panel.rb +68 -0
- data/tests/test_grep_apply.rb +46 -0
- data/tests/test_gtk_sync.rb +126 -0
- data/tests/test_hpt_highlight_visible.rb +75 -0
- data/tests/test_hpt_link_highlight.rb +82 -0
- data/tests/test_intro_page.rb +437 -0
- data/tests/test_jump_to_file.rb +41 -0
- data/tests/test_key_bindings.rb +208 -0
- data/tests/test_key_categories.rb +163 -0
- data/tests/test_keylog_panel.rb +261 -0
- data/tests/test_line_ends.rb +51 -0
- data/tests/test_line_tree.rb +86 -0
- data/tests/test_lsp_clangd.rb +281 -0
- data/tests/test_lsp_jump.rb +87 -0
- data/tests/test_lsp_position_encoding.rb +49 -0
- data/tests/test_lsp_symbols.rb +68 -0
- data/tests/test_macro.rb +137 -0
- data/tests/test_markdown_highlight.rb +57 -0
- data/tests/test_mode_badge.rb +41 -0
- data/tests/test_module_interface.rb +9 -9
- data/tests/test_notepad_bindings.rb +67 -0
- data/tests/test_perf_startup.rb +28 -0
- data/tests/test_popup_queue.rb +51 -0
- data/tests/test_random_edit.rb +109 -0
- data/tests/test_registers.rb +122 -0
- data/tests/test_revert.rb +127 -0
- data/tests/test_run_ruby.rb +77 -0
- data/tests/test_startup_file.rb +58 -0
- data/tests/test_status_area.rb +50 -0
- data/tests/test_text_objects.rb +163 -0
- data/tests/test_text_transforms.rb +341 -0
- data/tests/test_tmp_user_dir.rb +79 -0
- data/tests/test_tts.rb +68 -0
- data/tests/test_undo.rb +34 -34
- data/tests/test_user_dirs.rb +122 -0
- data/tests/test_vim_bindings.rb +353 -0
- data/tests/test_vim_conflicts.rb +100 -0
- data/tests/test_vim_operators.rb +116 -0
- data/tests/test_window_layout.rb +302 -0
- data/vimamsa.gemspec +3 -1
- data/vm_guest_run.sh +129 -0
- metadata +167 -10
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# Vim keymap vs vimlike keymap
|
|
2
|
+
|
|
3
|
+
Generated by `vim_binding_conflicts_report` (lib/vimamsa/key_bindings_report.rb)
|
|
4
|
+
from `key_bindings_vim.rb` and `key_bindings_vimlike.rb`. Don't edit by hand:
|
|
5
|
+
run `VMA_UPDATE_DOC=1 ruby exe/run_tests.rb --headless vim_conflicts`.
|
|
6
|
+
|
|
7
|
+
Bindings that modules and `custom.rb` add at startup are not included.
|
|
8
|
+
|
|
9
|
+
| | Count |
|
|
10
|
+
|---|---|
|
|
11
|
+
| Conflicts (the vim binding can't be used in vimlike) | 42 |
|
|
12
|
+
| Added to vimlike from the shared table (`VIM_BINDINGS`, vim_core.rb) | 459 |
|
|
13
|
+
| Missing from vimlike (no conflict, could be added) | 0 |
|
|
14
|
+
| vim keymap only (left out of vimlike on purpose) | 1 |
|
|
15
|
+
| Shared (same keys, same action) | 152 |
|
|
16
|
+
|
|
17
|
+
## Conflicts
|
|
18
|
+
|
|
19
|
+
| Mode | Vim keys | Vim action | vimlike | Reason |
|
|
20
|
+
|---|---|---|---|---|
|
|
21
|
+
| C | <code>$</code> | <code>move.motion(line_end)</code> | <code>move.line.end</code> | same keys, other action |
|
|
22
|
+
| C | <code>@ @</code> | <code>macro.run.last</code> | <code>@ <char></code> <code>macro.run</code> | a vimlike <char> binding takes the key |
|
|
23
|
+
| C | <code>C</code> | <code>edit.change.eol</code> | <code>grep.files</code> | same keys, other action |
|
|
24
|
+
| C | <code>O</code> | <code>edit.line.above</code> | <code>move.line.end</code> | same keys, other action |
|
|
25
|
+
| C | <code>X</code> | <code>edit.delete.char.prev</code> | <code>edit.line.below</code> | same keys, other action |
|
|
26
|
+
| C | <code>^</code> | <code>move.line.first_char</code> | <code>move.line.start</code> | same keys, other action |
|
|
27
|
+
| C | <code>backspace</code> | <code>move.char.prev</code> | <code>edit.backspace</code> | same keys, other action |
|
|
28
|
+
| C | <code>ctrl-o</code> | <code>jump.edit.prev</code> | <code>file.open</code> | same keys, other action |
|
|
29
|
+
| C | <code>d $</code> | <code>op.motion(delete, line_end)</code> | <code>edit.delete.eol</code> | same keys, other action |
|
|
30
|
+
| C | <code>d ' <char></code> | <code>op.motion(delete, mark_line)</code> | <code>edit.delete.mark</code> | same keys, other action |
|
|
31
|
+
| C | <code>d 0</code> | <code>op.motion(delete, line_start)</code> | <code>edit.delete.line.start</code> | same keys, other action |
|
|
32
|
+
| C | <code>d <num> e</code> | <code>op.motion(delete, word_end)</code> | <code>edit.delete.word.end</code> | same keys, other action |
|
|
33
|
+
| C | <code>d F <char></code> | <code>op.motion(delete, find_char_back)</code> | <code>edit.delete.find.prev</code> | same keys, other action |
|
|
34
|
+
| C | <code>d F space</code> | <code>op.motion(delete, find_char_back, " ")</code> | <code>edit.delete.space.prev</code> | same keys, other action |
|
|
35
|
+
| C | <code>d d</code> | <code>op.lines(delete)</code> | <code>edit.delete.line</code> | same keys, other action |
|
|
36
|
+
| C | <code>d e</code> | <code>op.motion(delete, word_end)</code> | <code>edit.delete.word.end</code> | same keys, other action |
|
|
37
|
+
| C | <code>d f <char></code> | <code>op.motion(delete, find_char)</code> | <code>edit.delete.find.next</code> | same keys, other action |
|
|
38
|
+
| C | <code>d f space</code> | <code>op.motion(delete, find_char, " ")</code> | <code>edit.delete.space.next</code> | same keys, other action |
|
|
39
|
+
| C | <code>d w</code> | <code>op.motion(delete, word_next)</code> | <code>edit.delete.word.next</code> | same keys, other action |
|
|
40
|
+
| C | <code>g U U</code> | <code>op.lines(upcase)</code> | <code>case.line.upper</code> | same keys, other action |
|
|
41
|
+
| C | <code>g U w</code> | <code>op.motion(upcase, word_next)</code> | <code>case.word.upper</code> | same keys, other action |
|
|
42
|
+
| C | <code>g u u</code> | <code>op.lines(downcase)</code> | <code>case.line.lower</code> | same keys, other action |
|
|
43
|
+
| C | <code>g u w</code> | <code>op.motion(downcase, word_next)</code> | <code>case.word.lower</code> | same keys, other action |
|
|
44
|
+
| C | <code>g ~ w</code> | <code>op.motion(swapcase, word_next)</code> | <code>case.word.swap</code> | same keys, other action |
|
|
45
|
+
| C | <code>g ~ ~</code> | <code>op.lines(swapcase)</code> | <code>case.line.swap</code> | same keys, other action |
|
|
46
|
+
| C | <code>s</code> | <code>edit.change.char</code> | <code>jump.easy</code> | same keys, other action |
|
|
47
|
+
| C | <code>space</code> | <code>move.char.next</code> | <code>2 longer bindings</code> | vimlike uses these keys as a prefix |
|
|
48
|
+
| C | <code>x</code> | <code>edit.delete.char.inline</code> | <code>edit.delete.char</code> | same keys, other action |
|
|
49
|
+
| C | <code>y ' <char></code> | <code>op.motion(yank, mark_line)</code> | <code>edit.copy.mark</code> | same keys, other action |
|
|
50
|
+
| C | <code>y 0</code> | <code>op.motion(yank, line_start)</code> | <code>edit.copy.line.start</code> | same keys, other action |
|
|
51
|
+
| C | <code>y e</code> | <code>op.motion(yank, word_end)</code> | <code>edit.copy.word.end</code> | same keys, other action |
|
|
52
|
+
| C | <code>y y</code> | <code>op.lines(yank)</code> | <code>edit.line.copy</code> | same keys, other action |
|
|
53
|
+
| C | <code>z z</code> | <code>view.center</code> | <code>z</code> <code>mode.browse</code> | a shorter vimlike binding runs first |
|
|
54
|
+
| I | <code>ctrl-c</code> | <code>mode.prev</code> | <code>sel.copy</code> | same keys, other action |
|
|
55
|
+
| I | <code>ctrl-h</code> | <code>edit.backspace</code> | <code>edit.complete</code> | same keys, other action |
|
|
56
|
+
| I | <code>ctrl-j</code> | <code>edit.newline</code> | <code>edit.complete.hide</code> | same keys, other action |
|
|
57
|
+
| I | <code>ctrl-n</code> | <code>edit.complete</code> | <code>move.line.next</code> | same keys, other action |
|
|
58
|
+
| I | <code>ctrl-p</code> | <code>edit.complete</code> | <code>move.line.prev</code> | same keys, other action |
|
|
59
|
+
| V | <code>$</code> | <code>move.motion(line_end)</code> | <code>move.line.end</code> | same keys, other action |
|
|
60
|
+
| V | <code>^</code> | <code>move.line.first_char</code> | <code>move.line.start</code> | same keys, other action |
|
|
61
|
+
| V | <code>ctrl-c</code> | <code>mode.visual.exit</code> | <code>edit.comment</code> | same keys, other action |
|
|
62
|
+
| V | <code>s</code> | <code>sel.change</code> | <code>jump.easy</code> | same keys, other action |
|
|
63
|
+
|
|
64
|
+
## Added to vimlike
|
|
65
|
+
|
|
66
|
+
Vim bindings that vimlike loads from the shared table because nothing of
|
|
67
|
+
its own is in the way. A template (`<op> <motion>`, vim_operators.rb) is one row with
|
|
68
|
+
the number of its combinations that vimlike got.
|
|
69
|
+
|
|
70
|
+
| Mode | Vim keys | Vim action |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| C | <code>" <char></code> | <code>edit.register</code> |
|
|
73
|
+
| C | <code>.</code> | <code>undo.repeat</code> |
|
|
74
|
+
| C | <code><op> <motion> (384 combinations)</code> | <code>op.motion</code> |
|
|
75
|
+
| C | <code><op> <same> (11 combinations)</code> | <code>op.lines</code> |
|
|
76
|
+
| C | <code><op> <textobj> (32 combinations)</code> | <code>op.textobj</code> |
|
|
77
|
+
| C | <code><motion> (7 combinations)</code> | <code>move.motion</code> |
|
|
78
|
+
| C | <code>D</code> | <code>edit.delete.eol</code> |
|
|
79
|
+
| C | <code>S</code> | <code>edit.change.line</code> |
|
|
80
|
+
| C | <code>Y</code> | <code>edit.line.copy</code> |
|
|
81
|
+
| C | <code>` <char></code> | <code>mark.jump</code> |
|
|
82
|
+
| C | <code>ctrl-a</code> | <code>edit.word.increment</code> |
|
|
83
|
+
| C | <code>ctrl-b</code> | <code>move.page.prev</code> |
|
|
84
|
+
| C | <code>ctrl-d</code> | <code>move.page.next.cursor</code> |
|
|
85
|
+
| C | <code>ctrl-f</code> | <code>move.page.next</code> |
|
|
86
|
+
| C | <code>ctrl-u</code> | <code>move.page.prev.cursor</code> |
|
|
87
|
+
| V | <code>" <char></code> | <code>edit.register</code> |
|
|
88
|
+
| V | <code><</code> | <code>sel.indent.less</code> |
|
|
89
|
+
| V | <code>></code> | <code>sel.indent.more</code> |
|
|
90
|
+
| V | <code><motion> (8 combinations)</code> | <code>move.motion</code> |
|
|
91
|
+
| V | <code><textobj> (2 combinations)</code> | <code>sel.textobj</code> |
|
|
92
|
+
| V | <code>c</code> | <code>sel.change</code> |
|
|
93
|
+
|
|
94
|
+
## Missing from vimlike
|
|
95
|
+
|
|
96
|
+
| Mode | Vim keys | Vim action |
|
|
97
|
+
|---|---|---|
|
|
98
|
+
|
|
99
|
+
## vim keymap only
|
|
100
|
+
|
|
101
|
+
Left out of vimlike on purpose (`VIM_KEYMAP_ONLY`, vim_core.rb).
|
|
102
|
+
|
|
103
|
+
| Mode | Vim keys | Vim action | Why |
|
|
104
|
+
|---|---|---|---|
|
|
105
|
+
| I | <code>ctrl-r <char></code> | <code>edit.insert.register</code> | no new ctrl chords in vimlike |
|
|
106
|
+
|
|
107
|
+
## Shared
|
|
108
|
+
|
|
109
|
+
| Mode | Keys | Action |
|
|
110
|
+
|---|---|---|
|
|
111
|
+
| B | <code>;</code> | <code>jump.edit.prev</code> |
|
|
112
|
+
| B | <code>c</code> | <code>buf.close</code> |
|
|
113
|
+
| B | <code>ctrl!</code> | <code>mode.browse.exit</code> |
|
|
114
|
+
| B | <code>d</code> | <code>move.page.next</code> |
|
|
115
|
+
| B | <code>e</code> | <code>move.page.prev.quarter</code> |
|
|
116
|
+
| B | <code>enter</code> | <code>mode.browse.exit</code> |
|
|
117
|
+
| B | <code>esc</code> | <code>mode.browse.exit</code> |
|
|
118
|
+
| B | <code>h</code> | <code>buf.history.prev</code> |
|
|
119
|
+
| B | <code>i</code> | <code>move.buf.start</code> |
|
|
120
|
+
| B | <code>j</code> | <code>mode.browse.exit</code> |
|
|
121
|
+
| B | <code>l</code> | <code>buf.history.next</code> |
|
|
122
|
+
| B | <code>m</code> | <code>macro.run.last</code> |
|
|
123
|
+
| B | <code>n</code> | <code>panel.files.next</code> |
|
|
124
|
+
| B | <code>o</code> | <code>move.buf.end</code> |
|
|
125
|
+
| B | <code>p</code> | <code>panel.files.prev</code> |
|
|
126
|
+
| B | <code>q</code> | <code>jump.edit.prev</code> |
|
|
127
|
+
| B | <code>r</code> | <code>move.page.next.quarter</code> |
|
|
128
|
+
| B | <code>return</code> | <code>mode.browse.exit</code> |
|
|
129
|
+
| B | <code>s</code> | <code>move.page.prev</code> |
|
|
130
|
+
| B | <code>w</code> | <code>jump.edit.next</code> |
|
|
131
|
+
| B | <code>z</code> | <code>mode.browse.center</code> |
|
|
132
|
+
| C | <code>' <char></code> | <code>mark.jump</code> |
|
|
133
|
+
| C | <code>*</code> | <code>search.word.next</code> |
|
|
134
|
+
| C | <code>/</code> | <code>search.buf</code> |
|
|
135
|
+
| C | <code>/[1-9]/</code> | <code>kbd.count.digit</code> |
|
|
136
|
+
| C | <code>0(vma.kbd.next_command_count!=nil)</code> | <code>kbd.count.digit</code> |
|
|
137
|
+
| C | <code>0(vma.kbd.next_command_count==nil)</code> | <code>move.line.start</code> |
|
|
138
|
+
| C | <code>:</code> | <code>mode.cmdline</code> |
|
|
139
|
+
| C | <code>;</code> | <code>jump.char.repeat</code> |
|
|
140
|
+
| C | <code>@ <char></code> | <code>macro.run</code> |
|
|
141
|
+
| C | <code>A</code> | <code>mode.insert.line.end</code> |
|
|
142
|
+
| C | <code>F <char></code> | <code>jump.char.prev</code> |
|
|
143
|
+
| C | <code>F space</code> | <code>jump.space.prev</code> |
|
|
144
|
+
| C | <code>G</code> | <code>move.buf.end</code> |
|
|
145
|
+
| C | <code>G(vma.kbd.next_command_count!=nil)</code> | <code>move.line.goto</code> |
|
|
146
|
+
| C | <code>I</code> | <code>mode.insert.line.start</code> |
|
|
147
|
+
| C | <code>J</code> | <code>edit.line.join</code> |
|
|
148
|
+
| C | <code>N</code> | <code>search.prev</code> |
|
|
149
|
+
| C | <code>P</code> | <code>edit.paste.before</code> |
|
|
150
|
+
| C | <code>R</code> | <code>mode.replace</code> |
|
|
151
|
+
| C | <code>a</code> | <code>mode.insert.after</code> |
|
|
152
|
+
| C | <code>alt-h</code> | <code>panel.files.prev</code> |
|
|
153
|
+
| C | <code>alt-l</code> | <code>panel.files.next</code> |
|
|
154
|
+
| C | <code>b</code> | <code>move.word.prev</code> |
|
|
155
|
+
| C | <code>ctrl-r</code> | <code>undo.redo</code> |
|
|
156
|
+
| C | <code>down</code> | <code>move.line.next</code> |
|
|
157
|
+
| C | <code>e</code> | <code>move.word.end</code> |
|
|
158
|
+
| C | <code>enter</code> | <code>jump.line</code> |
|
|
159
|
+
| C | <code>f <char></code> | <code>jump.char.next</code> |
|
|
160
|
+
| C | <code>f space</code> | <code>jump.space.next</code> |
|
|
161
|
+
| C | <code>g ;</code> | <code>jump.edit.prev</code> |
|
|
162
|
+
| C | <code>g g</code> | <code>move.buf.start</code> |
|
|
163
|
+
| C | <code>h</code> | <code>move.char.prev</code> |
|
|
164
|
+
| C | <code>i</code> | <code>mode.insert</code> |
|
|
165
|
+
| C | <code>j</code> | <code>move.line.next</code> |
|
|
166
|
+
| C | <code>k</code> | <code>move.line.prev</code> |
|
|
167
|
+
| C | <code>l</code> | <code>move.char.next</code> |
|
|
168
|
+
| C | <code>left</code> | <code>move.char.prev</code> |
|
|
169
|
+
| C | <code>m <char></code> | <code>mark.set</code> |
|
|
170
|
+
| C | <code>n</code> | <code>search.next</code> |
|
|
171
|
+
| C | <code>o</code> | <code>mode.insert.line.below</code> |
|
|
172
|
+
| C | <code>p</code> | <code>edit.paste.after</code> |
|
|
173
|
+
| C | <code>pagedown</code> | <code>move.page.next</code> |
|
|
174
|
+
| C | <code>pageup</code> | <code>move.page.prev</code> |
|
|
175
|
+
| C | <code>q <char></code> | <code>macro.record</code> |
|
|
176
|
+
| C | <code>r <char></code> | <code>edit.replace.char</code> |
|
|
177
|
+
| C | <code>r space</code> | <code>edit.replace.space</code> |
|
|
178
|
+
| C | <code>return</code> | <code>jump.line</code> |
|
|
179
|
+
| C | <code>right</code> | <code>move.char.next</code> |
|
|
180
|
+
| C | <code>tab</code> | <code>buf.switch.last</code> |
|
|
181
|
+
| C | <code>u</code> | <code>undo.last</code> |
|
|
182
|
+
| C | <code>up</code> | <code>move.line.prev</code> |
|
|
183
|
+
| C | <code>v</code> | <code>mode.visual</code> |
|
|
184
|
+
| C | <code>w</code> | <code>move.word.next</code> |
|
|
185
|
+
| C | <code>~</code> | <code>case.char.toggle</code> |
|
|
186
|
+
| I | <code><char></code> | <code>edit.insert.char</code> |
|
|
187
|
+
| I | <code>backspace</code> | <code>edit.backspace</code> |
|
|
188
|
+
| I | <code>ctrl-space</code> | <code>edit.complete</code> |
|
|
189
|
+
| I | <code>down</code> | <code>move.line.next.unselect</code> |
|
|
190
|
+
| I | <code>enter</code> | <code>edit.newline</code> |
|
|
191
|
+
| I | <code>esc</code> | <code>mode.prev</code> |
|
|
192
|
+
| I | <code>left</code> | <code>move.char.prev.unselect</code> |
|
|
193
|
+
| I | <code>pagedown</code> | <code>move.page.next.unselect</code> |
|
|
194
|
+
| I | <code>pageup</code> | <code>move.page.prev.unselect</code> |
|
|
195
|
+
| I | <code>right</code> | <code>move.char.next.unselect</code> |
|
|
196
|
+
| I | <code>shift!(vma.buf.view.autocp_active)</code> | <code>edit.complete.accept</code> |
|
|
197
|
+
| I | <code>shift-down</code> | <code>sel.line.next</code> |
|
|
198
|
+
| I | <code>shift-left</code> | <code>sel.char.prev</code> |
|
|
199
|
+
| I | <code>shift-pagedown</code> | <code>sel.page.next</code> |
|
|
200
|
+
| I | <code>shift-pageup</code> | <code>sel.page.prev</code> |
|
|
201
|
+
| I | <code>shift-right</code> | <code>sel.char.next</code> |
|
|
202
|
+
| I | <code>shift-tab</code> | <code>edit.untab</code> |
|
|
203
|
+
| I | <code>shift-tab(vma.buf.view.autocp_active)</code> | <code>edit.complete.prev</code> |
|
|
204
|
+
| I | <code>shift-up</code> | <code>sel.line.prev</code> |
|
|
205
|
+
| I | <code>space</code> | <code>edit.insert.space</code> |
|
|
206
|
+
| I | <code>tab</code> | <code>edit.tab</code> |
|
|
207
|
+
| I | <code>tab(vma.buf.view.autocp_active)</code> | <code>edit.complete.next</code> |
|
|
208
|
+
| I | <code>up</code> | <code>move.line.prev.unselect</code> |
|
|
209
|
+
| R | <code><char></code> | <code>readchar_new_char(<char>)</code> |
|
|
210
|
+
| V | <code>' <char></code> | <code>mark.jump</code> |
|
|
211
|
+
| V | <code>*</code> | <code>search.word.next</code> |
|
|
212
|
+
| V | <code>/</code> | <code>search.buf</code> |
|
|
213
|
+
| V | <code>/[1-9]/</code> | <code>kbd.count.digit</code> |
|
|
214
|
+
| V | <code>0(vma.kbd.next_command_count!=nil)</code> | <code>kbd.count.digit</code> |
|
|
215
|
+
| V | <code>0(vma.kbd.next_command_count==nil)</code> | <code>move.line.start</code> |
|
|
216
|
+
| V | <code>;</code> | <code>jump.char.repeat</code> |
|
|
217
|
+
| V | <code>F <char></code> | <code>jump.char.prev</code> |
|
|
218
|
+
| V | <code>F space</code> | <code>jump.space.prev</code> |
|
|
219
|
+
| V | <code>G</code> | <code>move.buf.end</code> |
|
|
220
|
+
| V | <code>G(vma.kbd.next_command_count!=nil)</code> | <code>move.line.goto</code> |
|
|
221
|
+
| V | <code>J</code> | <code>sel.join</code> |
|
|
222
|
+
| V | <code>U</code> | <code>case.sel.upper</code> |
|
|
223
|
+
| V | <code>b</code> | <code>move.word.prev</code> |
|
|
224
|
+
| V | <code>d</code> | <code>sel.delete</code> |
|
|
225
|
+
| V | <code>down</code> | <code>move.line.next</code> |
|
|
226
|
+
| V | <code>e</code> | <code>move.word.end</code> |
|
|
227
|
+
| V | <code>esc</code> | <code>mode.visual.exit</code> |
|
|
228
|
+
| V | <code>f <char></code> | <code>jump.char.next</code> |
|
|
229
|
+
| V | <code>f space</code> | <code>jump.space.next</code> |
|
|
230
|
+
| V | <code>g ;</code> | <code>jump.edit.prev</code> |
|
|
231
|
+
| V | <code>g U</code> | <code>case.sel.upper</code> |
|
|
232
|
+
| V | <code>g g</code> | <code>move.buf.start</code> |
|
|
233
|
+
| V | <code>g u</code> | <code>case.sel.lower</code> |
|
|
234
|
+
| V | <code>h</code> | <code>move.char.prev</code> |
|
|
235
|
+
| V | <code>j</code> | <code>move.line.next</code> |
|
|
236
|
+
| V | <code>k</code> | <code>move.line.prev</code> |
|
|
237
|
+
| V | <code>l</code> | <code>move.char.next</code> |
|
|
238
|
+
| V | <code>left</code> | <code>move.char.prev</code> |
|
|
239
|
+
| V | <code>m <char></code> | <code>mark.set</code> |
|
|
240
|
+
| V | <code>pagedown</code> | <code>move.page.next</code> |
|
|
241
|
+
| V | <code>pageup</code> | <code>move.page.prev</code> |
|
|
242
|
+
| V | <code>q <char></code> | <code>macro.record</code> |
|
|
243
|
+
| V | <code>right</code> | <code>move.char.next</code> |
|
|
244
|
+
| V | <code>u</code> | <code>case.sel.lower</code> |
|
|
245
|
+
| V | <code>up</code> | <code>move.line.prev</code> |
|
|
246
|
+
| V | <code>w</code> | <code>move.word.next</code> |
|
|
247
|
+
| V | <code>x</code> | <code>sel.cut</code> |
|
|
248
|
+
| V | <code>y</code> | <code>sel.copy</code> |
|
|
249
|
+
| V | <code>~</code> | <code>case.sel.swap</code> |
|
|
250
|
+
| X | <code><char></code> | <code>edit.replace.char.next</code> |
|
|
251
|
+
| X | <code>down</code> | <code>move.line.next</code> |
|
|
252
|
+
| X | <code>esc</code> | <code>mode.prev</code> |
|
|
253
|
+
| X | <code>left</code> | <code>move.char.prev</code> |
|
|
254
|
+
| X | <code>right</code> | <code>move.char.next</code> |
|
|
255
|
+
| X | <code>up</code> | <code>move.line.prev</code> |
|
|
256
|
+
| audio | <code>esc</code> | <code>mode.prev</code> |
|
|
257
|
+
| audio | <code>f</code> | <code>audio.forward</code> |
|
|
258
|
+
| audio | <code>left</code> | <code>audio.backward</code> |
|
|
259
|
+
| audio | <code>q</code> | <code>mode.prev</code> |
|
|
260
|
+
| audio | <code>right</code> | <code>audio.forward</code> |
|
|
261
|
+
| audio | <code>space</code> | <code>audio.stop</code> |
|
|
262
|
+
| macro | <code>q</code> | <code>macro.record.stop</code> |
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Plan: resettable test VM ("blank" the VM to simulate a fresh install)
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
|
|
5
|
+
`run_tests_vm.rb` (host) + `vm_guest_run.sh` (guest) run the suite in the test
|
|
6
|
+
VirtualBox VM named by `$VM_NAME`. The VM isn't blank any more:
|
|
7
|
+
- Provisioning runs once and is then skipped forever because of the marker
|
|
8
|
+
`~/.vimamsa_vm_provisioned`.
|
|
9
|
+
- Every run leaves state behind: gems, `~/.config/vimamsa-test`, apt updates and
|
|
10
|
+
whatever earlier runs installed.
|
|
11
|
+
|
|
12
|
+
So "does it install and run on a fresh Ubuntu?" isn't being tested any more. It will
|
|
13
|
+
matter more for the AppImage (`doc/bundling_plan.md`), which has to run on a machine
|
|
14
|
+
with *no* `-dev` packages, Ruby or gems at all.
|
|
15
|
+
|
|
16
|
+
Current state (checked 2026-11-19):
|
|
17
|
+
- VirtualBox 7.0
|
|
18
|
+
- the test VM has one disk and **no snapshots**
|
|
19
|
+
|
|
20
|
+
## Approach: VirtualBox snapshots
|
|
21
|
+
|
|
22
|
+
A snapshot freezes the disk (and, if it's taken while the VM is running, its RAM). Later
|
|
23
|
+
writes go to a differencing image. Restoring a snapshot throws all changes away in
|
|
24
|
+
seconds.
|
|
25
|
+
|
|
26
|
+
Two snapshots:
|
|
27
|
+
|
|
28
|
+
| Snapshot | Contents | Used for |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| `clean` | fresh Ubuntu 24.04 desktop install + Guest Additions + the test user (`$VM_USER`) logged in on `$VM_DISPLAY`. **No** build tools, Ruby gems or GTK `-dev` packages. | "blank" runs: the full install path from scratch (`gem install`), and later the AppImage on a clean system |
|
|
31
|
+
| `provisioned` | `clean` + `vm_guest_run.sh` provisioning (apt `-dev` packages, gems) | normal test runs: fast, and every run starts from the same known state instead of piling up leftovers |
|
|
32
|
+
|
|
33
|
+
Take both **while the VM is running with the desktop logged in** (`--live`). Restoring
|
|
34
|
+
then resumes straight into the logged-in session on `:0`, which `guestcontrol` and the
|
|
35
|
+
GUI tests need. No autologin or boot wait is needed. Guest Additions resync the guest
|
|
36
|
+
clock after resume.
|
|
37
|
+
|
|
38
|
+
### Commands (VBoxManage 7.0)
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
# take (VM running, desktop logged in)
|
|
42
|
+
VBoxManage snapshot "$VM_NAME" take clean --live --description "Ubuntu 24.04 + GA, no vimamsa deps"
|
|
43
|
+
# restore (VM must be powered off first)
|
|
44
|
+
VBoxManage controlvm "$VM_NAME" poweroff
|
|
45
|
+
VBoxManage snapshot "$VM_NAME" restore clean # or: restore provisioned
|
|
46
|
+
VBoxManage startvm "$VM_NAME" --type gui # resumes the saved session
|
|
47
|
+
# replace an outdated snapshot
|
|
48
|
+
VBoxManage snapshot "$VM_NAME" delete provisioned
|
|
49
|
+
VBoxManage snapshot "$VM_NAME" take provisioned --live
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Creating the `clean` baseline (one-time, manual)
|
|
53
|
+
|
|
54
|
+
The current test VM is already provisioned, so it can't become `clean`. Removing
|
|
55
|
+
`-dev` packages and gems by hand would never be truly clean. Instead:
|
|
56
|
+
|
|
57
|
+
1. Snapshot the **current** state as `provisioned` right away. This is a quick win:
|
|
58
|
+
normal runs become reproducible today.
|
|
59
|
+
2. Create a fresh VM for the clean baseline. Either:
|
|
60
|
+
- `VBoxManage unattended install <vm> --iso=ubuntu-24.04.x-desktop-amd64.iso --user="$VM_USER" --password-file=… --install-additions --start-vm=gui`
|
|
61
|
+
Check that VirtualBox 7.0's unattended install handles the 24.04 desktop ISO
|
|
62
|
+
(its subiquity installer). If not, install by hand.
|
|
63
|
+
- or install by hand from the ISO: user `$VM_USER`, Guest Additions, autologin on.
|
|
64
|
+
|
|
65
|
+
Then make sure `VBoxManage guestcontrol … run /bin/true` works, and take `clean`
|
|
66
|
+
(`--live`).
|
|
67
|
+
3. Run `FORCE_PROVISION=1 ./run_tests_vm.rb` against it. If it passes, take
|
|
68
|
+
`provisioned` on the new VM. Then retire the old VM, or point `VM_NAME` (set in the
|
|
69
|
+
user's shell profile) at the new one.
|
|
70
|
+
|
|
71
|
+
Record the ISO version (e.g. 24.04.3) in the snapshot description.
|
|
72
|
+
|
|
73
|
+
## Script changes
|
|
74
|
+
|
|
75
|
+
`run_tests_vm.rb` gets a reset step before "Ensure the VM is running":
|
|
76
|
+
|
|
77
|
+
- `VM_RESET=provisioned` (**new default**): power off, restore `provisioned`, start.
|
|
78
|
+
Each run starts identical, so no leftovers between runs. This costs about 10–30 s
|
|
79
|
+
for poweroff, restore and resume.
|
|
80
|
+
- `VM_RESET=clean` (or a `--fresh` flag): restore `clean`. `vm_guest_run.sh` then
|
|
81
|
+
provisions from zero. This is the "fresh install" simulation. **If the suite
|
|
82
|
+
passes, retake `provisioned` from the result** (delete the old one, take the new
|
|
83
|
+
one). That way dependency changes in `vm_guest_run.sh` or the gemspec carry into
|
|
84
|
+
normal runs without manual steps.
|
|
85
|
+
- `VM_RESET=none`: the current behavior (keep state). Useful for debugging a failure
|
|
86
|
+
inside the VM.
|
|
87
|
+
- If the snapshot doesn't exist, fall back to `none` with a warning, so the script
|
|
88
|
+
keeps working on a VM without snapshots.
|
|
89
|
+
- The `~/.vimamsa_vm_provisioned` marker and `FORCE_PROVISION` stay: `clean` has no
|
|
90
|
+
marker, so it provisions. `provisioned` has it, so it skips.
|
|
91
|
+
|
|
92
|
+
### "Occasionally": when a fresh run happens
|
|
93
|
+
|
|
94
|
+
Automatically, in `run_tests_vm.rb`, so nobody has to remember:
|
|
95
|
+
- the host keeps a state file (e.g. `~/.local/share/vimamsa/vm_fresh_state`, in line
|
|
96
|
+
with the XDG item in `doc/TODO.md`) with the date of the last *passing* fresh run
|
|
97
|
+
and a hash of the install inputs: `vimamsa.gemspec`, `Gemfile`/`Gemfile.lock`,
|
|
98
|
+
`vm_guest_run.sh`, `ext/vmaext/extconf.rb`
|
|
99
|
+
- a run becomes a fresh run (`VM_RESET=clean`) when:
|
|
100
|
+
- the hash changed (new dependency or provisioning step), **or**
|
|
101
|
+
- the last fresh run is older than **7 days**, **or**
|
|
102
|
+
- it's explicitly asked for (`--fresh` / `VM_RESET=clean`)
|
|
103
|
+
- it prints which mode it chose and why, e.g.
|
|
104
|
+
`>> Fresh-install run: vimamsa.gemspec changed since last fresh run`
|
|
105
|
+
- `VM_RESET=provisioned` explicitly skips the automatic choice for a quick run.
|
|
106
|
+
|
|
107
|
+
Fresh runs are slow: apt plus compiling the Ruby-GNOME gems takes several minutes.
|
|
108
|
+
That's why they're occasional rather than every run.
|
|
109
|
+
|
|
110
|
+
### Keeping `clean` from going stale
|
|
111
|
+
|
|
112
|
+
`clean` is frozen at its install date. That's realistic: users install from an ISO
|
|
113
|
+
and then update. But apt update downloads grow over time. Every few months (or
|
|
114
|
+
with a new Ubuntu point release), rebuild `clean` from a newer ISO, or restore it, run
|
|
115
|
+
`apt full-upgrade`, and retake it. Note the date in the snapshot description.
|
|
116
|
+
|
|
117
|
+
## AppImage testing (later)
|
|
118
|
+
|
|
119
|
+
Once the AppImage exists, add `VM_RESET=clean` runs that **don't provision**. They
|
|
120
|
+
copy in only the AppImage and run the smoke test (`doc/bundling_plan.md`, "Testing the
|
|
121
|
+
bundle"). This is the real check that nothing is missing from the bundle, because
|
|
122
|
+
`clean` has no GTK `-dev` packages or Ruby. Other distros (Fedora, KDE) would be more
|
|
123
|
+
VMs with the same `clean` snapshot scheme.
|
|
124
|
+
|
|
125
|
+
## Disk and safety
|
|
126
|
+
|
|
127
|
+
- Snapshots grow as differencing images. Expect a few GB for `provisioned` and a few
|
|
128
|
+
more per run until the next restore. Restoring throws the run's growth away, so
|
|
129
|
+
steady-state use stays at about `clean` + `provisioned`. Check that the VM
|
|
130
|
+
folder's disk has room for that.
|
|
131
|
+
- Snapshot *restore* destroys the VM's current state. That's intended for a
|
|
132
|
+
test-only VM, but the script should only reset VMs that have a `clean` or
|
|
133
|
+
`provisioned` snapshot. Never reset a VM that has none, so pointing `VM_NAME` at
|
|
134
|
+
the wrong VM (some other VirtualBox VM) can't wipe it.
|
|
135
|
+
- The guest password stays out of the repo, as now (`VM_PASS` + chmod-600 password
|
|
136
|
+
file).
|
|
137
|
+
|
|
138
|
+
## Order
|
|
139
|
+
|
|
140
|
+
1. Take `provisioned` of the current VM now. Add `VM_RESET` with the `provisioned` /
|
|
141
|
+
`none` modes.
|
|
142
|
+
2. Build a fresh 24.04 VM and take `clean`. Add the `clean` mode, plus retaking
|
|
143
|
+
`provisioned` after a passing fresh run.
|
|
144
|
+
3. Automatic fresh-run trigger (hash + 7 days) with the state file.
|
|
145
|
+
4. Update the VM section of CLAUDE.md.
|
|
146
|
+
5. Later: AppImage-only runs on `clean`, and more distro VMs.
|
data/doc/wysiwyg_plan.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Plan: WYSIWYG editing (rich text with hidden markup)
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Edit formatted text as it looks: bold looks bold, and there are no markers on screen.
|
|
6
|
+
The formatting is stored in an underlying text format in the file. The user sees that
|
|
7
|
+
format **only when they ask for it** ("Show markup"), never because the cursor
|
|
8
|
+
moves onto it.
|
|
9
|
+
|
|
10
|
+
First prototype: **bold, italic and font size**. It renders with the existing
|
|
11
|
+
GtkSourceView (a `GtkTextView`), with no HTML or WebKit.
|
|
12
|
+
|
|
13
|
+
## Today (checked 2026-11-21)
|
|
14
|
+
|
|
15
|
+
- Hyperplaintext styles are visible marker characters in the text: `⦁bold⦁`,
|
|
16
|
+
`╱italic╱`, `❙title❙`, `⟦link⟧`, and `◼` for headings. `apply_style_markers`
|
|
17
|
+
(`buffer.rb`) inserts them. `lang/hyperplaintext.lang` colors them. Visual
|
|
18
|
+
`, t b`, `, t i` and `, t c` and `C , t 1`… are bound to `style.*`.
|
|
19
|
+
- `Buffer < String` holds the text. Every change is a delta
|
|
20
|
+
`[pos, INSERT|DELETE, len, text]`, applied by `Buffer#run_delta` (`buffer.rb:841`).
|
|
21
|
+
`run_delta` already updates position-based data on each change
|
|
22
|
+
(`update_highlights`, `update_line_ends`). `GtkView#handle_deltas`
|
|
23
|
+
(`gui_sourceview.rb:749`) applies the same deltas to the GTK buffer.
|
|
24
|
+
- **There's a precedent for buffer text that differs from the file:** closed folds
|
|
25
|
+
(`fold.rb`) are taken out of the buffer string, and `content_for_disk` puts them
|
|
26
|
+
back on save and autosave.
|
|
27
|
+
|
|
28
|
+
## Design
|
|
29
|
+
|
|
30
|
+
### 1. The visible text is the buffer
|
|
31
|
+
|
|
32
|
+
`Buffer` (the String) holds only the text the user sees, with no markers. So the
|
|
33
|
+
cursor can't land inside markup, and everything that works on text keeps working
|
|
34
|
+
unchanged: motions, counts, search, undo of text changes, `j`/`k` columns, macros,
|
|
35
|
+
autocomplete.
|
|
36
|
+
|
|
37
|
+
The formatting lives beside it in a **span model**, and the file format exists only
|
|
38
|
+
on disk:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
file (markup) ──parse──▶ visible text (Buffer) + spans (RichText)
|
|
42
|
+
◀─serialize─ │ │
|
|
43
|
+
└──── GTK buffer + tags (view)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 2. Span model (`lib/vimamsa/rich_text.rb`)
|
|
47
|
+
|
|
48
|
+
A `RichText` object per buffer (`buf.rich`, nil for normal buffers) holds attribute
|
|
49
|
+
runs over the visible text:
|
|
50
|
+
|
|
51
|
+
```ruby
|
|
52
|
+
# half-open ranges over Buffer positions; overlapping runs are allowed
|
|
53
|
+
[ { range: 0...5, attr: :bold },
|
|
54
|
+
{ range: 3...9, attr: :italic },
|
|
55
|
+
{ range: 12...20, attr: [:size, 1.5] } ]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Interface (so the storage can be swapped later):
|
|
59
|
+
- `attrs_at(pos)`: the attributes in effect at `pos`
|
|
60
|
+
- `runs_in(range)`: the runs that overlap `range`, clipped to it
|
|
61
|
+
- `apply(range, attr)` / `remove(range, attr)`: merges with neighbors, splits as needed
|
|
62
|
+
- `on_insert(pos, len, attrs)`: shifts later runs, extends the run being typed in, and
|
|
63
|
+
adds `attrs` for the new text
|
|
64
|
+
- `on_delete(pos, len)`: shrinks or drops runs, and returns the removed pieces for
|
|
65
|
+
undo
|
|
66
|
+
|
|
67
|
+
**Storage, in steps:**
|
|
68
|
+
1. **Prototype:** one sorted array per attribute, of non-overlapping `[start, end, value]`.
|
|
69
|
+
Overlaps between *different* attributes are then free. Each edit costs O(runs),
|
|
70
|
+
which is fine up to tens of thousands of runs.
|
|
71
|
+
2. **If profiling asks for it:** a balanced binary tree (or a rope) whose nodes store
|
|
72
|
+
their subtree's length. Finding the runs at a position and shifting them after an
|
|
73
|
+
edit are then O(log n). Only `RichText` changes, because callers use the interface.
|
|
74
|
+
|
|
75
|
+
The GTK side needs no extra structure. `GtkTextBuffer` is already a B-tree whose
|
|
76
|
+
tags move with the text.
|
|
77
|
+
|
|
78
|
+
### 3. Keeping things in sync
|
|
79
|
+
|
|
80
|
+
- **The Ruby spans are the source of truth. The GTK tags only mirror them.**
|
|
81
|
+
- `run_delta` calls `rich.on_insert` / `rich.on_delete`, next to `update_highlights`.
|
|
82
|
+
- `handle_deltas` applies the tags after each insert: `apply_tag` over the inserted
|
|
83
|
+
range, for the attributes `rich.attrs_at` gives. A plain GTK insert has no tags, so
|
|
84
|
+
the result is deterministic. A delete needs no tag work.
|
|
85
|
+
- Changes are changesets (`doc/delta_syntax_plan.md`). Formatting changes are
|
|
86
|
+
`retain` operations with attributes (`retain(5, bold: true)`), and inserted text can
|
|
87
|
+
carry its attributes. Undo, redo, position mapping and the GTK update then use the
|
|
88
|
+
same path as text changes. `RichText` updates its runs through the changeset's
|
|
89
|
+
`map_pos` and attributes, instead of separate `on_insert` / `on_delete` hooks, once
|
|
90
|
+
step 3 of that plan exists.
|
|
91
|
+
- A test compares the GTK tag ranges with the `RichText` runs after random edits, in
|
|
92
|
+
the style of `test_random_edit`.
|
|
93
|
+
|
|
94
|
+
### 4. Typing and editing rules
|
|
95
|
+
|
|
96
|
+
- **Typing extends the style of the character before the cursor:** at the end of a
|
|
97
|
+
bold word the text stays bold, and at the start it doesn't. This is like word
|
|
98
|
+
processors.
|
|
99
|
+
- **Typing style:** toggling bold with no selection (Insert mode) sets the style for
|
|
100
|
+
the next characters typed. It's shown in the status area (**B** *I* 150%) and
|
|
101
|
+
cleared when the cursor moves.
|
|
102
|
+
- **Undo:** a changeset's delete operations store the removed text with its
|
|
103
|
+
attributes, so `invert` puts the spans back. Formatting changes invert like text
|
|
104
|
+
changes. One Insert-mode session stays one undo step (one composed changeset).
|
|
105
|
+
- **Registers (prototype):** yank and put copy plain text, and pasted text gets the
|
|
106
|
+
typing style. Later, internal registers keep the spans, and the system clipboard
|
|
107
|
+
gets plain text.
|
|
108
|
+
- **Vim operators** work on the visible text. `d`, `c` and `x` drop the spans of what
|
|
109
|
+
they delete, through `on_delete`. Nothing needs to know about formatting.
|
|
110
|
+
|
|
111
|
+
### 5. Rendering (GtkTextView)
|
|
112
|
+
|
|
113
|
+
- Tags made once per buffer:
|
|
114
|
+
- `rich-bold`: `weight = 700`
|
|
115
|
+
- `rich-italic`: `style = ITALIC`
|
|
116
|
+
- `rich-size-<n>`: `scale = n`, from a small fixed list such as 0.8, 1.2, 1.5 and 2.0,
|
|
117
|
+
so the tags stay few
|
|
118
|
+
- Rich tags get a higher priority than syntax-highlighting tags. In a rich buffer,
|
|
119
|
+
turn the hyperplaintext language off, or use a variant without the marker rules,
|
|
120
|
+
because there are no markers left to color.
|
|
121
|
+
- Things to check with larger text:
|
|
122
|
+
- cursor drawing (`pos_to_coord`)
|
|
123
|
+
- easy-jump label placement
|
|
124
|
+
- line-height assumptions (in the file panel, scrolling and `view.center`)
|
|
125
|
+
- italic in the user's font (some monospace fonts have no italic and get a slanted
|
|
126
|
+
fallback)
|
|
127
|
+
|
|
128
|
+
### 6. The file format (hidden)
|
|
129
|
+
|
|
130
|
+
The format is a serializer behind an interface: `parse(markup) → [text, runs]` and
|
|
131
|
+
`serialize(text, runs) → markup`. Several can exist.
|
|
132
|
+
|
|
133
|
+
**For the prototype, use the hyperplaintext markers.** Files then stay readable and
|
|
134
|
+
diffable, and existing hpt files open in rich mode:
|
|
135
|
+
- bold `⦁…⦁` and italic `╱…╱`, as today
|
|
136
|
+
- size: a new marker, for example `⸨150%|…⸩`
|
|
137
|
+
|
|
138
|
+
Decide the exact characters before step 2. They must be rare in normal text and
|
|
139
|
+
easy to type in "Show markup".
|
|
140
|
+
- **Escaping:** a literal marker character in the text is written doubled, or with a
|
|
141
|
+
backslash. The test is that `parse(serialize(x)) == x` for random text and runs.
|
|
142
|
+
|
|
143
|
+
Later serializers: Markdown (`**`, `*`, `#` headings for size) and an HTML subset
|
|
144
|
+
(`<b>`, `<i>`, `<span style="font-size:150%">`) for export. The second serializer is
|
|
145
|
+
also the test that the model doesn't depend on the format.
|
|
146
|
+
|
|
147
|
+
Save and autosave go through `content_for_disk`, as folds do. The serializer runs
|
|
148
|
+
there, after the folds are put back.
|
|
149
|
+
|
|
150
|
+
### 7. "Show markup"
|
|
151
|
+
|
|
152
|
+
- **Prototype:** `rich.markup.show` opens the serialized text in a separate, read-only
|
|
153
|
+
buffer, with the cursor at the matching position.
|
|
154
|
+
- **Later:** editable markup. You edit that buffer and apply it back with
|
|
155
|
+
`rich.markup.apply`: parse, then replace the text and runs as one undo step.
|
|
156
|
+
Alternatively, switch the same buffer between rich and markup mode in place.
|
|
157
|
+
- `rich.toggle` turns rich mode on or off for a buffer. Turning it off converts to
|
|
158
|
+
the plain hpt buffer with visible markers (today's behavior).
|
|
159
|
+
|
|
160
|
+
### 8. Which buffers are rich
|
|
161
|
+
|
|
162
|
+
- Rich mode is off by default. Turn it on with `cnf.rich.enabled = true` and a list
|
|
163
|
+
of languages (`cnf.rich.langs = ["hyperplaintext"]`), or per buffer with
|
|
164
|
+
`rich.toggle`.
|
|
165
|
+
- Not rich: buffers with LSP. Positions sent to the language server would be wrong,
|
|
166
|
+
because the file holds markup the buffer doesn't.
|
|
167
|
+
- Search and grep across files (`grep.files`) search the file contents, so they see
|
|
168
|
+
the markup. That's acceptable for now. "Jump to match" maps the position from the
|
|
169
|
+
markup to the visible text, using the parse result.
|
|
170
|
+
|
|
171
|
+
### 9. Actions and keys
|
|
172
|
+
|
|
173
|
+
The naming follows `doc/action_names_plan.md`:
|
|
174
|
+
- `rich.bold.toggle`, `rich.italic.toggle`, `rich.size.up`, `rich.size.down`,
|
|
175
|
+
`rich.size.reset`
|
|
176
|
+
- `rich.markup.show`, `rich.toggle`
|
|
177
|
+
|
|
178
|
+
Keys: in rich buffers, the existing `style.*` bindings (Visual `, t b`, `, t i`,
|
|
179
|
+
`, t c`) call the rich actions instead of inserting markers. Size gets `, t +`,
|
|
180
|
+
`, t -` and `, t 0`. No new ctrl or alt chords. Insert mode needs a way to set the
|
|
181
|
+
typing style without leaving Insert mode. Decide that after trying the prototype.
|
|
182
|
+
|
|
183
|
+
## Prototype scope
|
|
184
|
+
|
|
185
|
+
In:
|
|
186
|
+
- `RichText` with arrays
|
|
187
|
+
- the hpt serializer for bold, italic and size, with escaping
|
|
188
|
+
- GTK tags
|
|
189
|
+
- typing rules, and undo of text and format changes
|
|
190
|
+
- `rich.markup.show` (read-only)
|
|
191
|
+
- `rich.toggle`
|
|
192
|
+
- the actions above
|
|
193
|
+
|
|
194
|
+
Out, for later:
|
|
195
|
+
- editable markup view
|
|
196
|
+
- formatted registers and clipboard
|
|
197
|
+
- Markdown and HTML serializers
|
|
198
|
+
- links, headings as line styles, images, lists
|
|
199
|
+
- the tree storage
|
|
200
|
+
- rich buffers in two-column mode
|
|
201
|
+
|
|
202
|
+
## Tests
|
|
203
|
+
|
|
204
|
+
- `RichText` unit cases: insert and delete at, inside and around runs; merging and
|
|
205
|
+
splitting; overlapping attributes.
|
|
206
|
+
- Serializer round trip: random text and runs go through serialize and parse and come
|
|
207
|
+
back the same. Marker characters in the text are escaped.
|
|
208
|
+
- GTK sync: after random inserts, deletes and format toggles, the GTK tag ranges
|
|
209
|
+
equal the `RichText` runs.
|
|
210
|
+
- Editing: `d w` over half a bold word, `x` at a run edge, and typing after a bold
|
|
211
|
+
word extends it. Undo and redo restore both the text and the formatting.
|
|
212
|
+
- Save and reload give the same text and runs. The file holds markup, and autosave
|
|
213
|
+
writes the same thing.
|
|
214
|
+
- "Show markup" shows the serialized text and the right cursor position.
|
|
215
|
+
|
|
216
|
+
## Order
|
|
217
|
+
|
|
218
|
+
1. `RichText` (arrays) and its unit tests. No GUI yet.
|
|
219
|
+
2. The hpt serializer (bold, italic, size), round-trip tests, and the choice of the
|
|
220
|
+
size marker.
|
|
221
|
+
3. Hook it into `run_delta`, `handle_deltas`, load and `content_for_disk`. Add the GTK
|
|
222
|
+
tags and the sync test.
|
|
223
|
+
4. Attributes on changeset operations (step 6 of `doc/delta_syntax_plan.md`), undo
|
|
224
|
+
and redo of formatting, and the typing rules.
|
|
225
|
+
5. Actions and keys, the typing style in the status area, and `rich.markup.show`.
|
|
226
|
+
6. Try it on real notes. Decide the Insert-mode keys, and whether the array storage is
|
|
227
|
+
fast enough.
|
|
228
|
+
7. Later: editable markup, formatted registers, the Markdown and HTML serializers, and
|
|
229
|
+
more attributes.
|
|
230
|
+
|
|
231
|
+
Run the full suite in the VM after each step.
|