-
Notifications
You must be signed in to change notification settings - Fork 2
/
blessed.d.ts
4827 lines (4072 loc) · 132 KB
/
blessed.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for blessed 0.1
// Project: https://github.com/chjj/blessed
// Definitions by: Bryn Austin Bellomy <https://github.com/brynbellomy>
// Steve Kellock <https://github.com/skellock>
// Max Brauer <https://github.com/mamachanko>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
import * as child_process from 'child_process'
import { EventEmitter } from 'events'
import * as stream from 'stream'
import { Readable, Writable } from 'stream'
/**
* A general representation of the data object received callbacks of program's write operation on the output.
*
* In general, each event type will respond with a data object that is mixed into this data object properties, and also is available individually in some of its properties, For example a 'device-status' request will respond with a 'statis property with only that information but also the properties mixed in the object itself'
*/
interface ProgramResponseData {
/** The event type that was requested / write that caused this response. Example: 'window-manipulation', 'device-attributes', 'device-status', */
event: string
/** example: '', 'DSR' */
code: string
/** Identifies the request type that caused this response. For example, if a 'window-manipulation' is written the response type could be 'textarea-size', example: 'textarea-size', 'cursor-status', */
type: string
size?: { height: number; width: number }
height?: number
width?: number
status?: { x?: number; y: number; page?: number }
page?: any
x?: number
y?: number
cursor?: { x: 1; y: 1; page: undefined }
textAreaSizeCharacters?: { height: number; width: number }
// TODO leave the object open since it has lots of combinations
[k: string]: any
}
type ProgramResponseCallback = (this: BlessedProgram, err: Error, data: ProgramResponseData) => any
/** program.output Writable implementation should implement this interface */
interface ProgramOutput extends Writable {
isTTY?: boolean
column: number
rows: number
// on(e: 'resize', callback: () => void): this
// /**
// * Each time
// * @internal.
// */
// on(e: 'response', callback: (e: { event?: string }) => void): this
// on(e: string, callback: (...args: any[]) => void): this
}
interface GpmEvent {
name: 'mouse' | ''
type: 'GPM'
action:
| Widgets.Types.TMouseAction
| 'mousedown'
| 'mouseup'
| 'connect'
| 'mousewheel'
| 'data'
| 'move'
| 'dragbtndown'
| 'dblclick'
| 'btnup'
| 'click'
| 'error'
button: 'left' | 'middle' | 'right'
raw: [number, number, number, number]
x: number
y: number
shift: boolean
meta: boolean
ctrl: boolean
}
interface GpmClient extends EventEmitter {
on(e: 'move', c: (buttons: any, modifiers: any, x: any, y: any) => void): this
// TODO:
// 'mousewheel',evnt.buttons, evnt.modifiers, evnt.x, evnt.y, evnt.wdx, evnt.wdy);
// 'drag', evnt.buttons, evnt.modifiers, evnt.x, evnt.y);
// 'mousewheel', evnt.buttons, evnt.modifiers, evnt.x, evnt.y, evnt.wdx, evnt.wdy);
// 'btndown', evnt.buttons, evnt.modifiers, evnt.x, evnt.y);
// 'dblclick', evnt.buttons, evnt.modifiers, evnt.x, evnt.y);
// 'btnup', evnt.buttons, evnt.modifiers, evnt.x, evnt.y);
// self.emit('click', evnt.buttons, evnt.modifiers, evnt.x, evnt.y);
}
export interface IBlessedProgramOptions {
input?: Readable
output?: Writable
/** path to a file where to write when screen.log() or program.log are called */
log?: string
dump?: boolean
/** zero-based indexes for col, row values */
zero?: boolean
buffer?: boolean
terminal?: string
term?: string
tput?: string
debug?: boolean
resizeTimeout?: boolean
}
/**
* The Program instance manages the low level interaction the the terminal. It emit the basi native events to the screens. It has associated an [[output]] writable stream attribute which ussually is stdout but could could be conigured by the user using [[IBlessedProgramOptions]]. The same for an [[input]] Readable stream from which the host terminal respond to the program requests.
*
* The communication with the host system is mostly done writing `tput` sequences to the [[output]] stream. The program is responsible of portability and supporting the same API thgouth several terminal standards / vendors
*
* Although the BlessedProgram instances are not Nodes (unlike Screens that are) they have a somwhat similar API, emiting events with similar names and has some simlar attributes, but it's important to known that most of these events and attributes refer to the host terminal window and not with the lines inside the screen. For example, focus or blur event refers to the terminal window focus, not the internal Blessed Element
*
* In general users don't have to use the program for develop their applications, however, it can be accessed from the screen and its lower level api can be used along the application.
## Example 1
Starting a program alone, and register 'q' to exist
```
const program = blessed.program({
})
program.setMouse({
allMotion: true,
}, true);
program.alternateBuffer()
program.enableMouse()
program.key(['q', 'escape', 'C-c'], function () {
program.showCursor()
program.disableMouse()
program.normalBuffer()
process.exit(0)
})
```
## Example 2:
Registering for resize, blur, and focus terminal window native events:
```
program.setMouse({ sendFocus: true }, true)
program.on('resize', function (data) {
setTimeout(function () {
program.clear();
program.cup(0, 0);
}, 200);
});
process.on('SIGWINCH', function (data) {
setTimeout(function () {
program.cup(1, 0);
}, 200);
});
program.on('focus', function (data) {
program.clear();
program.cup(0, 0);
});
program.on('blur', function (data) {
program.clear();
program.cup(0, 0);
});
```
## Example 3:
Drawing on mouse move
```
program.setBackground('green', 'O')
program.setForeground('red', 'i')
program.on('mouse', function (data) {
program.cup(data.y, data.x);
program.write(' ', 'blue bg');
program.write('as', 'red fg');
program.cup(0, 0);
});
```
## Example 4
Setting the cursor style
```
program.showCursor();
program.setCursorStyle(1);
setTimeout(() => {
program.setCursorStyle(2);
}, 9000);
setTimeout(() => {
program.setCursorStyle(4);
}, 3000);
setTimeout(() => {
program.setCursorStyle(3);
}, 6000);
```
## Example 5
Minimize / Maximize the terminal window and requesting it size and position and cursor
```
program.write('MINIMIZING IN 2 seconds')
setTimeout(() => {
program.manipulateWindow(2, (err, data)=>{
program.log(data);
})
}, 2000)
setTimeout(() => {
program.manipulateWindow(1, (err, data)=>{
program.log(data);
})
}, 4000)
program.getCursor(function(err, data) {
program.write(util.inspect(data));
});
program.getWindowSize(function(err:any, data:any) {
program.log('getWindowSize', data);
});
```
*/
declare class BlessedProgram extends EventEmitter {
/** @internal */
static instances: BlessedProgram[]
/** @internal */
gpm?: GpmClient
type: string
options: IBlessedProgramOptions
input: Readable
output: Writable
/** zero-based indexes for col, row values */
zero: boolean
useBuffer: boolean
x: number
y: number
savedX: number
savedY: number
cols: number
rows: number
scrollTop: number
scrollBottom: number
isOSXTerm: boolean
isiTerm2: boolean
isXFCE: boolean
isTerminator: boolean
isLXDE: boolean
isVTE: boolean
isRxvt: boolean
isXterm: boolean
tmux: boolean
tmuxVersion: number
isAlt: boolean
constructor(options?: IBlessedProgramOptions)
/** writes arguments to [[log]] file passed in options*/
log(...args: any[]): boolean
debug(s: string): boolean
setupDump(): void
setupTput(): void
setTerminal(terminal: string): void
/** Queries whether the terminal has the capability `name`. */
has(name: string): boolean
/** Queries whether the terminal of the type `is`. */
term(is: string): boolean
listen(): void
destroy(): void
key(key: string | string[], l: Widgets.KeyEventListener): void
onceKey(key: string | string[], l: Widgets.KeyEventListener): void
unKey(key: string | string[], l: Widgets.KeyEventListener): void
removeKey(key: string | string[], l: Widgets.KeyEventListener): void
bindMouse(): void
enableGpm(): void
disableGpm(): void
bindResponse(): void
response(name: string, text: string, callback: Function, noBypass?: boolean): boolean
response(name: string, callback?: Function): boolean
write(text: string): boolean
/**
* Writes to this.output
* Example: `program.write('Hello world', 'blue fg')`
*/
write(text: string, style: string): boolean
/**
* Flushes the buffer.
*/
flush(): void
/** Determines whether to include text attributes when writing. */
print(text: string, attr?: boolean): boolean
echo(text: string, attr?: boolean): boolean
/** sets cursor */
setx(x: number): boolean
sety(y: number): boolean
move(x: number, y: number): boolean
omove(x: number, y: number): void
rsetx(x: number): boolean
rsety(y: number): boolean
rmove(x: number, y: number): void
cursorCharAbsolute(x: number): number
simpleInsert(ch: string, i?: number, attr?: boolean): boolean
repeat(ch: string, i?: number): string
copyToClipboard(text: string): boolean
cursorShape(shape: 'block' | 'underline' | 'line', blink?: boolean): boolean
cursorColor(color: string): boolean
cursorReset(): boolean
resetCursor(): boolean
getTextParams(param: string, callback: Function): boolean
/**
* example call:
*
```
program.getCursor(function(err, data) {
program.log('getCursor', data);
program.write(util.inspect(data));
});
```
*/
getCursorColor(callback: Function): boolean
nul(): boolean
bell(): boolean
bel(): boolean
vtab(): boolean
form(): boolean
ff(): boolean
backspace(): boolean
kbs(): boolean
tab(): boolean
ht(): boolean
/** @internal */
_ncoords(): void
shiftOut(): boolean
shiftIn(): boolean
return(): boolean
cr(): boolean
feed(): boolean
newline(): boolean
nl(): boolean
index(): boolean
ind(): boolean
reverseIndex(): boolean
reverse(): boolean
ri(): boolean
nextLine(): boolean
reset(): boolean
tabSet(): boolean
saveCursor(key: string): boolean
sc(key: string): boolean
restoreCursor(key?: string, hide?: boolean): boolean
rc(key?: string, hide?: boolean): boolean
lsaveCursor(key?: string): void
lrestoreCursor(key?: string, hide?: boolean): void
lineHeight(): boolean
charset(val?: string, level?: number): boolean
enter_alt_charset_mode(): boolean
as(): boolean
smacs(): boolean
exit_alt_charset_mode(): boolean
ae(): boolean
rmacs(): boolean
setG(val: number): boolean
setTitle(title: string): boolean
resetColors(param?: string): boolean
/**
* OSC Ps ; Pt ST
* OSC Ps ; Pt BEL
* Change dynamic colors
*/
dynamicColors(param?: string): boolean
selData(a: string, b: string): boolean
cursorUp(param?: number): boolean
cuu(param?: number): boolean
up(param?: number): boolean
/**
* Cursor Down `n` times, by default 1.
*/
cursorDown(n?: number): boolean
/** @see [[cursorDown]] */
cud(n?: number): boolean
/** @see [[cursorDown]] */
down(n?: number): boolean
cursorForward(n?: number): boolean
cuf(n?: number): boolean
right(n?: number): boolean
forward(n?: number): boolean
cursorBackward(n?: number): boolean
cub(n?: number): boolean
left(n?: number): boolean
back(n?: number): boolean
/**
* CSI Ps ; Ps H
* Cursor Position [ row;column ] (default = [ 1,1 ]) (CUP).
*/
cursorPos(row?: number, col?: number): boolean
/**
* CSI Ps ; Ps H
* Cursor Position [ row;column ] (default = [ 1,1 ]) (CUP).
*/
cup(row?: number, col?: number): boolean
/**
* CSI Ps ; Ps H
* Cursor Position [ row;column ] (default = [ 1,1 ]) (CUP).
*/
pos(row?: number, col?: number): boolean
eraseInDisplay(param?: string): boolean
ed(param?: string): boolean
clear(): boolean
eraseInLine(param?: string): boolean
el(param?: string): boolean
/**
```
CSI Pm m Character Attributes (SGR).
Ps = 0 -> Normal (default).
Ps = 1 -> Bold.
Ps = 4 -> Underlined.
Ps = 5 -> Blink (appears as Bold).
Ps = 7 -> Inverse.
Ps = 8 -> Invisible, i.e., hidden (VT300).
Ps = 2 2 -> Normal (neither bold nor faint).
Ps = 2 4 -> Not underlined.
Ps = 2 5 -> Steady (not blinking).
Ps = 2 7 -> Positive (not inverse).
Ps = 2 8 -> Visible, i.e., not hidden (VT300).
Ps = 3 0 -> Set foreground color to Black.
Ps = 3 1 -> Set foreground color to Red.
Ps = 3 2 -> Set foreground color to Green.
Ps = 3 3 -> Set foreground color to Yellow.
Ps = 3 4 -> Set foreground color to Blue.
Ps = 3 5 -> Set foreground color to Magenta.
Ps = 3 6 -> Set foreground color to Cyan.
Ps = 3 7 -> Set foreground color to White.
Ps = 3 9 -> Set foreground color to default (original).
Ps = 4 0 -> Set background color to Black.
Ps = 4 1 -> Set background color to Red.
Ps = 4 2 -> Set background color to Green.
Ps = 4 3 -> Set background color to Yellow.
Ps = 4 4 -> Set background color to Blue.
Ps = 4 5 -> Set background color to Magenta.
Ps = 4 6 -> Set background color to Cyan.
Ps = 4 7 -> Set background color to White.
Ps = 4 9 -> Set background color to default (original).
If 16-color support is compiled, the following apply. Assume
that xterm's resources are set so that the ISO color codes are
the first 8 of a set of 16. Then the aixterm colors are the
bright versions of the ISO colors:
Ps = 9 0 -> Set foreground color to Black.
Ps = 9 1 -> Set foreground color to Red.
Ps = 9 2 -> Set foreground color to Green.
Ps = 9 3 -> Set foreground color to Yellow.
Ps = 9 4 -> Set foreground color to Blue.
Ps = 9 5 -> Set foreground color to Magenta.
Ps = 9 6 -> Set foreground color to Cyan.
Ps = 9 7 -> Set foreground color to White.
Ps = 1 0 0 -> Set background color to Black.
Ps = 1 0 1 -> Set background color to Red.
Ps = 1 0 2 -> Set background color to Green.
Ps = 1 0 3 -> Set background color to Yellow.
Ps = 1 0 4 -> Set background color to Blue.
Ps = 1 0 5 -> Set background color to Magenta.
Ps = 1 0 6 -> Set background color to Cyan.
Ps = 1 0 7 -> Set background color to White.
If xterm is compiled with the 16-color support disabled, it
supports the following, from rxvt:
Ps = 1 0 0 -> Set foreground and background color to
default.
If 88- or 256-color support is compiled, the following apply.
Ps = 3 8 ; 5 ; Ps -> Set foreground color to the second
Ps.
Ps = 4 8 ; 5 ; Ps -> Set background color to the second
Ps.
```
*/
charAttributes(param: string, val?: string): boolean
charAttributes(param: string[], val?: string): boolean
/**
* set the foreground color and character for the following writings to the output buffer. Example:
```
program.setBackground('green', 'O')
program.setForeground('red', 'i')
program.on('mouse', function (data) {
program.cup(data.y, data.x);
program.write(' ', 'blue bg');
program.write('as', 'red fg');
program.cup(0, 0);
});
```
*/
setForeground(color: string, val?: string): boolean
/** @see [[setForeground]] */
fg(color: string, val?: boolean): string
/**
* set the background color and character for the following writings to the output buffer. Example:
```
program.setBackground('green', 'O')
program.setForeground('red', 'i')
program.on('mouse', function (data) {
program.cup(data.y, data.x);
program.write(' ', 'blue bg');
program.write('as', 'red fg');
program.cup(0, 0);
});
```
*/
setBackground(color: string, val?: string): boolean
/** @see [[setBackground]] */
bg(color: string, val?: string): boolean
/**
```
CSI Ps n Device Status Report (DSR).
Ps = 5 -> Status Report. Result (``OK'') is
CSI 0 n
Ps = 6 -> Report Cursor Position (CPR) [row;column].
Result is
CSI r ; c R
CSI ? Ps n
Device Status Report (DSR, DEC-specific).
Ps = 6 -> Report Cursor Position (CPR) [row;column] as CSI
? r ; c R (assumes page is zero).
Ps = 1 5 -> Report Printer status as CSI ? 1 0 n (ready).
or CSI ? 1 1 n (not ready).
Ps = 2 5 -> Report UDK status as CSI ? 2 0 n (unlocked)
or CSI ? 2 1 n (locked).
Ps = 2 6 -> Report Keyboard status as
CSI ? 2 7 ; 1 ; 0 ; 0 n (North American).
The last two parameters apply to VT400 & up, and denote key-
board ready and LK01 respectively.
Ps = 5 3 -> Report Locator status as
CSI ? 5 3 n Locator available, if compiled-in, or
CSI ? 5 0 n No Locator, if not.
```
*/
deviceStatus(param?: string, callback?: ProgramResponseCallback, dec?: boolean, noBypass?: boolean): boolean
/**@see [[deviceStatus]] */
dsr(param?: string, callback?: Function, dec?: boolean, noBypass?: boolean): boolean
/**
Example Call:
```
program.getCursor(function(err, data) {
program.log('getCursor', data);
});
```
*/
getCursor(callback: ProgramResponseCallback): boolean
saveReportedCursor(callback: ProgramResponseCallback): void
restoreReportedCursor: () => boolean
/** CSI Ps @
Insert Ps (Blank) Character(s) (default = 1) (ICH). */
insertChars(param?: number): boolean
/** @see [[insertChars]] */
ich(param?: number): boolean
/**
```
CSI Ps E
Cursor Next Line Ps Times (default = 1) (CNL).
same as CSI Ps B ?
```
*/
cursorNextLine(param?: number): boolean
/** @cursorNextLine */
cnl(param?: number): boolean
cursorPrecedingLine(param?: number): boolean
cpl(param?: number): boolean
cursorCharAbsolute(param?: number): boolean
cha(param?: number): boolean
insertLines(param?: number): boolean
il(param?: number): boolean
deleteLines(param?: number): boolean
dl(param?: number): boolean
deleteChars(param?: number): boolean
dch(param?: number): boolean
eraseChars(param?: number): boolean
ech(param?: number): boolean
charPosAbsolute(param?: number): boolean
hpa(param?: number): boolean
HPositionRelative(param?: number): boolean
sendDeviceAttributes(param?: number, callback?: ProgramResponseCallback): boolean
da(param?: number, callback?: Function): boolean
linePosAbsolute(param?: number): boolean
vpa(param?: number): boolean
VPositionRelative(param?: number): boolean
vpr(param?: number): boolean
HVPosition(row?: number, col?: number): boolean
hvp(row?: number, col?: number): boolean
/**
```
CSI Pm h Set Mode (SM).
Ps = 2 -> Keyboard Action Mode (AM).
Ps = 4 -> Insert Mode (IRM).
Ps = 1 2 -> Send/receive (SRM).
Ps = 2 0 -> Automatic Newline (LNM).
CSI ? Pm h
DEC Private Mode Set (DECSET).
Ps = 1 -> Application Cursor Keys (DECCKM).
Ps = 2 -> Designate USASCII for character sets G0-G3
(DECANM), and set VT100 mode.
Ps = 3 -> 132 Column Mode (DECCOLM).
Ps = 4 -> Smooth (Slow) Scroll (DECSCLM).
Ps = 5 -> Reverse Video (DECSCNM).
Ps = 6 -> Origin Mode (DECOM).
Ps = 7 -> Wraparound Mode (DECAWM).
Ps = 8 -> Auto-repeat Keys (DECARM).
Ps = 9 -> Send Mouse X & Y on button press. See the sec-
tion Mouse Tracking.
Ps = 1 0 -> Show toolbar (rxvt).
Ps = 1 2 -> Start Blinking Cursor (att610).
Ps = 1 8 -> Print form feed (DECPFF).
Ps = 1 9 -> Set print extent to full screen (DECPEX).
Ps = 2 5 -> Show Cursor (DECTCEM).
Ps = 3 0 -> Show scrollbar (rxvt).
Ps = 3 5 -> Enable font-shifting functions (rxvt).
Ps = 3 8 -> Enter Tektronix Mode (DECTEK).
Ps = 4 0 -> Allow 80 -> 132 Mode.
Ps = 4 1 -> more(1) fix (see curses resource).
Ps = 4 2 -> Enable Nation Replacement Character sets (DECN-
RCM).
Ps = 4 4 -> Turn On Margin Bell.
Ps = 4 5 -> Reverse-wraparound Mode.
Ps = 4 6 -> Start Logging. This is normally disabled by a
compile-time option.
Ps = 4 7 -> Use Alternate Screen Buffer. (This may be dis-
abled by the titeInhibit resource).
Ps = 6 6 -> Application keypad (DECNKM).
Ps = 6 7 -> Backarrow key sends backspace (DECBKM).
Ps = 1 0 0 0 -> Send Mouse X & Y on button press and
release. See the section Mouse Tracking.
Ps = 1 0 0 1 -> Use Hilite Mouse Tracking.
Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking.
Ps = 1 0 0 3 -> Use All Motion Mouse Tracking.
Ps = 1 0 0 4 -> Send FocusIn/FocusOut events.
Ps = 1 0 0 5 -> Enable Extended Mouse Mode.
Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).
Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).
Ps = 1 0 3 4 -> Interpret "meta" key, sets eighth bit.
(enables the eightBitInput resource).
Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num-
Lock keys. (This enables the numLock resource).
Ps = 1 0 3 6 -> Send ESC when Meta modifies a key. (This
enables the metaSendsEscape resource).
Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete
key.
Ps = 1 0 3 9 -> Send ESC when Alt modifies a key. (This
enables the altSendsEscape resource).
Ps = 1 0 4 0 -> Keep selection even if not highlighted.
(This enables the keepSelection resource).
Ps = 1 0 4 1 -> Use the CLIPBOARD selection. (This enables
the selectToClipboard resource).
Ps = 1 0 4 2 -> Enable Urgency window manager hint when
Control-G is received. (This enables the bellIsUrgent
resource).
Ps = 1 0 4 3 -> Enable raising of the window when Control-G
is received. (enables the popOnBell resource).
Ps = 1 0 4 7 -> Use Alternate Screen Buffer. (This may be
disabled by the titeInhibit resource).
Ps = 1 0 4 8 -> Save cursor as in DECSC. (This may be dis-
abled by the titeInhibit resource).
Ps = 1 0 4 9 -> Save cursor as in DECSC and use Alternate
Screen Buffer, clearing it first. (This may be disabled by
the titeInhibit resource). This combines the effects of the 1
0 4 7 and 1 0 4 8 modes. Use this with terminfo-based
applications rather than the 4 7 mode.
Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode.
Ps = 1 0 5 1 -> Set Sun function-key mode.
Ps = 1 0 5 2 -> Set HP function-key mode.
Ps = 1 0 5 3 -> Set SCO function-key mode.
Ps = 1 0 6 0 -> Set legacy keyboard emulation (X11R6).
Ps = 1 0 6 1 -> Set VT220 keyboard emulation.
Ps = 2 0 0 4 -> Set bracketed paste mode.
Modes:
http://vt100.net/docs/vt220-rm/chapter4.html
```
Example: Show cursor:
```
return this.setMode('?25', (error, data)=>{
});
```
*/
setMode(args: string, callback: ProgramResponseCallback): boolean
/** @see [[setMode]] */
sm(...args: string[]): boolean
decset(...args: string[]): boolean
/**
* Uses [[setMode]] 2 5 to show the cursor:
NOTE: In xterm terminfo: cnorm stops blinking cursor cvvis starts blinking cursor
*/
showCursor(): boolean
alternateBuffer(): boolean
smcup(): boolean
alternate(): boolean
/**
```
CSI Pm l Reset Mode (RM).
Ps = 2 -> Keyboard Action Mode (AM).
Ps = 4 -> Replace Mode (IRM).
Ps = 1 2 -> Send/receive (SRM).
Ps = 2 0 -> Normal Linefeed (LNM).
CSI ? Pm l
DEC Private Mode Reset (DECRST).
Ps = 1 -> Normal Cursor Keys (DECCKM).
Ps = 2 -> Designate VT52 mode (DECANM).
Ps = 3 -> 80 Column Mode (DECCOLM).
Ps = 4 -> Jump (Fast) Scroll (DECSCLM).
Ps = 5 -> Normal Video (DECSCNM).
Ps = 6 -> Normal Cursor Mode (DECOM).
Ps = 7 -> No Wraparound Mode (DECAWM).
Ps = 8 -> No Auto-repeat Keys (DECARM).
Ps = 9 -> Don't send Mouse X & Y on button press.
Ps = 1 0 -> Hide toolbar (rxvt).
Ps = 1 2 -> Stop Blinking Cursor (att610).
Ps = 1 8 -> Don't print form feed (DECPFF).
Ps = 1 9 -> Limit print to scrolling region (DECPEX).
Ps = 2 5 -> Hide Cursor (DECTCEM).
Ps = 3 0 -> Don't show scrollbar (rxvt).
Ps = 3 5 -> Disable font-shifting functions (rxvt).
Ps = 4 0 -> Disallow 80 -> 132 Mode.
Ps = 4 1 -> No more(1) fix (see curses resource).
Ps = 4 2 -> Disable Nation Replacement Character sets (DEC-
NRCM).
Ps = 4 4 -> Turn Off Margin Bell.
Ps = 4 5 -> No Reverse-wraparound Mode.
Ps = 4 6 -> Stop Logging. (This is normally disabled by a
compile-time option).
Ps = 4 7 -> Use Normal Screen Buffer.
Ps = 6 6 -> Numeric keypad (DECNKM).
Ps = 6 7 -> Backarrow key sends delete (DECBKM).
Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and
release. See the section Mouse Tracking.
Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking.
Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking.
Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking.
Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events.
Ps = 1 0 0 5 -> Disable Extended Mouse Mode.
Ps = 1 0 1 0 -> Don't scroll to bottom on tty output
(rxvt).
Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt).
Ps = 1 0 3 4 -> Don't interpret "meta" key. (This disables
the eightBitInput resource).
Ps = 1 0 3 5 -> Disable special modifiers for Alt and Num-
Lock keys. (This disables the numLock resource).
Ps = 1 0 3 6 -> Don't send ESC when Meta modifies a key.
(This disables the metaSendsEscape resource).
Ps = 1 0 3 7 -> Send VT220 Remove from the editing-keypad
Delete key.
Ps = 1 0 3 9 -> Don't send ESC when Alt modifies a key.
(This disables the altSendsEscape resource).
Ps = 1 0 4 0 -> Do not keep selection when not highlighted.
(This disables the keepSelection resource).
Ps = 1 0 4 1 -> Use the PRIMARY selection. (This disables
the selectToClipboard resource).
Ps = 1 0 4 2 -> Disable Urgency window manager hint when
Control-G is received. (This disables the bellIsUrgent
resource).
Ps = 1 0 4 3 -> Disable raising of the window when Control-
G is received. (This disables the popOnBell resource).
Ps = 1 0 4 7 -> Use Normal Screen Buffer, clearing screen
first if in the Alternate Screen. (This may be disabled by
the titeInhibit resource).
Ps = 1 0 4 8 -> Restore cursor as in DECRC. (This may be
disabled by the titeInhibit resource).
Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore cursor
as in DECRC. (This may be disabled by the titeInhibit
resource). This combines the effects of the 1 0 4 7 and 1 0
4 8 modes. Use this with terminfo-based applications rather
than the 4 7 mode.
Ps = 1 0 5 0 -> Reset terminfo/termcap function-key mode.
Ps = 1 0 5 1 -> Reset Sun function-key mode.
Ps = 1 0 5 2 -> Reset HP function-key mode.
Ps = 1 0 5 3 -> Reset SCO function-key mode.
Ps = 1 0 6 0 -> Reset legacy keyboard emulation (X11R6).
Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style.
Ps = 2 0 0 4 -> Reset bracketed paste mode.
```
*/
resetMode(...args: string[]): boolean
/** @see [[resetMode]] */
rm(...args: string[]): boolean
decrst(...args: string[]): boolean
hideCursor(): boolean
civis(): boolean
vi(): boolean
cursor_invisible(): boolean
dectcemh(): boolean
normalBuffer(): boolean
rmcup(): boolean
enableMouse(): void
disableMouse(): void
setMouse(
opt?: {
normalMouse?: boolean
x10Mouse?: boolean
hiliteTracking?: boolean
vt200Mouse?: boolean
allMotion?: boolean
sendFocus?: boolean
utfMode?: boolean
sgrMouse?: boolean
decMouse?: boolean
urxvtMouse?: boolean
ptermMouse?: boolean
jsbtermMouse?: boolean
gpmMouse?: boolean
[s: string]: any
},
enable?: boolean
): void
/**
```
CSI Ps ; Ps r
Set Scrolling Region [top;bottom] (default = full size of win-
dow) (DECSTBM).
CSI ? Pm r
```
*/
setScrollRegion(top: number, bottom: number): boolean
/** @see [[setScrollRegion]]*/
csr(top: number, bottom: number): boolean
/** @see [[setScrollRegion]]*/
decstbm(top: number, bottom: number): boolean
/**
```
CSI s
Save cursor (ANSI.SYS).
```
*/
saveCursorA(): boolean
/** @see [[saveCursorA]]*/
scA(): boolean
/**
```
CSI u
Restore cursor (ANSI.SYS).
```
*/
restoreCursorA(): boolean
/** @see [[restoreCursorA]]*/
rcA(): boolean
/** Cursor Forward Tabulation Ps tab stops (default = 1) (CHT). */
cursorForwardTab(param?: number): boolean
/** @see [[cursorForwardTab]]*/
cht(param?: number): boolean
/**CSI Ps S Scroll up Ps lines (default = 1) (SU). */
scrollUp(param?: number): boolean
/** @see [[scrollUp]]*/
su(param?: number): boolean
/** CSI Ps T Scroll down Ps lines (default = 1) (SD). */
scrollDown(param?: number): boolean
/** @see [[scrollDown]]*/
sd(param?: number): boolean
/**
```
CSI Ps ; Ps ; Ps ; Ps ; Ps T
Initiate highlight mouse tracking. Parameters are
[func;startx;starty;firstrow;lastrow]. See the section Mouse
Tracking.
```
*/
initMouseTracking(...args: string[]): boolean
/**
```
CSI > Ps; Ps T
Reset one or more features of the title modes to the default
value. Normally, "reset" disables the feature. It is possi-
ble to disable the ability to reset features by compiling a
different default for the title modes into xterm.
Ps = 0 -> Do not set window/icon labels using hexadecimal.
Ps = 1 -> Do not query window/icon labels using hexadeci-
mal.
Ps = 2 -> Do not set window/icon labels using UTF-8.
Ps = 3 -> Do not query window/icon labels using UTF-8.
(See discussion of "Title Modes").
```
*/
resetTitleModes(...args: string[]): boolean
/** CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT). */
cursorBackwardTab(param?: number): boolean
cbt(param?: number): boolean
repeatPrecedingCharacter(param?: number): boolean
rep(param?: number): boolean
tabClear(param?: number): boolean
tbc(param?: number): boolean
mediaCopy(...args: string[]): boolean
mc(...args: string[]): boolean
mc0(): boolean
print_screen(): boolean
ps(): boolean
mc5(): boolean
prtr_on(): boolean
po(): boolean
mc4(): boolean
prtr_off(): boolean
pf(): boolean
mc5p(): boolean
prtr_non(): boolean
p0(): boolean
setResources(...args: string[]): boolean
disableModifieres(...args: string[]): boolean
/**
*
```
CSI > Ps p
Set resource value pointerMode. This is used by xterm to
decide whether to hide the pointer cursor as the user types.
Valid values for the parameter:
Ps = 0 -> never hide the pointer.
Ps = 1 -> hide if the mouse tracking mode is not enabled.
Ps = 2 -> always hide the pointer. If no parameter is
given, xterm uses the default, which is 1 .
```
*/
setPointerMode(...args: string[]): boolean
softReset(): boolean
rs2(): boolean