@@ -18,6 +18,7 @@ import module [
18
18
Exports: [? help about usage what license source dump-obj]
19
19
][
20
20
buffer: none
21
+ cols: 80 ; default terminal width
21
22
max-desc-width: 45
22
23
23
24
help-text: {
@@ -186,10 +187,11 @@ import module [
186
187
'word [any-type! ]
187
188
/into "Help text will be inserted into provided string instead of printed"
188
189
string [string! ] "Returned series will be past the insertion"
189
- /local value spec args refs rets type ret desc arg def des ref str
190
+ /local value spec args refs rets type ret desc arg def des ref str cols
190
191
] [
191
192
try [
192
- max-desc-width: (query /mode system/ports/input 'buffer-cols) - 35
193
+ cols: query /mode system/ports/input 'buffer-cols
194
+ max-desc-width: cols - 35
193
195
]
194
196
buffer: any [string clear "" ]
195
197
catch [
@@ -260,7 +262,7 @@ import module [
260
262
throw true
261
263
]
262
264
not any [word? :word path? :word ] [
263
- output [ mold :word "is " form-type :word ]
265
+ output ajoin [ " ^[ [1;32m" uppercase mold :word "^[ [m is " form-type :word ]
264
266
throw true
265
267
]
266
268
path? :word [
@@ -369,8 +371,15 @@ import module [
369
371
throw true
370
372
]
371
373
'else [
372
- output ajoin ["^[ [1;32m" uppercase mold word "^[ [m is " form-type :value " of value: ^[ [32m" ]
373
- output either any [any-object? value] [output lf dump-obj :value ][mold :value ]
374
+ word: uppercase mold word
375
+ type: form-type :value
376
+ output ajoin ["^[ [1;32m" word "^[ [m is " type " of value: ^[ [32m" ]
377
+ output either any [any-object? value] [
378
+ output lf dump-obj :value
379
+ ][
380
+ max-desc-width: cols - (length? word) - (length? type) - 21
381
+ form-val :value
382
+ ]
374
383
output "^[ [m"
375
384
]
376
385
]
0 commit comments