fatty 0.99.8 → 0.99.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +316 -211
  3. data/README.org +94 -0
  4. data/exe/fatty +58 -9
  5. data/exe/themer +273 -0
  6. data/lib/fatty/ansi/renderer.rb +17 -7
  7. data/lib/fatty/api/output.rb +4 -15
  8. data/lib/fatty/api/suspend.rb +9 -0
  9. data/lib/fatty/api.rb +1 -0
  10. data/lib/fatty/callback_environment.rb +1 -0
  11. data/lib/fatty/config_files/themes/capuchin_monk.yml +4 -8
  12. data/lib/fatty/config_files/themes/catppuccin_latte.yml +4 -8
  13. data/lib/fatty/config_files/themes/catppuccin_mocha.yml +4 -8
  14. data/lib/fatty/config_files/themes/cyberpunk.yml +4 -8
  15. data/lib/fatty/config_files/themes/dracula.yml +4 -8
  16. data/lib/fatty/config_files/themes/everforest_dark.yml +4 -8
  17. data/lib/fatty/config_files/themes/gruvbox_dark.yml +4 -8
  18. data/lib/fatty/config_files/themes/gruvbox_light.yml +4 -8
  19. data/lib/fatty/config_files/themes/mono.yml +6 -10
  20. data/lib/fatty/config_files/themes/monokai.yml +4 -8
  21. data/lib/fatty/config_files/themes/nordic.yml +16 -8
  22. data/lib/fatty/config_files/themes/onedark.yml +4 -8
  23. data/lib/fatty/config_files/themes/solarized_dark.yml +4 -8
  24. data/lib/fatty/config_files/themes/solarized_light.yml +4 -8
  25. data/lib/fatty/config_files/themes/terminal.yml +8 -12
  26. data/lib/fatty/config_files/themes/tokyo_night.yml +4 -8
  27. data/lib/fatty/config_files/themes/wordperfect.yml +1 -5
  28. data/lib/fatty/log_formats/json.rb +1 -1
  29. data/lib/fatty/log_formats/text.rb +1 -2
  30. data/lib/fatty/output_buffer.rb +40 -5
  31. data/lib/fatty/renderer/curses.rb +60 -8
  32. data/lib/fatty/renderer/truecolor.rb +46 -10
  33. data/lib/fatty/session/output_session.rb +25 -9
  34. data/lib/fatty/terminal.rb +12 -0
  35. data/lib/fatty/themes/manager.rb +12 -3
  36. data/lib/fatty/themes/resolver.rb +1 -1
  37. data/lib/fatty/version.rb +1 -1
  38. metadata +4 -1
