fatty 0.99.4 → 0.99.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ba7cbd31b6e1928863864a70182cd399e93382b779f48d1f8c7216ba4b39e1b
4
- data.tar.gz: 33539e70de07caec28311895153471e83477f584656f89b2643636e0dbee33fc
3
+ metadata.gz: 5c04d9a22967dd59227f4dc9ff1b24b371ae5ba9e3af136aabc498df396e0eea
4
+ data.tar.gz: 974bc4254cfa374f70db3eab26f2313b76b179dd23eb41d6a21181c73a8b2db9
5
5
  SHA512:
6
- metadata.gz: f3832c280838386b3e7a0ecccd6c527c1ec33edc1deaf8ec8e866f24963787e00e3dd6a2ba5083614da17e4875075d5b12fbfccc0dfad6f7efbf0759ab67fbf6
7
- data.tar.gz: b540ef445b1c318f389adf4e72efdb3d95f4a0410531a74863812a122dcb79b6f02dbe63890ec4d6902ee96b5678055db84a20b4878ae4145d1d1aa6c4f4c9c0
6
+ metadata.gz: 1c206b4e440e4f3b5dae77d58053068c0b4580e0a19d4b1c3ed9b1a1f006808969faf5368bc8551cb74ee2caa1f507be6becc9f9b50e8f113ac924afcd130dd4
7
+ data.tar.gz: 1811e1caaa29280fa1c782f74253146fee5ec63d4dbe51c6e8c98ee809d0c27c96056846b6a739eb4174253993841064049a442092e02225b4cb313a49fb9c9d
data/README.md CHANGED
@@ -1,111 +1,111 @@
1
- - [Introduction](#org92a02ab)
2
- - [Quick Start](#orga9758e6)
3
- - [Installing](#org5d48af2)
4
- - [Trying it Out with the \`fatty\` Demo](#orga0811d0)
5
- - [Builtin commands](#org10b740e)
6
- - [Screenshots](#orga21015c)
7
- - [Command line editing](#orge811242)
8
- - [Searchable Output](#org86db3fd)
9
- - [Paging Markdown](#org465e882)
10
- - [Popup Selection](#orged601b1)
11
- - [Usage](#org0fbc008)
12
- - [Launching a Fatty Terminal](#orgdd7a899)
13
- - [`on_accept`](#orge36ae8e)
14
- - [Parameters to `on_accept`](#org74e77b2)
15
- - [The `line` parameter to `on_accept`](#org21b8961)
16
- - [The callback parameter to `on_accept`](#org3091db0)
17
- - [Output ordering](#orgcd415d8)
18
- - [Long-running callbacks and interruption](#org0d9a504)
19
- - [ANSI colors in output](#org89ae995)
20
- - [Other parameters to `Terminal.new`](#orgce83cdf)
21
- - [The Callback API](#orgef3914d)
22
- - [`append(text, follow: true)`](#org1f2fcbb)
23
- - [`append_now(text, follow: true, mode: nil)`](#org3318ee2)
24
- - [`markdown(text)`](#org3da5738)
25
- - [`status(text, role: :info)`](#org5e0ab5d)
26
- - [`good(text, replace: false, render: true)`](#orgd2a8b1b)
27
- - [`info(text, replace: false, render: true)`](#org8ec7886)
28
- - [`warn(text, replace: false, render: true)`](#org6bb2e02)
29
- - [`error(text, replace: false, render: true)`](#org6040c43)
30
- - [`oops(text, replace: false, render: true)`](#org3e60ade)
31
- - [`alert(text, role: :info)`](#org5e74284)
32
- - [`prompt(prompt, initial: "", cancel_value: nil, history_key: nil, save_history: true)`](#org71a56a2)
33
- - [`check_interrupt!`](#orgd0da92b)
34
- - [`add_progress(label:, total: nil, style: :percent, role: :info, width: 40)`](#orgfbc8aa5)
35
- - [Initialization `add_progress(label:, style: :percent, total: nil, role: :info, width: 40)`](#orgd758f7b)
36
- - [Update `update(current: nil, indicator: nil, render: false)`](#orgbe50f7a)
37
- - [Finish](#org058be1b)
38
- - [Clear](#org22e4b8d)
39
- - [`choose(prompt, choices:, initial_choice_idx: 0, cancel_value: nil)`](#orgcfb56dd)
40
- - [`choose_multi(prompt, choices:, cancel_value: nil)`](#org5b1d7d1)
41
- - [`confirm(prompt, yes_label: "Yes", no_label: "No", cancel_value: false)`](#org9b37a8e)
42
- - [`menu(prompt, choices:, initial_choice_idx: 0, cancel_value: nil)`](#org8d63dae)
43
- - [`environment`](#org1750b9e)
44
- - [Default Interaction](#org727ceaf)
45
- - [Parts of the Screen](#orgd560bdc)
46
- - [Input Field](#org6ae09c7)
47
- - [Output Pane](#org73b9106)
48
- - [Status Area](#orga48a015)
49
- - [Alert Area](#org5098d11)
50
- - [Command-line Editing](#org2926c89)
51
- - [Input Context](#orgbcdaaad)
52
- - [Cursor Motion](#org1af96be)
53
- - [Clearing](#org32a2afa)
54
- - [Undo and Redo](#org72cce5e)
55
- - [Deletion and Killing](#org5ac8fea)
56
- - [Yanking, Mark, and Region](#org948d8d5)
57
- - [Count Prefix](#orgb998032)
58
- - [History Navigation](#org30cf355)
59
- - [Completion](#org0c995ec)
60
- - [Accept or Cancel](#orgf4edfcc)
61
- - [Paging Context](#org8d58d09)
62
- - [Searching Output](#org89f3027)
63
- - [String and Regex Search](#org77137d8)
64
- - [Incremental Search](#orgd90c796)
65
- - [Configuration](#orgc8458e1)
66
- - [General Configuration `config.yml`](#org0add8c9)
67
- - [`word_char_re`](#org1099eb8)
68
- - [`esc_delay`](#orgce3e466)
69
- - [`history`](#org95b5e48)
70
- - [`file`](#orgdc30f58)
71
- - [`max`](#org0941468)
72
- - [`theme`](#orgce1b37d)
73
- - [`truecolor`](#orgdd529bd)
74
- - [`log`](#org2b58449)
75
- - [`file`](#org0e3b938)
76
- - [`level`](#org9c70445)
77
- - [`tags`](#orge47f304)
78
- - [Key code definitions `keydefs.yml`](#org220de42)
79
- - [Key bindings `keybindings.yml`](#orgbd79429)
80
- - [Key Names](#org698f2a9)
81
- - [Printable Keys](#org58581e4)
82
- - [Curses and Fatty Named Keys](#org4b0cf5b)
83
- - [Possibly Invisible Keys](#orgeab9ebe)
84
- - [Unnamed but Recognized Keys](#orgde02d1d)
85
- - [Mouse Events](#orge487bc7)
86
- - [Modifiers](#orgcf36a39)
87
- - [Contexts](#orgc29aad9)
88
- - [Actions](#orgdb5aa78)
89
- - [Input buffer actions](#orgf51a408)
90
- - [Input field actions](#org3f876b8)
91
- - [Shell session actions](#orge0c4e6e)
92
- - [Pager actions](#org05813c6)
93
- - [Pager search actions](#orgea58518)
94
- - [Popup actions](#org6ea9ecc)
95
- - [Prompt popup actions](#org8f3d6dc)
96
- - [Utility Actions](#org4a9e2d4)
97
- - [Themes `themes/`](#org7e9ed87)
98
- - [Distributed Themes](#orgf951ab7)
99
- - [Custom Themes](#orgcf6fbb1)
100
- - [Theme Name](#orgb8ead89)
101
- - [Inheritance from Another Theme](#orgc49dfe9)
102
- - [Inheritance within a Theme](#org371d3bb)
103
- - [Theme Roles](#org83d0479)
104
- - [Role Colors and Attributes and Frame Style](#orgabf70f2)
105
-
106
-
107
-
108
- <a id="org92a02ab"></a>
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>
109
109
 
110
110
  # Introduction
111
111
 
@@ -133,12 +133,12 @@ In other words, fatty allows you to write a terminal-based REPL of your choosing
133
133
  `Fatty` is *not* a terminal emulator but runs on top of one.
134
134
 
135
135
 
136
- <a id="orga9758e6"></a>
136
+ <a id="org6313195"></a>
137
137
 
138
138
  # Quick Start
139
139
 
140
140
 
141
- <a id="org5d48af2"></a>
141
+ <a id="org2ab7619"></a>
142
142
 
143
143
  ## Installing
144
144
 
@@ -149,7 +149,7 @@ $ gem install fatty
149
149
  ```
150
150
 
151
151
 
152
- <a id="orga0811d0"></a>
152
+ <a id="orgbb6efa2"></a>
153
153
 
154
154
  ## Trying it Out with the \`fatty\` Demo
155
155
 
@@ -158,7 +158,7 @@ Once installed, you can try out `fatty` with the included program called `fatty`
158
158
  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
159
 
160
160
 
161
- <a id="org10b740e"></a>
161
+ <a id="org6a3da85"></a>
162
162
 
163
163
  ### Builtin commands
164
164
 
@@ -192,12 +192,12 @@ Here are the commands builtin to `fatty`
192
192
  | colors | Display ANSI, 256-color, and X11 color diagnostics |
193
193
 
194
194
 
195
- <a id="orga21015c"></a>
195
+ <a id="org03c4f60"></a>
196
196
 
197
197
  ### Screenshots
198
198
 
199
199
 
200
- <a id="orge811242"></a>
200
+ <a id="org7f8b501"></a>
201
201
 
202
202
  #### Command line editing
203
203
 
@@ -206,7 +206,7 @@ Here is the command line, mid-edit showing a region selected and, in dim text to
206
206
  ![img](images/input_editing.png "Input editing showing region and predictive completion.")
207
207
 
208
208
 
209
- <a id="org86db3fd"></a>
209
+ <a id="orge6a2a61"></a>
210
210
 
211
211
  #### Searchable Output
212
212
 
@@ -215,7 +215,7 @@ While paging output, you can search for words, as here the user searches for the
215
215
  ![img](images/search_output.png "Searching for instances of `tty` in the output.")
216
216
 
217
217
 
218
- <a id="org465e882"></a>
218
+ <a id="org98556a8"></a>
219
219
 
220
220
  #### Paging Markdown
221
221
 
@@ -224,7 +224,7 @@ The `fatty` demo running the `markdown` command and paging the output. It shows
224
224
  ![img](images/page_markdown.png "Running the `fatty` demo `markdown` command.")
225
225
 
226
226
 
227
- <a id="orged601b1"></a>
227
+ <a id="org87e5076"></a>
228
228
 
229
229
  #### Popup Selection
230
230
 
@@ -233,17 +233,17 @@ One of the many "widgets" available through `fatty` is the ability to present th
233
233
  ![img](images/choose_popup.png "Running the `fatty` demo `choose` command.")
234
234
 
235
235
 
236
- <a id="org0fbc008"></a>
236
+ <a id="org12e2b74"></a>
237
237
 
238
238
  # Usage
239
239
 
240
240
 
241
- <a id="orgdd7a899"></a>
241
+ <a id="org0be8165"></a>
242
242
 
243
243
  ## Launching a Fatty Terminal
244
244
 
245
245
 
246
- <a id="orge36ae8e"></a>
246
+ <a id="orgf42a055"></a>
247
247
 
248
248
  ### `on_accept`
249
249
 
@@ -276,14 +276,14 @@ When a `fatty` application runs, `fatty` installs a few files if they do not exi
276
276
  - `themes`, a directory of pre-defined theme definitions that you can choose from and add to by adding your own themes.
277
277
 
278
278
 
279
- <a id="org74e77b2"></a>
279
+ <a id="orga5d3390"></a>
280
280
 
281
281
  #### Parameters to `on_accept`
282
282
 
283
283
  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
284
 
285
285
 
286
- <a id="org21b8961"></a>
286
+ <a id="org18111d5"></a>
287
287
 
288
288
  #### The `line` parameter to `on_accept`
289
289
 
@@ -324,7 +324,7 @@ Fatty::Terminal.new(
324
324
  ```
325
325
 
326
326
 
327
- <a id="org3091db0"></a>
327
+ <a id="org246af2b"></a>
328
328
 
329
329
  #### The callback parameter to `on_accept`
330
330
 
@@ -349,7 +349,7 @@ Fatty::Terminal.new(
349
349
  The callback parameter responds to several methods that allow your application to interact with the user. They are documented below.
350
350
 
351
351
 
352
- <a id="orgcd415d8"></a>
352
+ <a id="org210dcba"></a>
353
353
 
354
354
  #### Output ordering
355
355
 
@@ -374,7 +374,7 @@ Calls to `append_now` are different. They append text and immediately render a f
374
374
  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
375
 
376
376
 
377
- <a id="org0d9a504"></a>
377
+ <a id="org5093875"></a>
378
378
 
379
379
  #### Long-running callbacks and interruption
380
380
 
@@ -413,14 +413,14 @@ end
413
413
  ```
414
414
 
415
415
 
416
- <a id="org89ae995"></a>
416
+ <a id="orgcf17f3b"></a>
417
417
 
418
418
  #### ANSI colors in output
419
419
 
420
420
  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
421
 
422
422
 
423
- <a id="orgce83cdf"></a>
423
+ <a id="org825992c"></a>
424
424
 
425
425
  ### Other parameters to `Terminal.new`
426
426
 
@@ -447,30 +447,34 @@ Fatty::Terminal.new(
447
447
  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
448
 
449
449
 
450
- <a id="orgef3914d"></a>
450
+ <a id="org7874847"></a>
451
451
 
452
452
  ## The Callback API
453
453
 
454
454
  Here are the details on the messages that you can send to the callback parameter to the `on_accept` proc.
455
455
 
456
456
 
457
- <a id="org1f2fcbb"></a>
457
+ <a id="org3a8e5be"></a>
458
458
 
459
- ### `append(text, follow: true)`
459
+ ### `append(text, follow: true, role: nil)`
460
460
 
461
461
  Add the given text to the output pane. After a full page of output is produced, enter paging mode so the user can view the output at leisure and search the output. If `follow` is true, keep the output pane's viewport covering the last lines of output.
462
462
 
463
+ 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.
463
464
 
464
- <a id="org3318ee2"></a>
465
465
 
466
- ### `append_now(text, follow: true, mode: nil)`
466
+ <a id="orga261846"></a>
467
+
468
+ ### `append_now(text, follow: true, mode: nil, role: nil)`
467
469
 
468
470
  Like `append`, but display output as it is produced rather than wait for a full page to be produced.
469
471
 
470
472
  Setting the mode to `:scrolling` or `:paging` determines whether the output is scrolled continuously or paused on each page of output.
471
473
 
474
+ 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
+
472
476
 
473
- <a id="org3da5738"></a>
477
+ <a id="org2c6117a"></a>
474
478
 
475
479
  ### `markdown(text)`
476
480
 
@@ -490,7 +494,7 @@ and this should appear on the next line.
490
494
  ```
491
495
 
492
496
 
493
- <a id="org5e0ab5d"></a>
497
+ <a id="org80d267c"></a>
494
498
 
495
499
  ### `status(text, role: :info)`
496
500
 
@@ -502,49 +506,49 @@ Display the text in the "status" area, the lines immediately above the input fie
502
506
  - **:error:** colored something to suggest danger, usually some tone of red.
503
507
 
504
508
 
505
- <a id="orgd2a8b1b"></a>
509
+ <a id="orgb6de417"></a>
506
510
 
507
511
  ### `good(text, replace: false, render: true)`
508
512
 
509
513
  Display the text in the status area with the role :good.
510
514
 
511
515
 
512
- <a id="org8ec7886"></a>
516
+ <a id="org63d40a7"></a>
513
517
 
514
518
  ### `info(text, replace: false, render: true)`
515
519
 
516
520
  Display the text in the status area with the role :info.
517
521
 
518
522
 
519
- <a id="org6bb2e02"></a>
523
+ <a id="org1e44b90"></a>
520
524
 
521
525
  ### `warn(text, replace: false, render: true)`
522
526
 
523
527
  Display the text in the status area with the role :warn.
524
528
 
525
529
 
526
- <a id="org6040c43"></a>
530
+ <a id="orga6187bb"></a>
527
531
 
528
532
  ### `error(text, replace: false, render: true)`
529
533
 
530
534
  Display the text in the status area with the role :error.
531
535
 
532
536
 
533
- <a id="org3e60ade"></a>
537
+ <a id="orga75943f"></a>
534
538
 
535
539
  ### `oops(text, replace: false, render: true)`
536
540
 
537
541
  An alias for `error(text)`
538
542
 
539
543
 
540
- <a id="org5e74284"></a>
544
+ <a id="orgc92ba6a"></a>
541
545
 
542
546
  ### `alert(text, role: :info)`
543
547
 
544
548
  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.
545
549
 
546
550
 
547
- <a id="org71a56a2"></a>
551
+ <a id="orgfc95c42"></a>
548
552
 
549
553
  ### `prompt(prompt, initial: "", cancel_value: nil, history_key: nil, save_history: true)`
550
554
 
@@ -574,7 +578,7 @@ The `prompt` input has its own history facility separate from the history in the
574
578
  `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`.
575
579
 
576
580
 
577
- <a id="orgd0da92b"></a>
581
+ <a id="orgc6a9c07"></a>
578
582
 
579
583
  ### `check_interrupt!`
580
584
 
@@ -585,7 +589,7 @@ The polling is throttled, so `check_interrupt!` may be called frequently. It sho
585
589
  Fatty catches `Fatty::Interrupt` at the callback boundary, finishes the current command, restores the terminal state, and resumes the normal input loop.
586
590
 
587
591
 
588
- <a id="orgfbc8aa5"></a>
592
+ <a id="org68c4685"></a>
589
593
 
590
594
  ### `add_progress(label:, total: nil, style: :percent, role: :info, width: 40)`
591
595
 
@@ -601,7 +605,7 @@ Display a progress widget in the status area to show the user that the system is
601
605
  - **:trail:** display an "indicator" on each call of `update(indicator: <string>)`
602
606
 
603
607
 
604
- <a id="orgd758f7b"></a>
608
+ <a id="orgaf54268"></a>
605
609
 
606
610
  #### Initialization `add_progress(label:, style: :percent, total: nil, role: :info, width: 40)`
607
611
 
@@ -612,7 +616,7 @@ Display a progress widget in the status area to show the user that the system is
612
616
  - **`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.
613
617
 
614
618
 
615
- <a id="orgbe50f7a"></a>
619
+ <a id="org63766b4"></a>
616
620
 
617
621
  #### Update `update(current: nil, indicator: nil, render: false)`
618
622
 
@@ -718,21 +722,21 @@ Fatty::Terminal.new(
718
722
  ```
719
723
 
720
724
 
721
- <a id="org058be1b"></a>
725
+ <a id="org489dabd"></a>
722
726
 
723
727
  #### Finish
724
728
 
725
729
  As the prior examples illustrate, you can issue an ending message at the end of the process by calling `#finish` on the Progress object.
726
730
 
727
731
 
728
- <a id="org22e4b8d"></a>
732
+ <a id="org499367c"></a>
729
733
 
730
734
  #### Clear
731
735
 
732
736
  And, if you have occasion, you can clear the Progress by calling `#clear` on the Progress object.
733
737
 
734
738
 
735
- <a id="orgcfb56dd"></a>
739
+ <a id="org88dd294"></a>
736
740
 
737
741
  ### `choose(prompt, choices:, initial_choice_idx: 0, cancel_value: nil)`
738
742
 
@@ -798,7 +802,7 @@ Fatty::Terminal.new(
798
802
  ```
799
803
 
800
804
 
801
- <a id="org5b1d7d1"></a>
805
+ <a id="org7cfc6fb"></a>
802
806
 
803
807
  ### `choose_multi(prompt, choices:, cancel_value: nil)`
804
808
 
@@ -816,7 +820,7 @@ Present a set of `choices:`, which can either be
816
820
  The `prompt` String (by default "Choose Many") can guide the user about the purpose of the choices.
817
821
 
818
822
 
819
- <a id="org9b37a8e"></a>
823
+ <a id="org24552a8"></a>
820
824
 
821
825
  ### `confirm(prompt, yes_label: "Yes", no_label: "No", cancel_value: false)`
822
826
 
@@ -827,7 +831,7 @@ Present the user with a simple Yes/No choice using your choice of ways to expres
827
831
  `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.
828
832
 
829
833
 
830
- <a id="org8d63dae"></a>
834
+ <a id="orgc7a266a"></a>
831
835
 
832
836
  ### `menu(prompt, choices:, initial_choice_idx: 0, cancel_value: nil)`
833
837
 
@@ -874,7 +878,7 @@ If you want to set one of the choices as the initial choice, set `initial_choice
874
878
  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.
875
879
 
876
880
 
877
- <a id="org1750b9e"></a>
881
+ <a id="org04ee12a"></a>
878
882
 
879
883
  ### `environment`
880
884
 
@@ -911,59 +915,59 @@ The environment report also includes a nested `:curses` hash:
911
915
  | `:can_change_color` | Whether curses can redefine color values |
912
916
 
913
917
 
914
- <a id="org727ceaf"></a>
918
+ <a id="orgacd5f7c"></a>
915
919
 
916
920
  # Default Interaction
917
921
 
918
922
 
919
- <a id="orgd560bdc"></a>
923
+ <a id="org11ef010"></a>
920
924
 
921
925
  ## Parts of the Screen
922
926
 
923
927
 
924
- <a id="org6ae09c7"></a>
928
+ <a id="org98aa3ba"></a>
925
929
 
926
930
  ### Input Field
927
931
 
928
932
  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.
929
933
 
930
934
 
931
- <a id="org73b9106"></a>
935
+ <a id="orge520676"></a>
932
936
 
933
937
  ### Output Pane
934
938
 
935
939
  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.
936
940
 
937
941
 
938
- <a id="orga48a015"></a>
942
+ <a id="org2582262"></a>
939
943
 
940
944
  ### Status Area
941
945
 
942
946
  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.
943
947
 
944
948
 
945
- <a id="org5098d11"></a>
949
+ <a id="orgc32c00f"></a>
946
950
 
947
951
  ### Alert Area
948
952
 
949
953
  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.
950
954
 
951
955
 
952
- <a id="org2926c89"></a>
956
+ <a id="org4dfe709"></a>
953
957
 
954
958
  ## Command-line Editing
955
959
 
956
960
  `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.
957
961
 
958
962
 
959
- <a id="orgbcdaaad"></a>
963
+ <a id="orga183f84"></a>
960
964
 
961
965
  ### Input Context
962
966
 
963
967
  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.
964
968
 
965
969
 
966
- <a id="org1af96be"></a>
970
+ <a id="org81087f8"></a>
967
971
 
968
972
  #### Cursor Motion
969
973
 
@@ -987,7 +991,7 @@ When editing the input line or text input for widgets like the \`prompt\`, \`fat
987
991
  | C-:left | move cursor left one word |
988
992
 
989
993
 
990
- <a id="org32a2afa"></a>
994
+ <a id="org37f216d"></a>
991
995
 
992
996
  #### Clearing
993
997
 
@@ -998,7 +1002,7 @@ This is one action that does not affect the input buffer but the output pane. It
998
1002
  | C-l | clear the output pane |
999
1003
 
1000
1004
 
1001
- <a id="org72cce5e"></a>
1005
+ <a id="org3ffee42"></a>
1002
1006
 
1003
1007
  #### Undo and Redo
1004
1008
 
@@ -1012,7 +1016,7 @@ This is one action that does not affect the input buffer but the output pane. It
1012
1016
  | M-/ | redo |
1013
1017
 
1014
1018
 
1015
- <a id="org5ac8fea"></a>
1019
+ <a id="org930cee7"></a>
1016
1020
 
1017
1021
  #### Deletion and Killing
1018
1022
 
@@ -1032,7 +1036,7 @@ When the region is active, destructive editing commands kill the region rather t
1032
1036
  | M-t | transpose words |
1033
1037
 
1034
1038
 
1035
- <a id="org948d8d5"></a>
1039
+ <a id="org324c2f6"></a>
1036
1040
 
1037
1041
  #### Yanking, Mark, and Region
1038
1042
 
@@ -1060,7 +1064,7 @@ Notice that commands that normally delete characters or words, kill the region i
1060
1064
  | M-w | copy the region |
1061
1065
 
1062
1066
 
1063
- <a id="orgb998032"></a>
1067
+ <a id="orgd8ab4ab"></a>
1064
1068
 
1065
1069
  #### Count Prefix
1066
1070
 
@@ -1076,7 +1080,7 @@ Fatty follows the emacs convention of making `C-u` multiply the count prefix by
1076
1080
  | M-<digit> | accumulate a count argument |
1077
1081
 
1078
1082
 
1079
- <a id="org30cf355"></a>
1083
+ <a id="orgb63d0d0"></a>
1080
1084
 
1081
1085
  #### History Navigation
1082
1086
 
@@ -1099,7 +1103,7 @@ You can navigate history items with the `up` and `down` keys as you would expect
1099
1103
  | C-r | search the history in a popup |
1100
1104
 
1101
1105
 
1102
- <a id="org0c995ec"></a>
1106
+ <a id="org1732f5c"></a>
1103
1107
 
1104
1108
  #### Completion
1105
1109
 
@@ -1145,7 +1149,7 @@ You can navigate history items with the `up` and `down` keys as you would expect
1145
1149
  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.
1146
1150
 
1147
1151
 
1148
- <a id="orgf4edfcc"></a>
1152
+ <a id="orgf829904"></a>
1149
1153
 
1150
1154
  #### Accept or Cancel
1151
1155
 
@@ -1161,7 +1165,7 @@ You can end a `fatty` session with `C-c` at the command line, or (only if the bu
1161
1165
  | C-d | quit \`fatty\` only if the input line is empty |
1162
1166
 
1163
1167
 
1164
- <a id="org8d58d09"></a>
1168
+ <a id="orgf7f860e"></a>
1165
1169
 
1166
1170
  ### Paging Context
1167
1171
 
@@ -1218,7 +1222,7 @@ You can add line numbers to the display while paging by using the `=` key.
1218
1222
  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 `>`.
1219
1223
 
1220
1224
 
1221
- <a id="org89f3027"></a>
1225
+ <a id="orgb329bbd"></a>
1222
1226
 
1223
1227
  ### Searching Output
1224
1228
 
@@ -1227,21 +1231,21 @@ While paging, you can initiate a search of the output as indicated in the above
1227
1231
  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.
1228
1232
 
1229
1233
 
1230
- <a id="org77137d8"></a>
1234
+ <a id="orgc3fcc69"></a>
1231
1235
 
1232
1236
  #### String and Regex Search
1233
1237
 
1234
1238
  `/` 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`.
1235
1239
 
1236
1240
 
1237
- <a id="orgd90c796"></a>
1241
+ <a id="org53d4559"></a>
1238
1242
 
1239
1243
  #### Incremental Search
1240
1244
 
1241
1245
  `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.
1242
1246
 
1243
1247
 
1244
- <a id="orgc8458e1"></a>
1248
+ <a id="orga0e6a57"></a>
1245
1249
 
1246
1250
  # Configuration
1247
1251
 
@@ -1259,7 +1263,7 @@ The default user-specific configuration directory follows `XDG_CONFIG_HOME` if i
1259
1263
  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.
1260
1264
 
1261
1265
 
1262
- <a id="org0add8c9"></a>
1266
+ <a id="org2d08557"></a>
1263
1267
 
1264
1268
  ## General Configuration `config.yml`
1265
1269
 
@@ -1282,7 +1286,7 @@ truecolor: auto
1282
1286
  ```
1283
1287
 
1284
1288
 
1285
- <a id="org1099eb8"></a>
1289
+ <a id="org0df073b"></a>
1286
1290
 
1287
1291
  ### `word_char_re`
1288
1292
 
@@ -1305,7 +1309,7 @@ word_char_re: "[[:alnum:]_.:-]"
1305
1309
  ```
1306
1310
 
1307
1311
 
1308
- <a id="orgce3e466"></a>
1312
+ <a id="org4288158"></a>
1309
1313
 
1310
1314
  ### `esc_delay`
1311
1315
 
@@ -1316,26 +1320,26 @@ esc_delay: 0
1316
1320
  ```
1317
1321
 
1318
1322
 
1319
- <a id="org95b5e48"></a>
1323
+ <a id="org973b5fe"></a>
1320
1324
 
1321
1325
  ### `history`
1322
1326
 
1323
1327
 
1324
- <a id="orgdc30f58"></a>
1328
+ <a id="orga1dcc95"></a>
1325
1329
 
1326
1330
  #### `file`
1327
1331
 
1328
1332
  The path to the history file to use, by default `~/.fatty_history`
1329
1333
 
1330
1334
 
1331
- <a id="org0941468"></a>
1335
+ <a id="org5f744d4"></a>
1332
1336
 
1333
1337
  #### `max`
1334
1338
 
1335
1339
  The maximum number of lines of history retained, by default 10,000.
1336
1340
 
1337
1341
 
1338
- <a id="orgce1b37d"></a>
1342
+ <a id="org64941b1"></a>
1339
1343
 
1340
1344
  ### `theme`
1341
1345
 
@@ -1346,7 +1350,7 @@ theme: nordic
1346
1350
  ```
1347
1351
 
1348
1352
 
1349
- <a id="orgdd529bd"></a>
1353
+ <a id="orge751b35"></a>
1350
1354
 
1351
1355
  ### `truecolor`
1352
1356
 
@@ -1357,7 +1361,7 @@ truecolor: auto
1357
1361
  ```
1358
1362
 
1359
1363
 
1360
- <a id="org2b58449"></a>
1364
+ <a id="orgd56b3fd"></a>
1361
1365
 
1362
1366
  ### `log`
1363
1367
 
@@ -1379,14 +1383,14 @@ tags:
1379
1383
  ```
1380
1384
 
1381
1385
 
1382
- <a id="org0e3b938"></a>
1386
+ <a id="org60dc0ba"></a>
1383
1387
 
1384
1388
  #### `file`
1385
1389
 
1386
1390
  The path to the log file to use.
1387
1391
 
1388
1392
 
1389
- <a id="org9c70445"></a>
1393
+ <a id="orgeb194d3"></a>
1390
1394
 
1391
1395
  #### `level`
1392
1396
 
@@ -1398,7 +1402,7 @@ Can be one of the following
1398
1402
  - **`debug`:** detailed messages to assist debugging `fatty` plus all of the above.
1399
1403
 
1400
1404
 
1401
- <a id="orge47f304"></a>
1405
+ <a id="org823d99d"></a>
1402
1406
 
1403
1407
  #### `tags`
1404
1408
 
@@ -1416,7 +1420,7 @@ tags:
1416
1420
  ```
1417
1421
 
1418
1422
 
1419
- <a id="org220de42"></a>
1423
+ <a id="orge3d84e5"></a>
1420
1424
 
1421
1425
  ## Key code definitions `keydefs.yml`
1422
1426
 
@@ -1554,7 +1558,7 @@ konsole:
1554
1558
  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`!).
1555
1559
 
1556
1560
 
1557
- <a id="orgbd79429"></a>
1561
+ <a id="org2a9d985"></a>
1558
1562
 
1559
1563
  ## Key bindings `keybindings.yml`
1560
1564
 
@@ -1581,7 +1585,7 @@ A keybinding names a key chord, the context in which it applies, and the Fatty a
1581
1585
  ```
1582
1586
 
1583
1587
 
1584
- <a id="org698f2a9"></a>
1588
+ <a id="org47f10de"></a>
1585
1589
 
1586
1590
  ### Key Names
1587
1591
 
@@ -1595,7 +1599,7 @@ A keybinding uses the unmodified key name under the `key` field:
1595
1599
  ```
1596
1600
 
1597
1601
 
1598
- <a id="org58581e4"></a>
1602
+ <a id="orge517d82"></a>
1599
1603
 
1600
1604
  #### Printable Keys
1601
1605
 
@@ -1611,7 +1615,7 @@ Most printable keys can be written as the character itself. Quote keys that YAML
1611
1615
  ```
1612
1616
 
1613
1617
 
1614
- <a id="org4b0cf5b"></a>
1618
+ <a id="org515f394"></a>
1615
1619
 
1616
1620
  #### Curses and Fatty Named Keys
1617
1621
 
@@ -1636,7 +1640,7 @@ Some terminals can report application-keypad sequences such as `keypad_divide`,
1636
1640
  - `space`
1637
1641
 
1638
1642
 
1639
- <a id="orgeab9ebe"></a>
1643
+ <a id="org3fa3e38"></a>
1640
1644
 
1641
1645
  #### Possibly Invisible Keys
1642
1646
 
@@ -1645,7 +1649,7 @@ Some physical keys may never reach Fatty at all. They may be handled by the keyb
1645
1649
  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.
1646
1650
 
1647
1651
 
1648
- <a id="orgde02d1d"></a>
1652
+ <a id="org96ea9b2"></a>
1649
1653
 
1650
1654
  #### Unnamed but Recognized Keys
1651
1655
 
@@ -1670,7 +1674,7 @@ Then bind it in `keybindings.yml`:
1670
1674
  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`.
1671
1675
 
1672
1676
 
1673
- <a id="orge487bc7"></a>
1677
+ <a id="org8888baf"></a>
1674
1678
 
1675
1679
  ### Mouse Events
1676
1680
 
@@ -1705,7 +1709,7 @@ scroll_down
1705
1709
  ```
1706
1710
 
1707
1711
 
1708
- <a id="orgcf36a39"></a>
1712
+ <a id="org2ce52a8"></a>
1709
1713
 
1710
1714
  ### Modifiers
1711
1715
 
@@ -1718,7 +1722,7 @@ shift: true
1718
1722
  ```
1719
1723
 
1720
1724
 
1721
- <a id="orgc29aad9"></a>
1725
+ <a id="orgc4d7ddc"></a>
1722
1726
 
1723
1727
  ### Contexts
1724
1728
 
@@ -1752,7 +1756,7 @@ The available contexts are:
1752
1756
  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.
1753
1757
 
1754
1758
 
1755
- <a id="orgdb5aa78"></a>
1759
+ <a id="orgd327240"></a>
1756
1760
 
1757
1761
  ### Actions
1758
1762
 
@@ -1780,7 +1784,7 @@ Most movement, deletion, history, completion, paging, and popup-navigation actio
1780
1784
  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.
1781
1785
 
1782
1786
 
1783
- <a id="orgf51a408"></a>
1787
+ <a id="org0a51d38"></a>
1784
1788
 
1785
1789
  #### Input buffer actions
1786
1790
 
@@ -1823,7 +1827,7 @@ Terminology notes:
1823
1827
  | yank\_pop | Yes | Copy next kill ring item and replace prior |
1824
1828
 
1825
1829
 
1826
- <a id="org3f876b8"></a>
1830
+ <a id="org0156270"></a>
1827
1831
 
1828
1832
  #### Input field actions
1829
1833
 
@@ -1836,7 +1840,7 @@ Input field actions operate on an editable input field. An input field occurs at
1836
1840
  | history\_next | No | Insert the next relevant history item in the input field |
1837
1841
 
1838
1842
 
1839
- <a id="orge0c4e6e"></a>
1843
+ <a id="org49f5b2c"></a>
1840
1844
 
1841
1845
  #### Shell session actions
1842
1846
 
@@ -1857,7 +1861,7 @@ Shell session actions operate at the session level around the main command input
1857
1861
  | universal\_argument | No | Set the numeric argument to 4 or multiply the current one by 4 |
1858
1862
 
1859
1863
 
1860
- <a id="org05813c6"></a>
1864
+ <a id="org51e582e"></a>
1861
1865
 
1862
1866
  #### Pager actions
1863
1867
 
@@ -1879,7 +1883,7 @@ Pager actions navigate output when the output area is in paging mode. They move
1879
1883
  | quit\_paging | No | Quit paging and return control to the input line |
1880
1884
 
1881
1885
 
1882
- <a id="orgea58518"></a>
1886
+ <a id="org9c6e828"></a>
1883
1887
 
1884
1888
  #### Pager search actions
1885
1889
 
@@ -1908,7 +1912,7 @@ While the search session is active, accepting commits the current match and canc
1908
1912
  | isearch\_cancel | No | Cancel the active incremental search and restore its starting point |
1909
1913
 
1910
1914
 
1911
- <a id="org6ea9ecc"></a>
1915
+ <a id="orgf26b607"></a>
1912
1916
 
1913
1917
  #### Popup actions
1914
1918
 
@@ -1928,7 +1932,7 @@ Popup actions control selection and narrowing popups such as choose, menu, compl
1928
1932
  | popup\_toggle\_selected | No | In multi-select, toggle the selection of the current item |
1929
1933
 
1930
1934
 
1931
- <a id="org8f3d6dc"></a>
1935
+ <a id="org5abe8ab"></a>
1932
1936
 
1933
1937
  #### Prompt popup actions
1934
1938
 
@@ -1941,7 +1945,7 @@ Prompt popup actions control prompt dialogs that collect a string from the user.
1941
1945
  | prompt\_cancel\_if\_empty | No | Cancel only if the input buffer is empty |
1942
1946
 
1943
1947
 
1944
- <a id="org4a9e2d4"></a>
1948
+ <a id="orgb190c08"></a>
1945
1949
 
1946
1950
  #### Utility Actions
1947
1951
 
@@ -1956,12 +1960,12 @@ Some actions exist to support `Fatty`'s own input machinery and are not normally
1956
1960
  | paste | str | No | Insert pasted text at point |
1957
1961
 
1958
1962
 
1959
- <a id="org7e9ed87"></a>
1963
+ <a id="org19a3e32"></a>
1960
1964
 
1961
1965
  ## Themes `themes/`
1962
1966
 
1963
1967
 
1964
- <a id="orgf951ab7"></a>
1968
+ <a id="orge0db426"></a>
1965
1969
 
1966
1970
  ### Distributed Themes
1967
1971
 
@@ -1997,12 +2001,12 @@ Here are the builtin themes:
1997
2001
  | wordperfect | Nostalgic nod to the good old word processor |
1998
2002
 
1999
2003
 
2000
- <a id="orgcf6fbb1"></a>
2004
+ <a id="org23d543d"></a>
2001
2005
 
2002
2006
  ### Custom Themes
2003
2007
 
2004
2008
 
2005
- <a id="orgb8ead89"></a>
2009
+ <a id="orgc7d4f2a"></a>
2006
2010
 
2007
2011
  #### Theme Name
2008
2012
 
@@ -2013,7 +2017,7 @@ name: nordic
2013
2017
  ```
2014
2018
 
2015
2019
 
2016
- <a id="orgc49dfe9"></a>
2020
+ <a id="org7186f3f"></a>
2017
2021
 
2018
2022
  #### Inheritance from Another Theme
2019
2023
 
@@ -2030,7 +2034,7 @@ fg: "#eeeeee"
2030
2034
  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.
2031
2035
 
2032
2036
 
2033
- <a id="org371d3bb"></a>
2037
+ <a id="org85b6b26"></a>
2034
2038
 
2035
2039
  #### Inheritance within a Theme
2036
2040
 
@@ -2050,7 +2054,7 @@ output:
2050
2054
  This means that the input field will have the same coloring and attributes as the output pane.
2051
2055
 
2052
2056
 
2053
- <a id="org83d0479"></a>
2057
+ <a id="org6741eee"></a>
2054
2058
 
2055
2059
  #### Theme Roles
2056
2060
 
@@ -2097,7 +2101,7 @@ Here is a listing of what roles act as the parent for each of the roles, their p
2097
2101
  | `markdown_hrule` | Markdown horizontal rules. | `output` |
2098
2102
 
2099
2103
 
2100
- <a id="orgabf70f2"></a>
2104
+ <a id="org33b14c5"></a>
2101
2105
 
2102
2106
  #### Role Colors and Attributes and Frame Style
2103
2107
 
data/README.org CHANGED
@@ -375,19 +375,27 @@ fallback history.
375
375
  Here are the details on the messages that you can send to the callback
376
376
  parameter to the =on_accept= proc.
377
377
 
378
- *** =append(text, follow: true)=
378
+ *** =append(text, follow: true, role: nil)=
379
379
  Add the given text to the output pane. After a full page of output is
380
380
  produced, enter paging mode so the user can view the output at leisure and
381
381
  search the output. If =follow= is true, keep the output pane's viewport
382
382
  covering the last lines of output.
383
383
 
384
- *** =append_now(text, follow: true, mode: nil)=
384
+ You can specify a "role" of =:good=, =:info=, =:warn=, or =:error= to color
385
+ the output according to the current theme's coloring scheme for those roles.
386
+ Those role names can be symbols or strings.
387
+
388
+ *** =append_now(text, follow: true, mode: nil, role: nil)=
385
389
  Like =append=, but display output as it is produced rather than wait for a
386
390
  full page to be produced.
387
391
 
388
392
  Setting the mode to =:scrolling= or =:paging= determines whether the output is
389
393
  scrolled continuously or paused on each page of output.
390
394
 
395
+ You can specify a "role" of =:good=, =:info=, =:warn=, or =:error= to color
396
+ the output according to the current theme's coloring scheme for those roles.
397
+ Those role names can be symbols or strings.
398
+
391
399
  *** =markdown(text)=
392
400
  Render the given text as markdown source according to the current theme then
393
401
  =append= the result to the output pane.
@@ -9,6 +9,13 @@ module Fatty
9
9
  @io = io
10
10
  end
11
11
 
12
+ def style(text, role:, palette:)
13
+ spec = palette&.[](role.to_sym)
14
+ return text.to_s unless spec
15
+
16
+ "#{sgr_for_spec(spec)}#{text}#{reset}"
17
+ end
18
+
12
19
  def render_line(row:, col:, width:, text:, role:, palette:)
13
20
  spec = palette&.[](role)
14
21
  return unless spec
@@ -2,13 +2,20 @@
2
2
 
3
3
  module Fatty
4
4
  module OutputApi
5
- def append(text, follow: true)
6
- queue(Command.session(output_id, :append, text: text.to_s, follow: follow))
5
+ def append(text, follow: true, role: nil)
6
+ payload = {
7
+ text: output_text(text, role: role),
8
+ follow: follow,
9
+ }
10
+ queue(Command.session(output_id, :append, **payload))
7
11
  nil
8
12
  end
9
13
 
10
- def append_now(text, follow: true, mode: nil)
11
- payload = { text: text.to_s, follow: follow }
14
+ def append_now(text, follow: true, mode: nil, role: nil)
15
+ payload = {
16
+ text: output_text(text, role: role),
17
+ follow: follow,
18
+ }
12
19
  payload[:mode] = mode if mode
13
20
 
14
21
  terminal.apply_command(Command.session(output_id, :append, **payload))
@@ -30,6 +37,19 @@ module Fatty
30
37
 
31
38
  private
32
39
 
40
+ def output_text(text, role:)
41
+ text = text.to_s
42
+ if role
43
+ Fatty::Ansi::Renderer.new.style(
44
+ text,
45
+ role: role,
46
+ palette: markdown_palette,
47
+ )
48
+ else
49
+ text
50
+ end
51
+ end
52
+
33
53
  def markdown_palette
34
54
  terminal.renderer.palette if terminal.respond_to?(:renderer) && terminal.renderer
35
55
  end
@@ -135,8 +135,14 @@ module Fatty
135
135
 
136
136
  def close
137
137
  close_windows
138
- disable_bracketed_paste! if @started
139
- ::Curses.close_screen if @started
138
+ if @started
139
+ disable_bracketed_paste!
140
+ ::Curses.curs_set(1)
141
+ ::Curses.noraw
142
+ ::Curses.echo
143
+ ::Curses.nl
144
+ ::Curses.close_screen
145
+ end
140
146
  @started = false
141
147
  end
142
148
 
data/lib/fatty/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fatty
4
- VERSION = "0.99.4"
4
+ VERSION = "0.99.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fatty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.4
4
+ version: 0.99.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel E. Doherty
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  - !ruby/object:Gem::Version
247
247
  version: '0'
248
248
  requirements: []
249
- rubygems_version: 4.0.0
249
+ rubygems_version: 4.0.17
250
250
  specification_version: 4
251
251
  summary: Stateful terminal UI with editable input and scrollback
252
252
  test_files: []