vimamsa 0.1.26 → 0.1.27
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 +62 -16
- data/custom_example.rb +43 -13
- data/doc/TODO.md +461 -0
- data/doc/bundling_plan.md +569 -0
- data/doc/key_bindings_report_plan.md +168 -0
- data/doc/missing_vim_bindings.md +71 -0
- data/doc/modules_settings_plan.md +433 -0
- data/doc/refactor_dedup_plan.md +117 -0
- data/doc/unused_code_plan.md +120 -0
- data/doc/vim_compatibility_plan.md +296 -0
- data/doc/vimlike_vim_conflicts.md +254 -0
- data/doc/vm_snapshots_plan.md +146 -0
- data/exe/run_tests.rb +117 -3
- data/exe/vimamsa +24 -4
- data/fonts/OFL-Oxanium.txt +93 -0
- data/fonts/Oxanium[wght].ttf +0 -0
- data/icon.png +0 -0
- data/img/demo.gif +0 -0
- data/lang/hyperplaintext.lang +6 -0
- data/lib/vimamsa/ack.rb +11 -1
- data/lib/vimamsa/actions.rb +4 -1
- 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 +593 -82
- data/lib/vimamsa/buffer_changetext.rb +102 -42
- data/lib/vimamsa/buffer_cursor.rb +7 -0
- data/lib/vimamsa/buffer_list.rb +4 -0
- data/lib/vimamsa/buffer_manager.rb +4 -1
- data/lib/vimamsa/bundled_fonts.rb +32 -0
- data/lib/vimamsa/clipboard.rb +3 -0
- data/lib/vimamsa/conf.rb +59 -3
- data/lib/vimamsa/constants.rb +3 -0
- data/lib/vimamsa/crash_handler.rb +149 -0
- data/lib/vimamsa/debug.rb +4 -1
- data/lib/vimamsa/desktop_install.rb +96 -0
- data/lib/vimamsa/diff_buffer.rb +39 -10
- data/lib/vimamsa/easy_jump.rb +3 -0
- data/lib/vimamsa/editor.rb +263 -57
- data/lib/vimamsa/encrypt.rb +78 -29
- data/lib/vimamsa/file_finder.rb +4 -19
- data/lib/vimamsa/file_history.rb +3 -0
- data/lib/vimamsa/file_manager.rb +30 -15
- data/lib/vimamsa/fold.rb +226 -0
- data/lib/vimamsa/gui.rb +520 -106
- data/lib/vimamsa/gui_command_line.rb +208 -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 +59 -35
- data/lib/vimamsa/gui_func_panel.rb +67 -22
- data/lib/vimamsa/gui_image.rb +3 -0
- data/lib/vimamsa/gui_keylog_panel.rb +246 -0
- data/lib/vimamsa/gui_menu.rb +23 -11
- data/lib/vimamsa/gui_select_window.rb +19 -48
- data/lib/vimamsa/gui_settings.rb +78 -37
- data/lib/vimamsa/gui_sourceview.rb +273 -19
- data/lib/vimamsa/gui_sourceview_autocomplete.rb +319 -90
- data/lib/vimamsa/gui_text.rb +63 -2
- data/lib/vimamsa/gui_theme.rb +606 -0
- data/lib/vimamsa/hook.rb +3 -0
- data/lib/vimamsa/hyper_plain_text.rb +3 -0
- data/lib/vimamsa/key_actions.rb +112 -13
- data/lib/vimamsa/key_binding_tree.rb +242 -215
- data/lib/vimamsa/key_bindings_notepad.rb +43 -0
- data/lib/vimamsa/key_bindings_report.rb +261 -0
- data/lib/vimamsa/key_bindings_vim.rb +354 -0
- data/lib/vimamsa/key_bindings_vimlike.rb +65 -9
- data/lib/vimamsa/langservp.rb +271 -54
- data/lib/vimamsa/macro.rb +3 -0
- data/lib/vimamsa/main.rb +14 -8
- data/lib/vimamsa/rbvma.rb +26 -1
- data/lib/vimamsa/search.rb +3 -0
- data/lib/vimamsa/search_replace.rb +11 -10
- data/lib/vimamsa/string_util.rb +120 -40
- data/lib/vimamsa/terminal.rb +3 -0
- data/lib/vimamsa/test_framework.rb +28 -2
- data/lib/vimamsa/tests.rb +3 -0
- data/lib/vimamsa/text_objects.rb +353 -0
- data/lib/vimamsa/text_transforms.rb +14 -0
- data/lib/vimamsa/util.rb +46 -7
- data/lib/vimamsa/version.rb +1 -1
- data/lib/vimamsa.rb +0 -1
- 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/tts/tts.rb +119 -0
- data/modules/tts/tts_info.rb +3 -0
- data/run_e2e_vm.sh +28 -0
- data/run_tests_vm.sh +130 -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_steps.txt +59 -0
- data/scripts/demo/record_demo.rb +177 -0
- data/scripts/demo/shapes.rb +28 -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_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 +33 -3
- data/tests/test_bookmarks.rb +206 -0
- data/tests/test_bracket_match.rb +85 -0
- data/tests/test_bundling.rb +92 -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 +129 -0
- data/tests/test_copy_paste.rb +80 -0
- data/tests/test_crash_handler.rb +39 -0
- data/tests/test_custom_two_phase.rb +92 -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_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_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_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_jump_to_file.rb +41 -0
- data/tests/test_key_bindings.rb +208 -0
- data/tests/test_keylog_panel.rb +101 -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_notepad_bindings.rb +67 -0
- data/tests/test_popup_queue.rb +51 -0
- data/tests/test_random_edit.rb +109 -0
- data/tests/test_revert.rb +127 -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 +329 -0
- data/tests/test_tts.rb +68 -0
- data/tests/test_vim_bindings.rb +252 -0
- data/tests/test_vim_conflicts.rb +63 -0
- data/tests/test_window_layout.rb +219 -0
- data/vimamsa.gemspec +3 -1
- data/vm_guest_run.sh +109 -0
- metadata +112 -10
|
@@ -0,0 +1,254 @@
|
|
|
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) | 20 |
|
|
12
|
+
| Missing from vimlike (no conflict, could be added) | 19 |
|
|
13
|
+
| Shared (same keys, same action) | 187 |
|
|
14
|
+
|
|
15
|
+
## Conflicts
|
|
16
|
+
|
|
17
|
+
| Mode | Vim keys | Vim action | vimlike | Reason |
|
|
18
|
+
|---|---|---|---|---|
|
|
19
|
+
| C | <code>@ @</code> | <code>vma.macro.run_last_macro</code> | <code>@ <char></code> <code>vma.macro.run_macro(<char>)</code> | a vimlike <char> binding takes the key |
|
|
20
|
+
| C | <code>C</code> | <code>:vim_change_to_eol</code> | <code>FileContentSearch.start_gui</code> | same keys, other action |
|
|
21
|
+
| C | <code>O</code> | <code>:vim_open_line_above</code> | <code>buf.jump(END_OF_LINE)</code> | same keys, other action |
|
|
22
|
+
| C | <code>X</code> | <code>:vim_delete_char_backward</code> | <code>buf.jump(END_OF_LINE);buf.insert_txt("\n");</code> | same keys, other action |
|
|
23
|
+
| C | <code>^</code> | <code>buf.jump(FIRST_NON_WHITESPACE)</code> | <code>buf.jump(BEGINNING_OF_LINE)</code> | same keys, other action |
|
|
24
|
+
| C | <code>backspace</code> | <code>buf.move(BACKWARD_CHAR)</code> | <code>buf.selection_active? ? buf.delete(SELECTION) : buf.delet...</code> | same keys, other action |
|
|
25
|
+
| C | <code>ctrl-o</code> | <code>buf.jump_to_last_edit</code> | <code>:open_file_dialog</code> | same keys, other action |
|
|
26
|
+
| C | <code>d $</code> | <code>:vim_delete_to_eol</code> | <code>buf.delete2(:to_line_end)</code> | same keys, other action |
|
|
27
|
+
| C | <code>s</code> | <code>:vim_substitute_char</code> | <code>EasyJump.start</code> | same keys, other action |
|
|
28
|
+
| C | <code>space</code> | <code>buf.move(FORWARD_CHAR)</code> | <code>2 longer bindings</code> | vimlike uses these keys as a prefix |
|
|
29
|
+
| C | <code>x</code> | <code>:vim_delete_char</code> | <code>buf.delete(CURRENT_CHAR_FORWARD)</code> | same keys, other action |
|
|
30
|
+
| C | <code>z z</code> | <code>:center_on_current_line</code> | <code>z</code> <code>:start_browse_mode</code> | a shorter vimlike binding runs first |
|
|
31
|
+
| I | <code>ctrl-c</code> | <code>vma.kbd.to_previous_mode</code> | <code>buf.copy_active_selection</code> | same keys, other action |
|
|
32
|
+
| I | <code>ctrl-h</code> | <code>buf.selection_active? ? buf.delete(SELECTION) : buf.delet...</code> | <code>buf.view.autocp_manual_trigger</code> | same keys, other action |
|
|
33
|
+
| I | <code>ctrl-j</code> | <code>buf.insert_new_line()</code> | <code>buf.view.hide_completions</code> | same keys, other action |
|
|
34
|
+
| I | <code>ctrl-n</code> | <code>buf.view.autocp_manual_trigger</code> | <code>buf.move(FORWARD_LINE)</code> | same keys, other action |
|
|
35
|
+
| I | <code>ctrl-p</code> | <code>buf.view.autocp_manual_trigger</code> | <code>buf.move(BACKWARD_LINE)</code> | same keys, other action |
|
|
36
|
+
| V | <code>^</code> | <code>buf.jump(FIRST_NON_WHITESPACE)</code> | <code>buf.jump(BEGINNING_OF_LINE)</code> | same keys, other action |
|
|
37
|
+
| V | <code>ctrl-c</code> | <code>buf.end_visual_mode</code> | <code>buf.comment_selection</code> | same keys, other action |
|
|
38
|
+
| V | <code>s</code> | <code>:vim_change_selection</code> | <code>EasyJump.start</code> | same keys, other action |
|
|
39
|
+
|
|
40
|
+
## Missing from vimlike
|
|
41
|
+
|
|
42
|
+
| Mode | Vim keys | Vim action |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| C | <code>.</code> | <code>repeat_last_action()</code> |
|
|
45
|
+
| C | <code>D</code> | <code>:vim_delete_to_eol</code> |
|
|
46
|
+
| C | <code>S</code> | <code>:vim_change_line</code> |
|
|
47
|
+
| C | <code>Y</code> | <code>buf.copy_line</code> |
|
|
48
|
+
| C | <code>` <char></code> | <code>buf.jump_to_mark(<char>)</code> |
|
|
49
|
+
| C | <code>c $</code> | <code>:vim_change_to_eol</code> |
|
|
50
|
+
| C | <code>c c</code> | <code>:vim_change_line</code> |
|
|
51
|
+
| C | <code>c e</code> | <code>:vim_change_word</code> |
|
|
52
|
+
| C | <code>c w</code> | <code>:vim_change_word</code> |
|
|
53
|
+
| C | <code>ctrl-a</code> | <code>buf.increment_current_word</code> |
|
|
54
|
+
| C | <code>ctrl-b</code> | <code>vma.gui.page_up</code> |
|
|
55
|
+
| C | <code>ctrl-d</code> | <code>buf.move(:forward_page)</code> |
|
|
56
|
+
| C | <code>ctrl-f</code> | <code>vma.gui.page_down</code> |
|
|
57
|
+
| C | <code>ctrl-u</code> | <code>buf.move(:backward_page)</code> |
|
|
58
|
+
| C | <code>y $</code> | <code>buf.copy(:to_line_end)</code> |
|
|
59
|
+
| C | <code>y w</code> | <code>buf.copy(:to_next_word)</code> |
|
|
60
|
+
| V | <code><</code> | <code>buf.unindent_selection</code> |
|
|
61
|
+
| V | <code>></code> | <code>buf.indent_selection</code> |
|
|
62
|
+
| V | <code>c</code> | <code>:vim_change_selection</code> |
|
|
63
|
+
|
|
64
|
+
## Shared
|
|
65
|
+
|
|
66
|
+
| Mode | Keys | Action |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| B | <code>;</code> | <code>buf.jump_to_last_edit</code> |
|
|
69
|
+
| B | <code>c</code> | <code>bufs.close_current_buffer(true)</code> |
|
|
70
|
+
| B | <code>ctrl!</code> | <code>:exit_browse_mode</code> |
|
|
71
|
+
| B | <code>d</code> | <code>vma.gui.page_down</code> |
|
|
72
|
+
| B | <code>e</code> | <code>vma.gui.page_up(multip: 0.25)</code> |
|
|
73
|
+
| B | <code>enter</code> | <code>:exit_browse_mode</code> |
|
|
74
|
+
| B | <code>esc</code> | <code>:exit_browse_mode</code> |
|
|
75
|
+
| B | <code>h</code> | <code>bufs.history_switch(-1)</code> |
|
|
76
|
+
| B | <code>i</code> | <code>buf.jump(START_OF_BUFFER)</code> |
|
|
77
|
+
| B | <code>j</code> | <code>:exit_browse_mode</code> |
|
|
78
|
+
| B | <code>l</code> | <code>bufs.history_switch(+1)</code> |
|
|
79
|
+
| B | <code>m</code> | <code>vma.macro.run_last_macro</code> |
|
|
80
|
+
| B | <code>n</code> | <code>vma.gui.file_panel_select_adjacent(1)</code> |
|
|
81
|
+
| B | <code>o</code> | <code>buf.jump(END_OF_BUFFER)</code> |
|
|
82
|
+
| B | <code>p</code> | <code>vma.gui.file_panel_select_adjacent(-1)</code> |
|
|
83
|
+
| B | <code>q</code> | <code>buf.jump_to_last_edit</code> |
|
|
84
|
+
| B | <code>r</code> | <code>vma.gui.page_down(multip: 0.25)</code> |
|
|
85
|
+
| B | <code>return</code> | <code>:exit_browse_mode</code> |
|
|
86
|
+
| B | <code>s</code> | <code>vma.gui.page_up</code> |
|
|
87
|
+
| B | <code>w</code> | <code>:jump_to_next_edit</code> |
|
|
88
|
+
| B | <code>z</code> | <code>center_on_current_line();call_action(:exit_browse_mode)</code> |
|
|
89
|
+
| C | <code>$</code> | <code>buf.jump(END_OF_LINE)</code> |
|
|
90
|
+
| C | <code>' <char></code> | <code>buf.jump_to_mark(<char>)</code> |
|
|
91
|
+
| C | <code>*</code> | <code>buf.jump_to_next_instance_of_word</code> |
|
|
92
|
+
| C | <code>/</code> | <code>invoke_search</code> |
|
|
93
|
+
| C | <code>/[1-9]/</code> | <code>vma.kbd.set_next_command_count(<char>)</code> |
|
|
94
|
+
| C | <code>0(vma.kbd.next_command_count!=nil)</code> | <code>vma.kbd.set_next_command_count(<char>)</code> |
|
|
95
|
+
| C | <code>0(vma.kbd.next_command_count==nil)</code> | <code>buf.jump(BEGINNING_OF_LINE)</code> |
|
|
96
|
+
| C | <code>:</code> | <code>vma.gui.cmd_line.start</code> |
|
|
97
|
+
| C | <code>;</code> | <code>repeat_last_find</code> |
|
|
98
|
+
| C | <code>@ <char></code> | <code>vma.macro.run_macro(<char>)</code> |
|
|
99
|
+
| C | <code>A</code> | <code>buf.jump(END_OF_LINE);vma.kbd.set_mode(:insert)</code> |
|
|
100
|
+
| C | <code>F <char></code> | <code>buf.jump_to_next_instance_of_char(<char>,BACKWARD)</code> |
|
|
101
|
+
| C | <code>F space</code> | <code>buf.jump_to_next_instance_of_char(' ',BACKWARD)</code> |
|
|
102
|
+
| C | <code>G</code> | <code>buf.jump(END_OF_BUFFER)</code> |
|
|
103
|
+
| C | <code>G(vma.kbd.next_command_count!=nil)</code> | <code>buf.jump_to_line()</code> |
|
|
104
|
+
| C | <code>I</code> | <code>buf.jump(FIRST_NON_WHITESPACE);vma.kbd.set_mode(:insert)</code> |
|
|
105
|
+
| C | <code>J</code> | <code>buf.join_lines()</code> |
|
|
106
|
+
| C | <code>N</code> | <code>$search.jump_to_previous()</code> |
|
|
107
|
+
| C | <code>P</code> | <code>buf.paste(BEFORE)</code> |
|
|
108
|
+
| C | <code>R</code> | <code>vma.kbd.set_mode(:replace)</code> |
|
|
109
|
+
| C | <code>a</code> | <code>buf.move(FORWARD_CHAR);vma.kbd.set_mode(:insert)</code> |
|
|
110
|
+
| C | <code>alt-h</code> | <code>vma.gui.file_panel_select_adjacent(-1)</code> |
|
|
111
|
+
| C | <code>alt-l</code> | <code>vma.gui.file_panel_select_adjacent(1)</code> |
|
|
112
|
+
| C | <code>b</code> | <code>buf.jump_word(BACKWARD, WORD_START)</code> |
|
|
113
|
+
| C | <code>c a <char></code> | <code>buf.text_object_op(:change, <char>, :a)</code> |
|
|
114
|
+
| C | <code>c i <char></code> | <code>buf.text_object_op(:change, <char>, :i)</code> |
|
|
115
|
+
| C | <code>ctrl-r</code> | <code>buf.redo()</code> |
|
|
116
|
+
| C | <code>d ' <char></code> | <code>buf.delete2(:to_mark,<char>)</code> |
|
|
117
|
+
| C | <code>d 0</code> | <code>buf.delete2(:to_line_start)</code> |
|
|
118
|
+
| C | <code>d F <char></code> | <code>buf.delete2(:to_char_backward,<char>)</code> |
|
|
119
|
+
| C | <code>d F space</code> | <code>buf.delete2(:to_char_backward,' ')</code> |
|
|
120
|
+
| C | <code>d a <char></code> | <code>buf.text_object_op(:delete, <char>, :a)</code> |
|
|
121
|
+
| C | <code>d d</code> | <code>buf.delete_line</code> |
|
|
122
|
+
| C | <code>d e</code> | <code>buf.delete2(:to_word_end)</code> |
|
|
123
|
+
| C | <code>d f <char></code> | <code>buf.delete2(:to_char,<char>)</code> |
|
|
124
|
+
| C | <code>d f space</code> | <code>buf.delete2(:to_char,' ')</code> |
|
|
125
|
+
| C | <code>d i <char></code> | <code>buf.text_object_op(:delete, <char>, :i)</code> |
|
|
126
|
+
| C | <code>d w</code> | <code>buf.delete2(:to_next_word)</code> |
|
|
127
|
+
| C | <code>down</code> | <code>buf.move(FORWARD_LINE)</code> |
|
|
128
|
+
| C | <code>e</code> | <code>buf.jump_word(FORWARD, WORD_END)</code> |
|
|
129
|
+
| C | <code>enter</code> | <code>buf.handle_line_action()</code> |
|
|
130
|
+
| C | <code>f <char></code> | <code>buf.jump_to_next_instance_of_char(<char>)</code> |
|
|
131
|
+
| C | <code>f space</code> | <code>buf.jump_to_next_instance_of_char(' ')</code> |
|
|
132
|
+
| C | <code>g ;</code> | <code>buf.jump_to_last_edit</code> |
|
|
133
|
+
| C | <code>g U U</code> | <code>buf.transform_range(:line, :upcase)</code> |
|
|
134
|
+
| C | <code>g U a <char></code> | <code>buf.text_object_op(:upcase, <char>, :a)</code> |
|
|
135
|
+
| C | <code>g U i <char></code> | <code>buf.text_object_op(:upcase, <char>, :i)</code> |
|
|
136
|
+
| C | <code>g U w</code> | <code>buf.transform_range(:to_next_word, :upcase)</code> |
|
|
137
|
+
| C | <code>g g</code> | <code>buf.jump(START_OF_BUFFER)</code> |
|
|
138
|
+
| C | <code>g u a <char></code> | <code>buf.text_object_op(:downcase, <char>, :a)</code> |
|
|
139
|
+
| C | <code>g u i <char></code> | <code>buf.text_object_op(:downcase, <char>, :i)</code> |
|
|
140
|
+
| C | <code>g u u</code> | <code>buf.transform_range(:line, :downcase)</code> |
|
|
141
|
+
| C | <code>g u w</code> | <code>buf.transform_range(:to_next_word, :downcase)</code> |
|
|
142
|
+
| C | <code>g ~ a <char></code> | <code>buf.text_object_op(:swapcase, <char>, :a)</code> |
|
|
143
|
+
| C | <code>g ~ i <char></code> | <code>buf.text_object_op(:swapcase, <char>, :i)</code> |
|
|
144
|
+
| C | <code>g ~ w</code> | <code>buf.transform_range(:to_next_word, :swapcase)</code> |
|
|
145
|
+
| C | <code>g ~ ~</code> | <code>buf.transform_range(:line, :swapcase)</code> |
|
|
146
|
+
| C | <code>h</code> | <code>:e_move_backward_char</code> |
|
|
147
|
+
| C | <code>i</code> | <code>vma.kbd.set_mode(:insert)</code> |
|
|
148
|
+
| C | <code>j</code> | <code>buf.move(FORWARD_LINE)</code> |
|
|
149
|
+
| C | <code>k</code> | <code>buf.move(BACKWARD_LINE)</code> |
|
|
150
|
+
| C | <code>l</code> | <code>:e_move_forward_char</code> |
|
|
151
|
+
| C | <code>left</code> | <code>buf.move(BACKWARD_CHAR)</code> |
|
|
152
|
+
| C | <code>m <char></code> | <code>buf.mark_current_position(<char>)</code> |
|
|
153
|
+
| C | <code>n</code> | <code>$search.jump_to_next()</code> |
|
|
154
|
+
| C | <code>o</code> | <code>buf.jump(END_OF_LINE);buf.insert_txt("\n");vma.kbd.set_mo...</code> |
|
|
155
|
+
| C | <code>p</code> | <code>buf.paste(AFTER)</code> |
|
|
156
|
+
| C | <code>pagedown</code> | <code>vma.gui.page_down</code> |
|
|
157
|
+
| C | <code>pageup</code> | <code>vma.gui.page_up</code> |
|
|
158
|
+
| C | <code>q <char></code> | <code>vma.kbd.set_mode(:macro);vma.macro.start_recording(<char>)</code> |
|
|
159
|
+
| C | <code>r <char></code> | <code>buf.replace_with_char(<char>)</code> |
|
|
160
|
+
| C | <code>r space</code> | <code>buf.replace_with_char(' ')</code> |
|
|
161
|
+
| C | <code>return</code> | <code>buf.handle_line_action()</code> |
|
|
162
|
+
| C | <code>right</code> | <code>buf.move(FORWARD_CHAR)</code> |
|
|
163
|
+
| C | <code>tab</code> | <code>bufs.switch_to_last_buf</code> |
|
|
164
|
+
| C | <code>u</code> | <code>buf.undo()</code> |
|
|
165
|
+
| C | <code>up</code> | <code>buf.move(BACKWARD_LINE)</code> |
|
|
166
|
+
| C | <code>v</code> | <code>buf.start_selection; vma.kbd.set_mode(:visual)</code> |
|
|
167
|
+
| C | <code>w</code> | <code>buf.jump_word(FORWARD, WORD_START)</code> |
|
|
168
|
+
| C | <code>y ' <char></code> | <code>buf.copy(:to_mark,<char>)</code> |
|
|
169
|
+
| C | <code>y 0</code> | <code>buf.copy(:to_line_start)</code> |
|
|
170
|
+
| C | <code>y a <char></code> | <code>buf.text_object_op(:yank, <char>, :a)</code> |
|
|
171
|
+
| C | <code>y e</code> | <code>buf.copy(:to_word_end)</code> |
|
|
172
|
+
| C | <code>y i <char></code> | <code>buf.text_object_op(:yank, <char>, :i)</code> |
|
|
173
|
+
| C | <code>y y</code> | <code>buf.copy_line</code> |
|
|
174
|
+
| C | <code>~</code> | <code>:vim_toggle_case</code> |
|
|
175
|
+
| I | <code><char></code> | <code>buf.insert_txt(<char>)</code> |
|
|
176
|
+
| I | <code>backspace</code> | <code>buf.selection_active? ? buf.delete(SELECTION) : buf.delet...</code> |
|
|
177
|
+
| I | <code>ctrl-space</code> | <code>buf.view.autocp_manual_trigger</code> |
|
|
178
|
+
| I | <code>down</code> | <code>insert_move(FORWARD_LINE)</code> |
|
|
179
|
+
| I | <code>enter</code> | <code>buf.insert_new_line()</code> |
|
|
180
|
+
| I | <code>esc</code> | <code>vma.kbd.to_previous_mode</code> |
|
|
181
|
+
| I | <code>left</code> | <code>insert_move(BACKWARD_CHAR)</code> |
|
|
182
|
+
| I | <code>pagedown</code> | <code>insert_move(:pagedown)</code> |
|
|
183
|
+
| I | <code>pageup</code> | <code>insert_move(:pageup)</code> |
|
|
184
|
+
| I | <code>right</code> | <code>insert_move(FORWARD_CHAR)</code> |
|
|
185
|
+
| I | <code>shift!(vma.buf.view.autocp_active)</code> | <code>buf.view.autocp_select</code> |
|
|
186
|
+
| I | <code>shift-down</code> | <code>insert_select_move(FORWARD_LINE)</code> |
|
|
187
|
+
| I | <code>shift-left</code> | <code>insert_select_move(BACKWARD_CHAR)</code> |
|
|
188
|
+
| I | <code>shift-pagedown</code> | <code>insert_select_move(:pagedown)</code> |
|
|
189
|
+
| I | <code>shift-pageup</code> | <code>insert_select_move(:pageup)</code> |
|
|
190
|
+
| I | <code>shift-right</code> | <code>insert_select_move(FORWARD_CHAR)</code> |
|
|
191
|
+
| I | <code>shift-tab</code> | <code>buf.unindent</code> |
|
|
192
|
+
| I | <code>shift-tab(vma.buf.view.autocp_active)</code> | <code>buf.view.autocp_select_previous</code> |
|
|
193
|
+
| I | <code>shift-up</code> | <code>insert_select_move(BACKWARD_LINE)</code> |
|
|
194
|
+
| I | <code>space</code> | <code>buf.insert_txt(" ")</code> |
|
|
195
|
+
| I | <code>tab</code> | <code>buf.insert_tab</code> |
|
|
196
|
+
| I | <code>tab(vma.buf.view.autocp_active)</code> | <code>buf.view.autocp_select_next</code> |
|
|
197
|
+
| I | <code>up</code> | <code>insert_move(BACKWARD_LINE)</code> |
|
|
198
|
+
| R | <code><char></code> | <code>readchar_new_char(<char>)</code> |
|
|
199
|
+
| V | <code>$</code> | <code>buf.jump(END_OF_LINE)</code> |
|
|
200
|
+
| V | <code>' <char></code> | <code>buf.jump_to_mark(<char>)</code> |
|
|
201
|
+
| V | <code>*</code> | <code>buf.jump_to_next_instance_of_word</code> |
|
|
202
|
+
| V | <code>/</code> | <code>invoke_search</code> |
|
|
203
|
+
| V | <code>/[1-9]/</code> | <code>vma.kbd.set_next_command_count(<char>)</code> |
|
|
204
|
+
| V | <code>0(vma.kbd.next_command_count!=nil)</code> | <code>vma.kbd.set_next_command_count(<char>)</code> |
|
|
205
|
+
| V | <code>0(vma.kbd.next_command_count==nil)</code> | <code>buf.jump(BEGINNING_OF_LINE)</code> |
|
|
206
|
+
| V | <code>;</code> | <code>repeat_last_find</code> |
|
|
207
|
+
| V | <code>F <char></code> | <code>buf.jump_to_next_instance_of_char(<char>,BACKWARD)</code> |
|
|
208
|
+
| V | <code>F space</code> | <code>buf.jump_to_next_instance_of_char(' ',BACKWARD)</code> |
|
|
209
|
+
| V | <code>G</code> | <code>buf.jump(END_OF_BUFFER)</code> |
|
|
210
|
+
| V | <code>G(vma.kbd.next_command_count!=nil)</code> | <code>buf.jump_to_line()</code> |
|
|
211
|
+
| V | <code>J</code> | <code>buf.convert_selected_text(:joinlines)</code> |
|
|
212
|
+
| V | <code>U</code> | <code>buf.transform_selection(:upcase)</code> |
|
|
213
|
+
| V | <code>a <char></code> | <code>buf.text_object_op(:select, <char>, :a)</code> |
|
|
214
|
+
| V | <code>b</code> | <code>buf.jump_word(BACKWARD, WORD_START)</code> |
|
|
215
|
+
| V | <code>d</code> | <code>buf.delete(SELECTION)</code> |
|
|
216
|
+
| V | <code>down</code> | <code>buf.move(FORWARD_LINE)</code> |
|
|
217
|
+
| V | <code>e</code> | <code>buf.jump_word(FORWARD, WORD_END)</code> |
|
|
218
|
+
| V | <code>esc</code> | <code>buf.end_visual_mode</code> |
|
|
219
|
+
| V | <code>f <char></code> | <code>buf.jump_to_next_instance_of_char(<char>)</code> |
|
|
220
|
+
| V | <code>f space</code> | <code>buf.jump_to_next_instance_of_char(' ')</code> |
|
|
221
|
+
| V | <code>g ;</code> | <code>buf.jump_to_last_edit</code> |
|
|
222
|
+
| V | <code>g U</code> | <code>buf.transform_selection(:upcase)</code> |
|
|
223
|
+
| V | <code>g g</code> | <code>buf.jump(START_OF_BUFFER)</code> |
|
|
224
|
+
| V | <code>g u</code> | <code>buf.transform_selection(:downcase)</code> |
|
|
225
|
+
| V | <code>h</code> | <code>:e_move_backward_char</code> |
|
|
226
|
+
| V | <code>i <char></code> | <code>buf.text_object_op(:select, <char>, :i)</code> |
|
|
227
|
+
| V | <code>j</code> | <code>buf.move(FORWARD_LINE)</code> |
|
|
228
|
+
| V | <code>k</code> | <code>buf.move(BACKWARD_LINE)</code> |
|
|
229
|
+
| V | <code>l</code> | <code>:e_move_forward_char</code> |
|
|
230
|
+
| V | <code>left</code> | <code>buf.move(BACKWARD_CHAR)</code> |
|
|
231
|
+
| V | <code>m <char></code> | <code>buf.mark_current_position(<char>)</code> |
|
|
232
|
+
| V | <code>pagedown</code> | <code>vma.gui.page_down</code> |
|
|
233
|
+
| V | <code>pageup</code> | <code>vma.gui.page_up</code> |
|
|
234
|
+
| V | <code>q <char></code> | <code>vma.kbd.set_mode(:macro);vma.macro.start_recording(<char>)</code> |
|
|
235
|
+
| V | <code>right</code> | <code>buf.move(FORWARD_CHAR)</code> |
|
|
236
|
+
| V | <code>u</code> | <code>buf.transform_selection(:downcase)</code> |
|
|
237
|
+
| V | <code>up</code> | <code>buf.move(BACKWARD_LINE)</code> |
|
|
238
|
+
| V | <code>w</code> | <code>buf.jump_word(FORWARD, WORD_START)</code> |
|
|
239
|
+
| V | <code>x</code> | <code>buf.delete(SELECTION)</code> |
|
|
240
|
+
| V | <code>y</code> | <code>buf.copy_active_selection()</code> |
|
|
241
|
+
| V | <code>~</code> | <code>buf.transform_selection(:swapcase)</code> |
|
|
242
|
+
| X | <code><char></code> | <code>buf.replace_with_char(<char>);buf.move(FORWARD_CHAR)</code> |
|
|
243
|
+
| X | <code>down</code> | <code>buf.move(FORWARD_LINE)</code> |
|
|
244
|
+
| X | <code>esc</code> | <code>vma.kbd.to_previous_mode</code> |
|
|
245
|
+
| X | <code>left</code> | <code>buf.move(BACKWARD_CHAR)</code> |
|
|
246
|
+
| X | <code>right</code> | <code>buf.move(FORWARD_CHAR)</code> |
|
|
247
|
+
| X | <code>up</code> | <code>buf.move(BACKWARD_LINE)</code> |
|
|
248
|
+
| audio | <code>esc</code> | <code>vma.kbd.to_previous_mode</code> |
|
|
249
|
+
| audio | <code>f</code> | <code>Audio.seek_forward</code> |
|
|
250
|
+
| audio | <code>left</code> | <code>Audio.seek_forward(-5.0)</code> |
|
|
251
|
+
| audio | <code>q</code> | <code>vma.kbd.to_previous_mode</code> |
|
|
252
|
+
| audio | <code>right</code> | <code>Audio.seek_forward</code> |
|
|
253
|
+
| audio | <code>space</code> | <code>Audio.stop</code> |
|
|
254
|
+
| macro | <code>q</code> | <code>vma.kbd.to_previous_mode; vma.macro.end_recording</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.sh` (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.sh` 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.sh` 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.sh`, 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/exe/run_tests.rb
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/ruby
|
|
2
|
+
# Usage:
|
|
3
|
+
# run_tests.rb # run all tests in tests/
|
|
4
|
+
# run_tests.rb tests/test_foo.rb # run specific file
|
|
5
|
+
# run_tests.rb TestFooClass # run specific class (all files)
|
|
6
|
+
# run_tests.rb tests/test_foo.rb TestFooClass # specific class from specific file
|
|
7
|
+
# run_tests.rb foo,bar,baz # run tests/test_foo.rb, test_bar.rb, test_baz.rb
|
|
8
|
+
# run_tests.rb test_random_edit duration=60 # pass duration option to stress test
|
|
9
|
+
# run_tests.rb --headless # invisible window (xvfb-run, or Broadway if
|
|
10
|
+
# # xvfb not installed); does not disturb
|
|
11
|
+
# # normal use; e2e kbd tests skip
|
|
12
|
+
|
|
2
13
|
require "ripl/multi_line"
|
|
3
14
|
require "tempfile"
|
|
4
15
|
require "pathname"
|
|
@@ -9,15 +20,118 @@ selfpath = __FILE__
|
|
|
9
20
|
selfpath = File.readlink(selfpath) if File.lstat(selfpath).symlink?
|
|
10
21
|
scriptdir = File.expand_path(File.dirname(selfpath) + "/..")
|
|
11
22
|
|
|
12
|
-
|
|
13
|
-
|
|
23
|
+
# Relative to this script, not the current directory: started from elsewhere
|
|
24
|
+
# (or from an AppImage) a "./lib" there must not be picked up.
|
|
25
|
+
$LOAD_PATH.unshift(File.join(scriptdir, "lib"))
|
|
26
|
+
$LOAD_PATH.unshift(File.join(scriptdir, "ext"))
|
|
14
27
|
begin
|
|
15
28
|
gem_spec = Gem::Specification.find_by_name("vimamsa")
|
|
16
29
|
$LOAD_PATH.unshift(File.join(gem_spec.gem_dir, "ext", "vmaext")) if gem_spec
|
|
17
30
|
rescue Gem::MissingSpecError
|
|
18
31
|
end
|
|
19
32
|
|
|
33
|
+
raw_args = ARGV.dup.reject { |a| a == "--test" }
|
|
34
|
+
|
|
35
|
+
# --headless: run on an invisible display instead of the desktop. No window
|
|
36
|
+
# appears and focus is not touched, so tests can run in the background during
|
|
37
|
+
# normal use. E2E virtual-keyboard tests detect this and skip (uinput events
|
|
38
|
+
# go to the real seat, not to a headless display).
|
|
39
|
+
#
|
|
40
|
+
# Preferred backend: xvfb-run (private X server per run, auto display
|
|
41
|
+
# allocation and teardown). Fallback: GTK's Broadway backend (no extra
|
|
42
|
+
# packages, but a fixed shared display :9).
|
|
43
|
+
if raw_args.delete("--headless")
|
|
44
|
+
if system("which xvfb-run > /dev/null 2>&1")
|
|
45
|
+
# Re-exec self under a private Xvfb server. GTK must take the x11 backend
|
|
46
|
+
# and not the real Wayland session. xvfb-run exits with our exit code.
|
|
47
|
+
ENV["GDK_BACKEND"] = "x11"
|
|
48
|
+
ENV.delete("WAYLAND_DISPLAY")
|
|
49
|
+
exec("xvfb-run", "-a", "-s", "-screen 0 1600x1000x24",
|
|
50
|
+
RbConfig.ruby, File.expand_path(selfpath), *(ARGV - ["--headless"]))
|
|
51
|
+
end
|
|
52
|
+
require "socket"
|
|
53
|
+
# Display :9 listens on broadway10.socket (broadwayd numbers sockets display+1).
|
|
54
|
+
# A killed broadwayd leaves its socket file behind; a new daemon then fails to
|
|
55
|
+
# bind and the app hangs connecting to the dead socket — so probe it and clean up.
|
|
56
|
+
sock = File.join(ENV["XDG_RUNTIME_DIR"] || "/run/user/#{Process.uid}", "broadway10.socket")
|
|
57
|
+
broadwayd_alive = false
|
|
58
|
+
if File.socket?(sock)
|
|
59
|
+
begin
|
|
60
|
+
UNIXSocket.new(sock).close
|
|
61
|
+
broadwayd_alive = true # reuse the running daemon
|
|
62
|
+
rescue SystemCallError
|
|
63
|
+
File.unlink(sock)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
unless broadwayd_alive
|
|
67
|
+
bpid = Process.spawn("gtk4-broadwayd", ":9", :out => "/dev/null", :err => "/dev/null")
|
|
68
|
+
Process.detach(bpid)
|
|
69
|
+
at_exit do
|
|
70
|
+
begin
|
|
71
|
+
Process.kill("TERM", bpid)
|
|
72
|
+
rescue Errno::ESRCH, Errno::EPERM
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
sleep 0.5 # let broadwayd create its socket before GTK connects
|
|
76
|
+
end
|
|
77
|
+
ENV["GDK_BACKEND"] = "broadway"
|
|
78
|
+
ENV["BROADWAY_DISPLAY"] = ":9"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
test_files = raw_args.select { |a| a.end_with?(".rb") && File.file?(a) }
|
|
82
|
+
class_filter = raw_args.select { |a| a.match?(/\A[A-Z]/) }
|
|
83
|
+
|
|
84
|
+
# Parse key=value options (e.g. duration=60)
|
|
85
|
+
raw_args.each do |a|
|
|
86
|
+
$vma_test_duration = $1.to_i if a =~ /\Aduration=(\d+)\z/
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Expand comma-separated shorthand: "foo,bar" -> tests/test_foo.rb, tests/test_bar.rb
|
|
90
|
+
# Accepts both "foo" and "test_foo" as shorthand for tests/test_foo.rb.
|
|
91
|
+
raw_args.each do |a|
|
|
92
|
+
next if a.end_with?(".rb") || a.match?(/\A[A-Z]/) || a.match?(/\A\w+=/)
|
|
93
|
+
a.split(",").each do |name|
|
|
94
|
+
name = name.strip.sub(/\Atest_/, "")
|
|
95
|
+
path = File.join(scriptdir, "tests", "test_#{name}.rb")
|
|
96
|
+
test_files << path if File.file?(path)
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if test_files.empty?
|
|
101
|
+
test_files = Dir[File.join(scriptdir, "tests", "test_*.rb")].sort
|
|
102
|
+
# test_random_edit: stress test, run explicitly.
|
|
103
|
+
# test_notepad_bindings / test_vim_bindings: load alternative keybinding
|
|
104
|
+
# schemes, which would corrupt bindings for later test files in the
|
|
105
|
+
# shared process.
|
|
106
|
+
excluded = ["test_random_edit.rb", "test_notepad_bindings.rb", "test_vim_bindings.rb"]
|
|
107
|
+
test_files.reject! { |f| excluded.include?(File.basename(f)) }
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
$vma_test_class_filter = class_filter.empty? ? nil : class_filter
|
|
111
|
+
|
|
112
|
+
# Tests must not read or write the real user config (~/.config/vimamsa): the
|
|
113
|
+
# user's settings.rb/custom.rb would change editor behaviour, and test runs
|
|
114
|
+
# should not leave backups, sessions, etc. behind there. Point the config/data
|
|
115
|
+
# directory at an isolated location dedicated to tests (override with
|
|
116
|
+
# VMA_USER_DIR). See vma_user_dir/get_dot_path in editor.rb.
|
|
117
|
+
$vma_user_dir = File.expand_path(ENV["VMA_USER_DIR"] || "~/.config/vimamsa-test")
|
|
118
|
+
|
|
119
|
+
ARGV.replace(["--test"] + test_files)
|
|
120
|
+
|
|
20
121
|
require "vimamsa"
|
|
21
|
-
|
|
122
|
+
include Vimamsa
|
|
123
|
+
$vmag = Vimamsa::VMAgui.new()
|
|
22
124
|
$vmag.run
|
|
23
125
|
|
|
126
|
+
# GTK has quit and the results are printed. Exit without normal teardown:
|
|
127
|
+
# StrIdx's C++ indexing threads race with static destructors at exit and can
|
|
128
|
+
# segfault after a fully successful run (timing-dependent, seen under
|
|
129
|
+
# --headless). exit! skips at_exit, so stop our broadwayd explicitly first.
|
|
130
|
+
STDOUT.flush
|
|
131
|
+
if defined?(bpid) && bpid
|
|
132
|
+
begin
|
|
133
|
+
Process.kill("TERM", bpid)
|
|
134
|
+
rescue Errno::ESRCH, Errno::EPERM
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
exit!($vma_tests_ok == false ? 1 : 0)
|
data/exe/vimamsa
CHANGED
|
@@ -8,8 +8,20 @@ selfpath = __FILE__
|
|
|
8
8
|
selfpath = File.readlink(selfpath) if File.lstat(selfpath).symlink?
|
|
9
9
|
scriptdir = File.expand_path(File.dirname(selfpath) + "/..")
|
|
10
10
|
|
|
11
|
+
# --user-dir PATH (or --user-dir=PATH): use PATH as the config/data directory
|
|
12
|
+
# instead of ~/.config/vimamsa. Consumed here (and removed from ARGV) so it is
|
|
13
|
+
# available before anything reads the user dir, including the listen check below.
|
|
14
|
+
if (i = ARGV.index("--user-dir"))
|
|
15
|
+
$vma_user_dir = File.expand_path(ARGV[i + 1]) if ARGV[i + 1]
|
|
16
|
+
ARGV.slice!(i, 2)
|
|
17
|
+
elsif (arg = ARGV.find { |a| a.start_with?("--user-dir=") })
|
|
18
|
+
$vma_user_dir = File.expand_path(arg.split("=", 2)[1])
|
|
19
|
+
ARGV.delete(arg)
|
|
20
|
+
end
|
|
21
|
+
$vma_user_dir ||= File.expand_path("~/.config/vimamsa")
|
|
22
|
+
|
|
11
23
|
# If process is already running, open the parameter file in the running process and exit.
|
|
12
|
-
listen_dir = File.
|
|
24
|
+
listen_dir = File.join($vma_user_dir, "listen")
|
|
13
25
|
if File.exist?(listen_dir) and !ARGV[0].nil?
|
|
14
26
|
tmpf = Tempfile.new("vmarun", listen_dir)
|
|
15
27
|
fp = tmpf.path
|
|
@@ -29,11 +41,19 @@ if File.exist?(listen_dir) and !ARGV[0].nil?
|
|
|
29
41
|
exit(0) if !timeout
|
|
30
42
|
end
|
|
31
43
|
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
# Relative to this script, not the current directory: started from elsewhere
|
|
45
|
+
# (or from an AppImage) a "./lib" there must not be picked up.
|
|
46
|
+
$LOAD_PATH.unshift(File.join(scriptdir, "lib"))
|
|
47
|
+
$LOAD_PATH.unshift(File.join(scriptdir, "ext"))
|
|
34
48
|
|
|
35
49
|
require "vimamsa"
|
|
50
|
+
include Vimamsa
|
|
51
|
+
|
|
52
|
+
# Persist crash/segfault debug info (native stderr dump + structured reports)
|
|
53
|
+
# to ~/.config/vimamsa/crash/ .
|
|
54
|
+
Vimamsa::CrashHandler.setup
|
|
55
|
+
|
|
36
56
|
# Ilib:ext
|
|
37
57
|
# r rbvma -e "puts VMA.new.run"
|
|
38
|
-
$vmag = VMAgui.new()
|
|
58
|
+
$vmag = Vimamsa::VMAgui.new()
|
|
39
59
|
$vmag.run
|