data/README.md CHANGED
@@ -1,111 +1,115 @@
1
- - [Introduction](#orgc5a13d2)
2
- - [Quick Start](#org6313195)
3
- - [Installing](#org2ab7619)
4
- - [Trying it Out with the \`fatty\` Demo](#orgbb6efa2)
5
- - [Builtin commands](#org6a3da85)
6
- - [Screenshots](#org03c4f60)
7
- - [Command line editing](#org7f8b501)
8
- - [Searchable Output](#orge6a2a61)
9
- - [Paging Markdown](#org98556a8)
10
- - [Popup Selection](#org87e5076)
11
- - [Usage](#org12e2b74)
12
- - [Launching a Fatty Terminal](#org0be8165)
13
- - [`on_accept`](#orgf42a055)
14
- - [Parameters to `on_accept`](#orga5d3390)
15
- - [The `line` parameter to `on_accept`](#org18111d5)
16
- - [The callback parameter to `on_accept`](#org246af2b)
17
- - [Output ordering](#org210dcba)
18
- - [Long-running callbacks and interruption](#org5093875)
19
- - [ANSI colors in output](#orgcf17f3b)
20
- - [Other parameters to `Terminal.new`](#org825992c)
21
- - [The Callback API](#org7874847)
22
- - [`append(text, follow: true, role: nil)`](#org3a8e5be)
23
- - [`append_now(text, follow: true, mode: nil, role: nil)`](#orga261846)
24
- - [`markdown(text)`](#org2c6117a)
25
- - [`status(text, role: :info)`](#org80d267c)
26
- - [`good(text, replace: false, render: true)`](#orgb6de417)
27
- - [`info(text, replace: false, render: true)`](#org63d40a7)
28
- - [`warn(text, replace: false, render: true)`](#org1e44b90)
29
- - [`error(text, replace: false, render: true)`](#orga6187bb)
30
- - [`oops(text, replace: false, render: true)`](#orga75943f)
31
- - [`alert(text, role: :info)`](#orgc92ba6a)
32
- - [`prompt(prompt, initial: "", cancel_value: nil, history_key: nil, save_history: true)`](#orgfc95c42)
33
- - [`check_interrupt!`](#orgc6a9c07)
34
- - [`add_progress(label:, total: nil, style: :percent, role: :info, width: 40)`](#org68c4685)
35
- - [Initialization `add_progress(label:, style: :percent, total: nil, role: :info, width: 40)`](#orgaf54268)
36
- - [Update `update(current: nil, indicator: nil, render: false)`](#org63766b4)
37
- - [Finish](#org489dabd)
38
- - [Clear](#org499367c)
39
- - [`choose(prompt, choices:, initial_choice_idx: 0, cancel_value: nil)`](#org88dd294)
40
- - [`choose_multi(prompt, choices:, cancel_value: nil)`](#org7cfc6fb)
41
- - [`confirm(prompt, yes_label: "Yes", no_label: "No", cancel_value: false)`](#org24552a8)
42
- - [`menu(prompt, choices:, initial_choice_idx: 0, cancel_value: nil)`](#orgc7a266a)
43
- - [`environment`](#org04ee12a)
44
- - [Default Interaction](#orgacd5f7c)
45
- - [Parts of the Screen](#org11ef010)
46
- - [Input Field](#org98aa3ba)
47
- - [Output Pane](#orge520676)
48
- - [Status Area](#org2582262)
49
- - [Alert Area](#orgc32c00f)
50
- - [Command-line Editing](#org4dfe709)
51
- - [Input Context](#orga183f84)
52
- - [Cursor Motion](#org81087f8)
53
- - [Clearing](#org37f216d)
54
- - [Undo and Redo](#org3ffee42)
55
- - [Deletion and Killing](#org930cee7)
56
- - [Yanking, Mark, and Region](#org324c2f6)
57
- - [Count Prefix](#orgd8ab4ab)
58
- - [History Navigation](#orgb63d0d0)
59
- - [Completion](#org1732f5c)
60
- - [Accept or Cancel](#orgf829904)
61
- - [Paging Context](#orgf7f860e)
62
- - [Searching Output](#orgb329bbd)
63
- - [String and Regex Search](#orgc3fcc69)
64
- - [Incremental Search](#org53d4559)
65
- - [Configuration](#orga0e6a57)
66
- - [General Configuration `config.yml`](#org2d08557)
67
- - [`word_char_re`](#org0df073b)
68
- - [`esc_delay`](#org4288158)
69
- - [`history`](#org973b5fe)
70
- - [`file`](#orga1dcc95)
71
- - [`max`](#org5f744d4)
72
- - [`theme`](#org64941b1)
73
- - [`truecolor`](#orge751b35)
74
- - [`log`](#orgd56b3fd)
75
- - [`file`](#org60dc0ba)
76
- - [`level`](#orgeb194d3)
77
- - [`tags`](#org823d99d)
78
- - [Key code definitions `keydefs.yml`](#orge3d84e5)
79
- - [Key bindings `keybindings.yml`](#org2a9d985)
80
- - [Key Names](#org47f10de)
81
- - [Printable Keys](#orge517d82)
82
- - [Curses and Fatty Named Keys](#org515f394)
83
- - [Possibly Invisible Keys](#org3fa3e38)
84
- - [Unnamed but Recognized Keys](#org96ea9b2)
85
- - [Mouse Events](#org8888baf)
86
- - [Modifiers](#org2ce52a8)
87
- - [Contexts](#orgc4d7ddc)
88
- - [Actions](#orgd327240)
89
- - [Input buffer actions](#org0a51d38)
90
- - [Input field actions](#org0156270)
91
- - [Shell session actions](#org49f5b2c)
92
- - [Pager actions](#org51e582e)
93
- - [Pager search actions](#org9c6e828)
94
- - [Popup actions](#orgf26b607)
95
- - [Prompt popup actions](#org5abe8ab)
96
- - [Utility Actions](#orgb190c08)
97
- - [Themes `themes/`](#org19a3e32)
98
- - [Distributed Themes](#orge0db426)
99
- - [Custom Themes](#org23d543d)
100
- - [Theme Name](#orgc7d4f2a)
101
- - [Inheritance from Another Theme](#org7186f3f)
102
- - [Inheritance within a Theme](#org85b6b26)
103
- - [Theme Roles](#org6741eee)
104
- - [Role Colors and Attributes and Frame Style](#org33b14c5)
105
-
106
-
107
-
108
- <a id="orgc5a13d2"></a>
1
+ - [Introduction](#orgc090857)
2
+ - [Quick Start](#org844168e)
3
+ - [Installing](#orge9b8048)
4
+ - [Trying it Out with the \`fatty\` Demo](#org9284335)
5
+ - [Builtin commands](#orga9c3071)
6
+ - [Screenshots](#org0e411f4)
7
+ - [Command line editing](#org68abe96)
8
+ - [Searchable Output](#orgca94584)
9
+ - [Paging Markdown](#org458ad81)
10
+ - [Popup Selection](#orgfb3da2e)
11
+ - [Usage](#orgf00946d)
12
+ - [Launching a Fatty Terminal](#orgc5ba25f)
13
+ - [`on_accept`](#orgb046bd4)
14
+ - [Parameters to `on_accept`](#orgd3107f2)
15
+ - [The `line` parameter to `on_accept`](#orga7ac101)
16
+ - [The callback parameter to `on_accept`](#org7590a60)
17
+ - [Output ordering](#org640dc41)
18
+ - [Long-running callbacks and interruption](#org34665cc)
19
+ - [ANSI colors in output](#org103299f)
20
+ - [Other parameters to `Terminal.new`](#org456c2ad)
21
+ - [The Callback API](#org5f103bb)
22
+ - [`append(text, follow: true, role: nil)`](#orgf90a804)
23
+ - [`append_now(text, follow: true, mode: nil, role: nil)`](#org96421ae)
24
+ - [`markdown(text)`](#orge61ad54)
25
+ - [`status(text, role: :info)`](#org8d20d95)
26
+ - [`good(text, replace: false, render: true)`](#org4430a3b)
27
+ - [`info(text, replace: false, render: true)`](#org60083e9)
28
+ - [`warn(text, replace: false, render: true)`](#org98a2b3c)
29
+ - [`error(text, replace: false, render: true)`](#orgd4f04ac)
30
+ - [`oops(text, replace: false, render: true)`](#org807c2ce)
31
+ - [`alert(text, role: :info)`](#org96063bb)
32
+ - [`prompt(prompt, initial: "", cancel_value: nil, history_key: nil, save_history: true)`](#org7bb5b38)
33
+ - [`check_interrupt!`](#orga338e63)
34
+ - [`add_progress(label:, total: nil, style: :percent, role: :info, width: 40)`](#orgcb79368)
35
+ - [Initialization `add_progress(label:, style: :percent, total: nil, role: :info, width: 40)`](#org789160a)
36
+ - [Update `update(current: nil, indicator: nil, render: false)`](#orge7cfc41)
37
+ - [Finish](#orgf7533d1)
38
+ - [Clear](#orgede5f40)
39
+ - [`choose(prompt, choices:, initial_choice_idx: 0, cancel_value: nil)`](#org5994004)
40
+ - [`choose_multi(prompt, choices:, cancel_value: nil)`](#orgd82f0ec)
41
+ - [`confirm(prompt, yes_label: "Yes", no_label: "No", cancel_value: false)`](#orga06503c)
42
+ - [`menu(prompt, choices:, initial_choice_idx: 0, cancel_value: nil)`](#org6463694)
43
+ - [`suspend(&block)`](#org5fe1480)
44
+ - [`environment`](#orgd5bf8ee)
45
+ - [Terminal Methods](#org1c1d3fc)
46
+ - [`Teminal#suspend(&block)`](#org5e187ea)
47
+ - [Default Interaction](#org47f52fd)
48
+ - [Parts of the Screen](#orga27a6ad)
49
+ - [Input Field](#orgbd88b45)
50
+ - [Output Pane](#orge98ad82)
51
+ - [Status Area](#org9831bf4)
52
+ - [Alert Area](#org5d9a3d5)
53
+ - [Command-line Editing](#orge76ca34)
54
+ - [Input Context](#org2aaff21)
55
+ - [Cursor Motion](#org14d68c9)
56
+ - [Clearing](#orgd13c620)
57
+ - [Undo and Redo](#org54d5f7a)
58
+ - [Deletion and Killing](#orgcf696da)
59
+ - [Yanking, Mark, and Region](#orga7f73fe)
60
+ - [Count Prefix](#org29d1c16)
61
+ - [History Navigation](#org511da2c)
62
+ - [Completion](#org1648a2a)
63
+ - [Accept or Cancel](#org9afdcdd)
64
+ - [Paging Context](#org8c38312)
65
+ - [Searching Output](#org567c0c0)
66
+ - [String and Regex Search](#orgbf77d1b)
67
+ - [Incremental Search](#orgda99c8d)
68
+ - [Configuration](#orgfd272b4)
69
+ - [General Configuration `config.yml`](#org8e3d563)
70
+ - [`word_char_re`](#org773e7d4)
71
+ - [`esc_delay`](#org8229289)
72
+ - [`history`](#org5789fd5)
73
+ - [`file`](#org1959b2c)
74
+ - [`max`](#orgbb18fb6)
75
+ - [`theme`](#org8a3ecd9)
76
+ - [`truecolor`](#org9ba735f)
77
+ - [`log`](#org13b974b)
78
+ - [`file`](#orgb93c9b8)
79
+ - [`level`](#org0fb9a08)
80
+ - [`tags`](#org2247ba8)
81
+ - [Key code definitions `keydefs.yml`](#org11c2491)
82
+ - [Key bindings `keybindings.yml`](#orgab7252d)
83
+ - [Key Names](#org370c8e8)
84
+ - [Printable Keys](#org3a580c2)
85
+ - [Curses and Fatty Named Keys](#org1e9bcad)
86
+ - [Possibly Invisible Keys](#orgec1f50a)
87
+ - [Unnamed but Recognized Keys](#org56d8cd7)
88
+ - [Mouse Events](#org0eda788)
89
+ - [Modifiers](#orgbffc2cf)
90
+ - [Contexts](#org0662dd0)
91
+ - [Actions](#org55e8a55)
92
+ - [Input buffer actions](#org5c651ab)
93
+ - [Input field actions](#orga37809c)
94
+ - [Shell session actions](#org5bd909b)
95
+ - [Pager actions](#orgcba2897)
96
+ - [Pager search actions](#org2e0b296)
97
+ - [Popup actions](#org76791bc)
98
+ - [Prompt popup actions](#org6b1188d)
99
+ - [Utility Actions](#orgf63740e)
100
+ - [Themes `themes/`](#org3856a84)
101
+ - [Distributed Themes](#org88b0217)
102
+ - [Custom Themes](#org8769885)
103
+ - [Theme Name](#orgd425d6c)
104
+ - [Inheritance from Another Theme](#org1e1695f)
105
+ - [Inheritance within a Theme](#org8557acf)
106
+ - [Theme Roles](#org76e4687)
107
+ - [Role Colors and Attributes and Frame Style](#orge738a22)
108
+ - [The `themer` helper](#orgdd1744c)
109
+
110
+
111
+
112
+ <a id="orgc090857"></a>
109
113
 
110
114
  # Introduction
111
115
 
@@ -133,12 +137,12 @@ In other words, fatty allows you to write a terminal-based REPL of your choosing
133
137
  `Fatty` is *not* a terminal emulator but runs on top of one.
134
138
 
135
139
 
136
- <a id="org6313195"></a>
140
+ <a id="org844168e"></a>
137
141
 
138
142
  # Quick Start
139
143
 
140
144
 
141
- <a id="org2ab7619"></a>
145
+ <a id="orge9b8048"></a>
142
146
 
143
147
  ## Installing
144
148
 
@@ -149,7 +153,7 @@ $ gem install fatty
149
153
  ```
150
154
 
151
155
 
152
- <a id="orgbb6efa2"></a>
156
+ <a id="org9284335"></a>
153
157
 
154
158
  ## Trying it Out with the \`fatty\` Demo
155
159
 
@@ -158,7 +162,7 @@ Once installed, you can try out `fatty` with the included program called `fatty`
158
162
  Once inside `fatty` you will be prompted with a prompt that names your current directory. Type `help` to get a summary of the builtin commands available to you. If you type anything other than a builtin command, `fatty` attempts to run it as a shell command and displays the output.
159
163
 
160
164
 
161
- <a id="org6a3da85"></a>
165
+ <a id="orga9c3071"></a>
162
166
 
163
167
  ### Builtin commands
164
168
 
@@ -192,12 +196,12 @@ Here are the commands builtin to `fatty`
192
196
  | colors | Display ANSI, 256-color, and X11 color diagnostics |
193
197
 
194
198
 
195
- <a id="org03c4f60"></a>
199
+ <a id="org0e411f4"></a>
196
200
 
197
201
  ### Screenshots
198
202
 
199
203
 
200
- <a id="org7f8b501"></a>
204
+ <a id="org68abe96"></a>
201
205
 
202
206
  #### Command line editing
203
207
 
@@ -206,7 +210,7 @@ Here is the command line, mid-edit showing a region selected and, in dim text to
206
210
  ![img](images/input_editing.png "Input editing showing region and predictive completion.")
207
211
 
208
212
 
209
- <a id="orge6a2a61"></a>
213
+ <a id="orgca94584"></a>
210
214
 
211
215
  #### Searchable Output
212
216
 
@@ -215,7 +219,7 @@ While paging output, you can search for words, as here the user searches for the
215
219
  ![img](images/search_output.png "Searching for instances of `tty` in the output.")
216
220
 
217
221
 
218
- <a id="org98556a8"></a>
222
+ <a id="org458ad81"></a>
219
223
 
220
224
  #### Paging Markdown
221
225
 
@@ -224,7 +228,7 @@ The `fatty` demo running the `markdown` command and paging the output. It shows
224
228
  ![img](images/page_markdown.png "Running the `fatty` demo `markdown` command.")
225
229
 
226
230
 
227
- <a id="org87e5076"></a>
231
+ <a id="orgfb3da2e"></a>
228
232
 
229
233
  #### Popup Selection
230
234
 
@@ -233,17 +237,17 @@ One of the many "widgets" available through `fatty` is the ability to present th
233
237
  ![img](images/choose_popup.png "Running the `fatty` demo `choose` command.")
234
238
 
235
239
 
236
- <a id="org12e2b74"></a>
240
+ <a id="orgf00946d"></a>
237
241
 
238
242
  # Usage
239
243
 
240
244
 
241
- <a id="org0be8165"></a>
245
+ <a id="orgc5ba25f"></a>
242
246
 
243
247
  ## Launching a Fatty Terminal
244
248
 
245
249
 
246
- <a id="orgf42a055"></a>
250
+ <a id="orgb046bd4"></a>
247
251
 
248
252
  ### `on_accept`
249
253
 
@@ -276,14 +280,14 @@ When a `fatty` application runs, `fatty` installs a few files if they do not exi
276
280
  - `themes`, a directory of pre-defined theme definitions that you can choose from and add to by adding your own themes.
277
281
 
278
282
 
279
- <a id="orga5d3390"></a>
283
+ <a id="orgd3107f2"></a>
280
284
 
281
285
  #### Parameters to `on_accept`
282
286
 
283
287
  The `on_accept` proc passed to an instance of `Fatty::Terminal` can take one or two parameters: (1) `line`, the edited line as it exists when the user types `RETURN` and (2) an optional callback parameter that you can use to access the facilities of `fatty`.
284
288
 
285
289
 
286
- <a id="org18111d5"></a>
290
+ <a id="orga7ac101"></a>
287
291
 
288
292
  #### The `line` parameter to `on_accept`
289
293
 
@@ -324,7 +328,7 @@ Fatty::Terminal.new(
324
328
  ```
325
329
 
326
330
 
327
- <a id="org246af2b"></a>
331
+ <a id="org7590a60"></a>
328
332
 
329
333
  #### The callback parameter to `on_accept`
330
334
 
@@ -349,7 +353,7 @@ Fatty::Terminal.new(
349
353
  The callback parameter responds to several methods that allow your application to interact with the user. They are documented below.
350
354
 
351
355
 
352
- <a id="org210dcba"></a>
356
+ <a id="org640dc41"></a>
353
357
 
354
358
  #### Output ordering
355
359
 
@@ -374,7 +378,7 @@ Calls to `append_now` are different. They append text and immediately render a f
374
378
  At the end of the callback, `Fatty` finishes the command and updates the pager state. Output produced with `append_now` may therefore appear during the callback, while output from `append`, `markdown`, and the callback's return value appears after the callback returns.
375
379
 
376
380
 
377
- <a id="org5093875"></a>
381
+ <a id="org34665cc"></a>
378
382
 
379
383
  #### Long-running callbacks and interruption
380
384
 
@@ -413,14 +417,14 @@ end
413
417
  ```
414
418
 
415
419
 
416
- <a id="orgcf17f3b"></a>
420
+ <a id="org103299f"></a>
417
421
 
418
422
  #### ANSI colors in output
419
423
 
420
424
  Text passed to `append`, `append_now`, `status`, and `alert` may contain ANSI SGR color/style sequences. Fatty interprets those sequences relative to the current theme role, so an ANSI reset returns to the active Fatty role rather than to the terminal's physical default colors. `fatty` includes the nice [`Rainbow` gem](https://github.com/ku1ik/rainbow) for colorizing text as a convenience.
421
425
 
422
426
 
423
- <a id="org825992c"></a>
427
+ <a id="org456c2ad"></a>
424
428
 
425
429
  ### Other parameters to `Terminal.new`
426
430
 
@@ -447,14 +451,14 @@ Fatty::Terminal.new(
447
451
  With that setup, commands entered in `~/src/byr` are favored when the terminal is again in `~/src/byr`, while commands entered elsewhere remain available as fallback history.
448
452
 
449
453
 
450
- <a id="org7874847"></a>
454
+ <a id="org5f103bb"></a>
451
455
 
452
456
  ## The Callback API
453
457
 
454
458
  Here are the details on the messages that you can send to the callback parameter to the `on_accept` proc.
455
459
 
456
460
 
457
- <a id="org3a8e5be"></a>
461
+ <a id="orgf90a804"></a>
458
462
 
459
463
  ### `append(text, follow: true, role: nil)`
460
464
 
@@ -463,7 +467,7 @@ Add the given text to the output pane. After a full page of output is produced,
463
467
  You can specify a "role" of `:good`, `:info`, `:warn`, or `:error` to color the output according to the current theme's coloring scheme for those roles. Those role names can be symbols or strings.
464
468
 
465
469
 
466
- <a id="orga261846"></a>
470
+ <a id="org96421ae"></a>
467
471
 
468
472
  ### `append_now(text, follow: true, mode: nil, role: nil)`
469
473
 
@@ -474,7 +478,7 @@ Setting the mode to `:scrolling` or `:paging` determines whether the output is s
474
478
  You can specify a "role" of `:good`, `:info`, `:warn`, or `:error` to color the output according to the current theme's coloring scheme for those roles. Those role names can be symbols or strings.
475
479
 
476
480
 
477
- <a id="org2c6117a"></a>
481
+ <a id="orge61ad54"></a>
478
482
 
479
483
  ### `markdown(text)`
480
484
 
@@ -494,7 +498,7 @@ and this should appear on the next line.
494
498
  ```
495
499
 
496
500
 
497
- <a id="org80d267c"></a>
501
+ <a id="org8d20d95"></a>
498
502
 
499
503
  ### `status(text, role: :info)`
500
504
 
@@ -506,49 +510,49 @@ Display the text in the "status" area, the lines immediately above the input fie
506
510
  - **:error:** colored something to suggest danger, usually some tone of red.
507
511
 
508
512
 
509
- <a id="orgb6de417"></a>
513
+ <a id="org4430a3b"></a>
510
514
 
511
515
  ### `good(text, replace: false, render: true)`
512
516
 
513
517
  Display the text in the status area with the role :good.
514
518
 
515
519
 
516
- <a id="org63d40a7"></a>
520
+ <a id="org60083e9"></a>
517
521
 
518
522
  ### `info(text, replace: false, render: true)`
519
523
 
520
524
  Display the text in the status area with the role :info.
521
525
 
522
526
 
523
- <a id="org1e44b90"></a>
527
+ <a id="org98a2b3c"></a>
524
528
 
525
529
  ### `warn(text, replace: false, render: true)`
526
530
 
527
531
  Display the text in the status area with the role :warn.
528
532
 
529
533
 
530
- <a id="orga6187bb"></a>
534
+ <a id="orgd4f04ac"></a>
531
535
 
532
536
  ### `error(text, replace: false, render: true)`
533
537
 
534
538
  Display the text in the status area with the role :error.
535
539
 
536
540
 
537
- <a id="orga75943f"></a>
541
+ <a id="org807c2ce"></a>
538
542
 
539
543
  ### `oops(text, replace: false, render: true)`
540
544
 
541
545
  An alias for `error(text)`
542
546
 
543
547
 
544
- <a id="orgc92ba6a"></a>
548
+ <a id="org96063bb"></a>
545
549
 
546
550
  ### `alert(text, role: :info)`
547
551
 
548
552
  Display the text in the one-line alert panel just below the input field. In the alert panel, the role only controls the foreground color, not the background.
549
553
 
550
554
 
551
- <a id="orgfc95c42"></a>
555
+ <a id="org7bb5b38"></a>
552
556
 
553
557
  ### `prompt(prompt, initial: "", cancel_value: nil, history_key: nil, save_history: true)`
554
558
 
@@ -578,7 +582,7 @@ The `prompt` input has its own history facility separate from the history in the
578
582
  `prompt` returns whatever the user typed and returns `nil` if the user cancels with C-c or C-g unless you specify an alternative `cancel_value`.
579
583
 
580
584
 
581
- <a id="orgc6a9c07"></a>
585
+ <a id="orga338e63"></a>
582
586
 
583
587
  ### `check_interrupt!`
584
588
 
@@ -589,7 +593,7 @@ The polling is throttled, so `check_interrupt!` may be called frequently. It sho
589
593
  Fatty catches `Fatty::Interrupt` at the callback boundary, finishes the current command, restores the terminal state, and resumes the normal input loop.
590
594
 
591
595
 
592
- <a id="org68c4685"></a>
596
+ <a id="orgcb79368"></a>
593
597
 
594
598
  ### `add_progress(label:, total: nil, style: :percent, role: :info, width: 40)`
595
599
 
@@ -605,7 +609,7 @@ Display a progress widget in the status area to show the user that the system is
605
609
  - **:trail:** display an "indicator" on each call of `update(indicator: <string>)`
606
610
 
607
611
 
608
- <a id="orgaf54268"></a>
612
+ <a id="org789160a"></a>
609
613
 
610
614
  #### Initialization `add_progress(label:, style: :percent, total: nil, role: :info, width: 40)`
611
615
 
@@ -616,7 +620,7 @@ Display a progress widget in the status area to show the user that the system is
616
620
  - **`width`:** The number of characters for the full widget display: it is only relevant for the bar styles and the trail style; otherwise it is ignored.
617
621
 
618
622
 
619
- <a id="org63766b4"></a>
623
+ <a id="orge7cfc41"></a>
620
624
 
621
625
  #### Update `update(current: nil, indicator: nil, render: false)`
622
626
 
@@ -722,21 +726,21 @@ Fatty::Terminal.new(
722
726
  ```
723
727
 
724
728
 
725
- <a id="org489dabd"></a>
729
+ <a id="orgf7533d1"></a>
726
730
 
727
731
  #### Finish
728
732
 
729
733
  As the prior examples illustrate, you can issue an ending message at the end of the process by calling `#finish` on the Progress object.
730
734
 
731
735
 
732
- <a id="org499367c"></a>
736
+ <a id="orgede5f40"></a>
733
737
 
734
738
  #### Clear
735
739
 
736
740
  And, if you have occasion, you can clear the Progress by calling `#clear` on the Progress object.
737
741
 
738
742
 
739
- <a id="org88dd294"></a>
743
+ <a id="org5994004"></a>
740
744
 
741
745
  ### `choose(prompt, choices:, initial_choice_idx: 0, cancel_value: nil)`
742
746
 
@@ -802,7 +806,7 @@ Fatty::Terminal.new(
802
806
  ```
803
807
 
804
808
 
805
- <a id="org7cfc6fb"></a>
809
+ <a id="orgd82f0ec"></a>
806
810
 
807
811
  ### `choose_multi(prompt, choices:, cancel_value: nil)`
808
812
 
@@ -820,7 +824,7 @@ Present a set of `choices:`, which can either be
820
824
  The `prompt` String (by default "Choose Many") can guide the user about the purpose of the choices.
821
825
 
822
826
 
823
- <a id="org24552a8"></a>
827
+ <a id="orga06503c"></a>
824
828
 
825
829
  ### `confirm(prompt, yes_label: "Yes", no_label: "No", cancel_value: false)`
826
830
 
@@ -831,7 +835,7 @@ Present the user with a simple Yes/No choice using your choice of ways to expres
831
835
  `confirm` will return `false` on cancellation with C-c or C-g unless you provide an alternative `cancel_value:`, in which case it returns that.
832
836
 
833
837
 
834
- <a id="orgc7a266a"></a>
838
+ <a id="org6463694"></a>
835
839
 
836
840
  ### `menu(prompt, choices:, initial_choice_idx: 0, cancel_value: nil)`
837
841
 
@@ -878,7 +882,24 @@ If you want to set one of the choices as the initial choice, set `initial_choice
878
882
  If you want a value associated with the user's cancellation of the chooser with C-c or C-g, set `cancel_value:` to that value.
879
883
 
880
884
 
881
- <a id="org04ee12a"></a>
885
+ <a id="org5fe1480"></a>
886
+
887
+ ### `suspend(&block)`
888
+
889
+ The `suspend` method temporarily gives control of the terminal to the application while the supplied block runs. When the block finishes, Fatty restores its terminal state and redraws the interface.
890
+
891
+ This is useful for running interactive terminal programs such as editors, debuggers, shells, or other programs that need direct access to the terminal.
892
+
893
+ ```ruby
894
+ env.suspend do
895
+ system(ENV.fetch("EDITOR", "vi"), filename)
896
+ end
897
+ ```
898
+
899
+ The value of the block is returned by `suspend`. Terminal state is restored even if the block exits by raising an exception.
900
+
901
+
902
+ <a id="orgd5bf8ee"></a>
882
903
 
883
904
  ### `environment`
884
905
 
@@ -915,59 +936,71 @@ The environment report also includes a nested `:curses` hash:
915
936
  | `:can_change_color` | Whether curses can redefine color values |
916
937
 
917
938
 
918
- <a id="orgacd5f7c"></a>
939
+ <a id="org1c1d3fc"></a>
940
+
941
+ ## Terminal Methods
942
+
943
+
944
+ <a id="org5e187ea"></a>
945
+
946
+ ### `Teminal#suspend(&block)`
947
+
948
+ Return control to the launching terminal, execute the given block, and return.
949
+
950
+
951
+ <a id="org47f52fd"></a>
919
952
 
920
953
  # Default Interaction
921
954
 
922
955
 
923
- <a id="org11ef010"></a>
956
+ <a id="orga27a6ad"></a>
924
957
 
925
958
  ## Parts of the Screen
926
959
 
927
960
 
928
- <a id="org98aa3ba"></a>
961
+ <a id="orgbd88b45"></a>
929
962
 
930
963
  ### Input Field
931
964
 
932
965
  Just above the bottom of the screen where all the action takes place: it is a line for editing the input. It displays a prompt followed by an area in which you build the command line using `fatty's` editing facilities.
933
966
 
934
967
 
935
- <a id="orge520676"></a>
968
+ <a id="orge98ad82"></a>
936
969
 
937
970
  ### Output Pane
938
971
 
939
972
  Most of the top part of the screen is reserved for displaying whatever output is sent to it with the `on_accept` callback to the `Terminal`. It can render colored ANSI-encoded strings and will page long output so you can view it a page at a time and even search the output.
940
973
 
941
974
 
942
- <a id="org2582262"></a>
975
+ <a id="org9831bf4"></a>
943
976
 
944
977
  ### Status Area
945
978
 
946
979
  The one to four lines just above the Input Field that displays output to the user that is out of band for the Output Pane. Brief messages of confirmation, warning, or error can be displayed there so as to get the user's immediate attention. Progress bars also render there where their visibility is made prominent.
947
980
 
948
981
 
949
- <a id="orgc32c00f"></a>
982
+ <a id="org5d9a3d5"></a>
950
983
 
951
984
  ### Alert Area
952
985
 
953
986
  Alerts are short-lived, non-scrolling messages shown below the input field. They are intended for user-visible conditions that require attention. `Fatty` uses this area to warn the user of unrecognized key codes and of unbound key presses.
954
987
 
955
988
 
956
- <a id="org4dfe709"></a>
989
+ <a id="orge76ca34"></a>
957
990
 
958
991
  ## Command-line Editing
959
992
 
960
993
  `fatty` aims to have a full-featured command-line editor for editing a single line of text that is sent to the `on_accept` proc for the `Terminal`. The default keybindings are based on Emacs keybindings, but they are fully customizable. Implementing `vim`-like keybindings is not currently possible because `fatty` has no notion of editing "modes" as would be required for any kind of a modal editor&#x2014;at least not yet. Maybe some day.
961
994
 
962
995
 
963
- <a id="orga183f84"></a>
996
+ <a id="org2aaff21"></a>
964
997
 
965
998
  ### Input Context
966
999
 
967
1000
  When editing the input line or text input for widgets like the \`prompt\`, \`fatty\` provides emacs-like editing keybindings by default. Many of these commands can take a count prefix argument to repeat the command count times. For example, \`M-8 M-0 #\` will insert 80 '#' characters at the cursor.
968
1001
 
969
1002
 
970
- <a id="org81087f8"></a>
1003
+ <a id="org14d68c9"></a>
971
1004
 
972
1005
  #### Cursor Motion
973
1006
 
@@ -991,7 +1024,7 @@ When editing the input line or text input for widgets like the \`prompt\`, \`fat
991
1024
  | C-:left | move cursor left one word |
992
1025
 
993
1026
 
994
- <a id="org37f216d"></a>
1027
+ <a id="orgd13c620"></a>
995
1028
 
996
1029
  #### Clearing
997
1030
 
@@ -1002,7 +1035,7 @@ This is one action that does not affect the input buffer but the output pane. It
1002
1035
  | C-l | clear the output pane |
1003
1036
 
1004
1037
 
1005
- <a id="org3ffee42"></a>
1038
+ <a id="org54d5f7a"></a>
1006
1039
 
1007
1040
  #### Undo and Redo
1008
1041
 
@@ -1016,7 +1049,7 @@ This is one action that does not affect the input buffer but the output pane. It
1016
1049
  | M-/ | redo |
1017
1050
 
1018
1051
 
1019
- <a id="org930cee7"></a>
1052
+ <a id="orgcf696da"></a>
1020
1053
 
1021
1054
  #### Deletion and Killing
1022
1055
 
@@ -1036,7 +1069,7 @@ When the region is active, destructive editing commands kill the region rather t
1036
1069
  | M-t | transpose words |
1037
1070
 
1038
1071
 
1039
- <a id="org324c2f6"></a>
1072
+ <a id="orga7f73fe"></a>
1040
1073
 
1041
1074
  #### Yanking, Mark, and Region
1042
1075
 
@@ -1064,7 +1097,7 @@ Notice that commands that normally delete characters or words, kill the region i
1064
1097
  | M-w | copy the region |
1065
1098
 
1066
1099
 
1067
- <a id="orgd8ab4ab"></a>
1100
+ <a id="org29d1c16"></a>
1068
1101
 
1069
1102
  #### Count Prefix
1070
1103
 
@@ -1080,7 +1113,7 @@ Fatty follows the emacs convention of making `C-u` multiply the count prefix by
1080
1113
  | M-<digit> | accumulate a count argument |
1081
1114
 
1082
1115
 
1083
- <a id="orgb63d0d0"></a>
1116
+ <a id="org511da2c"></a>
1084
1117
 
1085
1118
  #### History Navigation
1086
1119
 
@@ -1103,7 +1136,7 @@ You can navigate history items with the `up` and `down` keys as you would expect
1103
1136
  | C-r | search the history in a popup |
1104
1137
 
1105
1138
 
1106
- <a id="org1732f5c"></a>
1139
+ <a id="org1648a2a"></a>
1107
1140
 
1108
1141
  #### Completion
1109
1142
 
@@ -1149,7 +1182,7 @@ You can navigate history items with the `up` and `down` keys as you would expect
1149
1182
  Just as with command line completion, you can invoke a popup of completions with `M-TAB` and a popup of possible file names will appear within which you may filter the candidates down by narrowing. Unlike other forms of completion, the file name completion popup allows you to fill out the path by navigating directories within the popup by hitting `TAB` or `right` to descend into a sub-directory or `S-TAB` or `left` to ascend to the parent directory. The popup title shows the path so far.
1150
1183
 
1151
1184
 
1152
- <a id="orgf829904"></a>
1185
+ <a id="org9afdcdd"></a>
1153
1186
 
1154
1187
  #### Accept or Cancel
1155
1188
 
@@ -1165,7 +1198,7 @@ You can end a `fatty` session with `C-c` at the command line, or (only if the bu
1165
1198
  | C-d | quit \`fatty\` only if the input line is empty |
1166
1199
 
1167
1200
 
1168
- <a id="orgf7f860e"></a>
1201
+ <a id="org8c38312"></a>
1169
1202
 
1170
1203
  ### Paging Context
1171
1204
 
@@ -1222,7 +1255,7 @@ You can add line numbers to the display while paging by using the `=` key.
1222
1255
  You can also "narrow" the output with `<`, which will prompt you for one or more terms to match. The output will then show only lines that match all the terms typed. To return to the full output, "widen" with `>`.
1223
1256
 
1224
1257
 
1225
- <a id="orgb329bbd"></a>
1258
+ <a id="org567c0c0"></a>
1226
1259
 
1227
1260
  ### Searching Output
1228
1261
 
@@ -1231,21 +1264,21 @@ While paging, you can initiate a search of the output as indicated in the above
1231
1264
  After a search session has ended, `fatty` returns to paging but remembers the last search term and allows navigation among them with `n` and `N`: `n` searches in the direction of the last search and `N` searches in the opposite direction. Notice that the current search term and direction are added to the paging bar after the information on your location within the output.
1232
1265
 
1233
1266
 
1234
- <a id="orgc3fcc69"></a>
1267
+ <a id="orgbf77d1b"></a>
1235
1268
 
1236
1269
  #### String and Regex Search
1237
1270
 
1238
1271
  `/` and `?` prompt for a fixed string and search forward or backward. `C-M-s` (or `C-/`) and `C-M-r` (or `C-?`) perform the corresponding regular-expression searches. Accepting the search leaves the selected match active for later navigation with `n` and `N`.
1239
1272
 
1240
1273
 
1241
- <a id="org53d4559"></a>
1274
+ <a id="orgda99c8d"></a>
1242
1275
 
1243
1276
  #### Incremental Search
1244
1277
 
1245
1278
  `C-s` and `C-r` begin forward or backward incremental search. The output moves to matching text as the search term is edited. Accepting commits the match; canceling restores the output position from before the search began.
1246
1279
 
1247
1280
 
1248
- <a id="orga0e6a57"></a>
1281
+ <a id="orgfd272b4"></a>
1249
1282
 
1250
1283
  # Configuration
1251
1284
 
@@ -1263,7 +1296,7 @@ The default user-specific configuration directory follows `XDG_CONFIG_HOME` if i
1263
1296
  In addition to the user-specific configuration, fatty will read app-specific configuration files from `~/.config/fatty/apps/<app_name>` if `Terminal` was given an `app_name` parameter. It will use a different directory of your choosing if `Terminal` was given an `app_config_dir` directory name.
1264
1297
 
1265
1298
 
1266
- <a id="org2d08557"></a>
1299
+ <a id="org8e3d563"></a>
1267
1300
 
1268
1301
  ## General Configuration `config.yml`
1269
1302
 
@@ -1286,7 +1319,7 @@ truecolor: auto
1286
1319
  ```
1287
1320
 
1288
1321
 
1289
- <a id="org0df073b"></a>
1322
+ <a id="org773e7d4"></a>
1290
1323
 
1291
1324
  ### `word_char_re`
1292
1325
 
@@ -1309,7 +1342,7 @@ word_char_re: "[[:alnum:]_.:-]"
1309
1342
  ```
1310
1343
 
1311
1344
 
1312
- <a id="org4288158"></a>
1345
+ <a id="org8229289"></a>
1313
1346
 
1314
1347
  ### `esc_delay`
1315
1348
 
@@ -1320,26 +1353,26 @@ esc_delay: 0
1320
1353
  ```
1321
1354
 
1322
1355
 
1323
- <a id="org973b5fe"></a>
1356
+ <a id="org5789fd5"></a>
1324
1357
 
1325
1358
  ### `history`
1326
1359
 
1327
1360
 
1328
- <a id="orga1dcc95"></a>
1361
+ <a id="org1959b2c"></a>
1329
1362
 
1330
1363
  #### `file`
1331
1364
 
1332
1365
  The path to the history file to use, by default `~/.fatty_history`
1333
1366
 
1334
1367
 
1335
- <a id="org5f744d4"></a>
1368
+ <a id="orgbb18fb6"></a>
1336
1369
 
1337
1370
  #### `max`
1338
1371
 
1339
1372
  The maximum number of lines of history retained, by default 10,000.
1340
1373
 
1341
1374
 
1342
- <a id="org64941b1"></a>
1375
+ <a id="org8a3ecd9"></a>
1343
1376
 
1344
1377
  ### `theme`
1345
1378
 
@@ -1350,7 +1383,7 @@ theme: nordic
1350
1383
  ```
1351
1384
 
1352
1385
 
1353
- <a id="orge751b35"></a>
1386
+ <a id="org9ba735f"></a>
1354
1387
 
1355
1388
  ### `truecolor`
1356
1389
 
@@ -1361,7 +1394,7 @@ truecolor: auto
1361
1394
  ```
1362
1395
 
1363
1396
 
1364
- <a id="orgd56b3fd"></a>
1397
+ <a id="org13b974b"></a>
1365
1398
 
1366
1399
  ### `log`
1367
1400
 
@@ -1383,14 +1416,14 @@ tags:
1383
1416
  ```
1384
1417
 
1385
1418
 
1386
- <a id="org60dc0ba"></a>
1419
+ <a id="orgb93c9b8"></a>
1387
1420
 
1388
1421
  #### `file`
1389
1422
 
1390
1423
  The path to the log file to use.
1391
1424
 
1392
1425
 
1393
- <a id="orgeb194d3"></a>
1426
+ <a id="org0fb9a08"></a>
1394
1427
 
1395
1428
  #### `level`
1396
1429
 
@@ -1402,7 +1435,7 @@ Can be one of the following
1402
1435
  - **`debug`:** detailed messages to assist debugging `fatty` plus all of the above.
1403
1436
 
1404
1437
 
1405
- <a id="org823d99d"></a>
1438
+ <a id="org2247ba8"></a>
1406
1439
 
1407
1440
  #### `tags`
1408
1441
 
@@ -1420,7 +1453,7 @@ tags:
1420
1453
  ```
1421
1454
 
1422
1455
 
1423
- <a id="orge3d84e5"></a>
1456
+ <a id="org11c2491"></a>
1424
1457
 
1425
1458
  ## Key code definitions `keydefs.yml`
1426
1459
 
@@ -1558,7 +1591,7 @@ konsole:
1558
1591
  After installing that keydefs, I find that the PageDown variants are all recognized by name and modifiers (except for the strange failure of `terminator` to recognize `C-PageDown`!).
1559
1592
 
1560
1593
 
1561
- <a id="org2a9d985"></a>
1594
+ <a id="orgab7252d"></a>
1562
1595
 
1563
1596
  ## Key bindings `keybindings.yml`
1564
1597
 
@@ -1585,7 +1618,7 @@ A keybinding names a key chord, the context in which it applies, and the Fatty a
1585
1618
  ```
1586
1619
 
1587
1620
 
1588
- <a id="org47f10de"></a>
1621
+ <a id="org370c8e8"></a>
1589
1622
 
1590
1623
  ### Key Names
1591
1624
 
@@ -1599,7 +1632,7 @@ A keybinding uses the unmodified key name under the `key` field:
1599
1632
  ```
1600
1633
 
1601
1634
 
1602
- <a id="orge517d82"></a>
1635
+ <a id="org3a580c2"></a>
1603
1636
 
1604
1637
  #### Printable Keys
1605
1638
 
@@ -1615,7 +1648,7 @@ Most printable keys can be written as the character itself. Quote keys that YAML
1615
1648
  ```
1616
1649
 
1617
1650
 
1618
- <a id="org515f394"></a>
1651
+ <a id="org1e9bcad"></a>
1619
1652
 
1620
1653
  #### Curses and Fatty Named Keys
1621
1654
 
@@ -1640,7 +1673,7 @@ Some terminals can report application-keypad sequences such as `keypad_divide`,
1640
1673
  - `space`
1641
1674
 
1642
1675
 
1643
- <a id="org3fa3e38"></a>
1676
+ <a id="orgec1f50a"></a>
1644
1677
 
1645
1678
  #### Possibly Invisible Keys
1646
1679
 
@@ -1649,7 +1682,7 @@ Some physical keys may never reach Fatty at all. They may be handled by the keyb
1649
1682
  Use `keytest` to check. If Fatty sees a key as a raw numeric code, you can name it in `keydefs.yml` and bind it. If `keytest` shows nothing, the key is being intercepted before Fatty receives it.
1650
1683
 
1651
1684
 
1652
- <a id="org96ea9b2"></a>
1685
+ <a id="org56d8cd7"></a>
1653
1686
 
1654
1687
  #### Unnamed but Recognized Keys
1655
1688
 
@@ -1674,7 +1707,7 @@ Then bind it in `keybindings.yml`:
1674
1707
  Fatty does not require custom key names to come from a fixed registry. A custom name only needs to be used consistently between `keydefs.yml` and `keybindings.yml`.
1675
1708
 
1676
1709
 
1677
- <a id="org8888baf"></a>
1710
+ <a id="org0eda788"></a>
1678
1711
 
1679
1712
  ### Mouse Events
1680
1713
 
@@ -1709,7 +1742,7 @@ scroll_down
1709
1742
  ```
1710
1743
 
1711
1744
 
1712
- <a id="org2ce52a8"></a>
1745
+ <a id="orgbffc2cf"></a>
1713
1746
 
1714
1747
  ### Modifiers
1715
1748
 
@@ -1722,7 +1755,7 @@ shift: true
1722
1755
  ```
1723
1756
 
1724
1757
 
1725
- <a id="orgc4d7ddc"></a>
1758
+ <a id="org0662dd0"></a>
1726
1759
 
1727
1760
  ### Contexts
1728
1761
 
@@ -1756,7 +1789,7 @@ The available contexts are:
1756
1789
  The \`:terminal\` context is the lowest-priority fallback context for terminal-wide commands. It is where Fatty puts bindings that are not specific to text editing, paging, search, or popup selection, such as theme selection, key testing, and quitting. Because \`:terminal\` is searched last, any more specific context can override a terminal-wide binding.
1757
1790
 
1758
1791
 
1759
- <a id="orgd327240"></a>
1792
+ <a id="org55e8a55"></a>
1760
1793
 
1761
1794
  ### Actions
1762
1795
 
@@ -1784,7 +1817,7 @@ Most movement, deletion, history, completion, paging, and popup-navigation actio
1784
1817
  Use \`keytest\` to check what action is currently bound to a key. If a key is bound, \`keytest\` reports the matching context, action name, arguments, and the object that handles the action.
1785
1818
 
1786
1819
 
1787
- <a id="org0a51d38"></a>
1820
+ <a id="org5c651ab"></a>
1788
1821
 
1789
1822
  #### Input buffer actions
1790
1823
 
@@ -1827,7 +1860,7 @@ Terminology notes:
1827
1860
  | yank\_pop | Yes | Copy next kill ring item and replace prior |
1828
1861
 
1829
1862
 
1830
- <a id="org0156270"></a>
1863
+ <a id="orga37809c"></a>
1831
1864
 
1832
1865
  #### Input field actions
1833
1866
 
@@ -1840,7 +1873,7 @@ Input field actions operate on an editable input field. An input field occurs at
1840
1873
  | history\_next | No | Insert the next relevant history item in the input field |
1841
1874
 
1842
1875
 
1843
- <a id="org49f5b2c"></a>
1876
+ <a id="org5bd909b"></a>
1844
1877
 
1845
1878
  #### Shell session actions
1846
1879
 
@@ -1861,7 +1894,7 @@ Shell session actions operate at the session level around the main command input
1861
1894
  | universal\_argument | No | Set the numeric argument to 4 or multiply the current one by 4 |
1862
1895
 
1863
1896
 
1864
- <a id="org51e582e"></a>
1897
+ <a id="orgcba2897"></a>
1865
1898
 
1866
1899
  #### Pager actions
1867
1900
 
@@ -1883,7 +1916,7 @@ Pager actions navigate output when the output area is in paging mode. They move
1883
1916
  | quit\_paging | No | Quit paging and return control to the input line |
1884
1917
 
1885
1918
 
1886
- <a id="org9c6e828"></a>
1919
+ <a id="org2e0b296"></a>
1887
1920
 
1888
1921
  #### Pager search actions
1889
1922
 
@@ -1912,7 +1945,7 @@ While the search session is active, accepting commits the current match and canc
1912
1945
  | isearch\_cancel | No | Cancel the active incremental search and restore its starting point |
1913
1946
 
1914
1947
 
1915
- <a id="orgf26b607"></a>
1948
+ <a id="org76791bc"></a>
1916
1949
 
1917
1950
  #### Popup actions
1918
1951
 
@@ -1932,7 +1965,7 @@ Popup actions control selection and narrowing popups such as choose, menu, compl
1932
1965
  | popup\_toggle\_selected | No | In multi-select, toggle the selection of the current item |
1933
1966
 
1934
1967
 
1935
- <a id="org5abe8ab"></a>
1968
+ <a id="org6b1188d"></a>
1936
1969
 
1937
1970
  #### Prompt popup actions
1938
1971
 
@@ -1945,7 +1978,7 @@ Prompt popup actions control prompt dialogs that collect a string from the user.
1945
1978
  | prompt\_cancel\_if\_empty | No | Cancel only if the input buffer is empty |
1946
1979
 
1947
1980
 
1948
- <a id="orgb190c08"></a>
1981
+ <a id="orgf63740e"></a>
1949
1982
 
1950
1983
  #### Utility Actions
1951
1984
 
@@ -1960,12 +1993,12 @@ Some actions exist to support `Fatty`'s own input machinery and are not normally
1960
1993
  | paste | str | No | Insert pasted text at point |
1961
1994
 
1962
1995
 
1963
- <a id="org19a3e32"></a>
1996
+ <a id="org3856a84"></a>
1964
1997
 
1965
1998
  ## Themes `themes/`
1966
1999
 
1967
2000
 
1968
- <a id="orge0db426"></a>
2001
+ <a id="org88b0217"></a>
1969
2002
 
1970
2003
  ### Distributed Themes
1971
2004
 
@@ -2001,12 +2034,12 @@ Here are the builtin themes:
2001
2034
  | wordperfect | Nostalgic nod to the good old word processor |
2002
2035
 
2003
2036
 
2004
- <a id="org23d543d"></a>
2037
+ <a id="org8769885"></a>
2005
2038
 
2006
2039
  ### Custom Themes
2007
2040
 
2008
2041
 
2009
- <a id="orgc7d4f2a"></a>
2042
+ <a id="orgd425d6c"></a>
2010
2043
 
2011
2044
  #### Theme Name
2012
2045
 
@@ -2017,7 +2050,7 @@ name: nordic
2017
2050
  ```
2018
2051
 
2019
2052
 
2020
- <a id="org7186f3f"></a>
2053
+ <a id="org1e1695f"></a>
2021
2054
 
2022
2055
  #### Inheritance from Another Theme
2023
2056
 
@@ -2034,7 +2067,7 @@ fg: "#eeeeee"
2034
2067
  This means that all the theme setting from the `nordic` theme apply except to the extent changed by the rest of the `my_nordic` theme file.
2035
2068
 
2036
2069
 
2037
- <a id="org85b6b26"></a>
2070
+ <a id="org8557acf"></a>
2038
2071
 
2039
2072
  #### Inheritance within a Theme
2040
2073
 
@@ -2054,7 +2087,7 @@ output:
2054
2087
  This means that the input field will have the same coloring and attributes as the output pane.
2055
2088
 
2056
2089
 
2057
- <a id="org6741eee"></a>
2090
+ <a id="org76e4687"></a>
2058
2091
 
2059
2092
  #### Theme Roles
2060
2093
 
@@ -2101,7 +2134,7 @@ Here is a listing of what roles act as the parent for each of the roles, their p
2101
2134
  | `markdown_hrule` | Markdown horizontal rules. | `output` |
2102
2135
 
2103
2136
 
2104
- <a id="org33b14c5"></a>
2137
+ <a id="orge738a22"></a>
2105
2138
 
2106
2139
  #### Role Colors and Attributes and Frame Style
2107
2140
 
@@ -2222,3 +2255,75 @@ Each role can have assigned to it a foreground color (`fg:`), a background color
2222
2255
  bg: navy
2223
2256
  attrs: [underline]
2224
2257
  ```
2258
+
2259
+
2260
+ <a id="orgdd1744c"></a>
2261
+
2262
+ ### The `themer` helper
2263
+
2264
+ Choosing readable colors for the semantic roles---`good`, `info`, `warn`, and `error`&#x2014;is not trivial. The `themer` utility can suggest suitable foreground colors based on a theme's output background.
2265
+
2266
+ For an existing theme, `themer` also reports the contrast of the current role colors and flags those that fall below its target contrast.
2267
+
2268
+ Pass it either the name of an existing theme:
2269
+
2270
+ ```sh
2271
+ themer nordic
2272
+ ```
2273
+
2274
+ ```
2275
+ Theme: nordic
2276
+ Output background: #2e3440
2277
+
2278
+ Current semantic roles:
2279
+
2280
+ good #22ee00 contrast 7.91 OK
2281
+ info #33deff contrast 7.75 OK
2282
+ warn #d78700 contrast 4.37 LOW
2283
+ error #d700af contrast 2.68 LOW
2284
+
2285
+ Suggested semantic roles:
2286
+
2287
+ good #28bd41 contrast 5.02
2288
+ info #74abe2 contrast 5.15
2289
+ warn #caa22b contrast 5.18
2290
+ error #e78d8d contrast 5.11
2291
+ ```
2292
+
2293
+ or a hexadecimal background color when developing a new theme:
2294
+
2295
+ ```sh
2296
+ themer '#2e3440'
2297
+ ```
2298
+
2299
+ ```
2300
+ Background: #2e3440
2301
+ Output background: #2e3440
2302
+
2303
+ Suggested semantic roles:
2304
+
2305
+ good #28bd41 contrast 5.02
2306
+ info #74abe2 contrast 5.15
2307
+ warn #caa22b contrast 5.18
2308
+ error #e78d8d contrast 5.11
2309
+ ```
2310
+
2311
+ You can get the suggestions in YAML form by giving the `--yaml` flag:
2312
+
2313
+ ```sh
2314
+ themer --yaml '#2e3440'
2315
+ ```
2316
+
2317
+ ```
2318
+ good:
2319
+ fg: "#28bd41"
2320
+
2321
+ info:
2322
+ fg: "#74abe2"
2323
+
2324
+ warn:
2325
+ fg: "#caa22b"
2326
+
2327
+ error:
2328
+ fg: "#e78d8d"
2329
+ ```