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
//! Modes.
//!
//! The [ECMA-48][ecma-48] standard is intended to be applicable to a very large range of devices, in which there are
//! variations. Some of these variations have been formalized in the form of modes. They deal with the way in which a
//! device transmits, receives, processes, or images data. Each mode has two states. The reset state, and the set state.
//!
//! The states of the modes may be established explicitly in the data stream by the control functions SET MODE
//! ([`SM`][crate::control_sequences::SM]) and RESET MODE ([`RM`][crate::control_sequences::RM]) or may be established
//! by agreement between sender and recipient. In an implementation, some or all of the modes have one state only.
//!
//! To ensure data compatibility and ease of interchange with a variety of equipment the use of modes is deprecated. If
//! modes have to be implemented for backward compatibility it is recommended that the reset state of the modes be the
//! initial state. Otherwise, explicit agreements will have to be negotiated between sender and recipient, to the
//! detriment of "blind" interchange.
//!
//! ## Usage
//!
//! Two possibilities exist to use modes.
//!
//! ### Directly invoking `SM` or `RM` Control Functions
//!
//! You can pass modes to the arguments of the control functions SET MODE ([`SM`][crate::control_sequences::SM]) and
//! RESET MODE ([`RM`][crate::control_sequences::RM]).
//!
//! ```
//! use ansi_control_codes::control_sequences;
//! use ansi_control_codes::modes;
//!
//! // set the device component select mode to PRESENTATION.
//! print!("{}", control_sequences::SM(vec![modes::DCSM]));
//! // set the device component select mode to DATA.
//! print!("{}", control_sequences::RM(vec![modes::Mode::DeviceComponentSelectMode]));
//! ```
//!
//! ### Setting or Resetting Modes
//!
//! You can invoke the set and reset functions of a mode instead.
//!
//! ```
//! use ansi_control_codes::modes;
//!
//! // set the device component select mode to PRESENTATION.
//! print!("{}", modes::DCSM.set());
//! // set the device component select mode to DATA.
//! print!("{}", modes::Mode::DeviceComponentSelectMode.reset());
//! ```
//!
//! [ecma-48]: https://www.ecma-international.org/publications-and-standards/standards/ecma-48/

use crate::ControlFunction;

/// Device Modes.
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum Mode {
    /// Guarded Area Transfer Mode `GATM`.
    ///
    /// ## Reset: Guard
    ///
    /// Only the contents of unguarded areas in an eligible area are transmitted or transferred.
    ///
    /// ## Set: All
    ///
    /// The contents of guarded as well as of unguarded areas in an eligible area are transmitted or transferred.
    ///
    /// ## Note
    ///
    /// No control functions are affected.
    GuardedAreaTransferMode = 1,

    /// Keyboard Action Mode `KAM`.
    ///
    /// ## Reset: Enabled
    ///
    /// All or part of the manual input facilities are enabled to be used.
    ///
    /// ## Set: Disabled
    ///
    /// All or part of the manual input facilities are disabled.
    ///
    /// ## Note
    ///
    /// No control functions are affected.
    KeyboardActionMode,

    /// Control Presentation Mode `CRM`.
    ///
    /// ## Reset: Control
    ///
    /// All control functions are performed as defined; the way formator functions are processed depends on the setting
    /// of the FORMAT EFFECTOR ACTION MODE ([`FEAM`]). A device may choose to image the graphical representations of
    /// control functions in addition to performing them.
    ///
    /// ## Set: Graphic
    ///
    /// All control functions, except RESET MODE ([`RM`]), are treated as graphic characters. A device may choose to
    /// perform some control functions in addition to storing them and imaging their graphical representations.
    ControlPresentationMode,

    /// Insertion Replacement Mode `IRM`.
    ///
    /// ## Reset: Replace
    ///
    /// The graphic symbol of a graphic character or of a control function, for which a graphical representation is
    /// required, replaces (or, depending upon the implementation, is combined with) the graphic symbol imaged at the
    /// active presentation position.
    ///
    /// ## Set: Insert
    ///
    /// The graphic symbol of a graphic character or of a control function, for which a graphical representation is
    /// required, is inserted at the active presentation position.
    ///
    /// ## Note
    ///
    /// Only control functions for which a graphical representation is required are affected.
    InsertionReplacementMode,

    /// Status Report Transfer Mode `SRTM`.
    ///
    /// ## Reset: Normal
    ///
    /// Status reports in the form of DEVICE CONTROL STRINGs ([`DCS`][crate::c1::DCS]) are not generated automatically.
    ///
    /// ## Set: Diagnostic
    ///
    /// Status reports in the form of DEVICE CONTROL STRINGs ([`DCS`][crate::c1::DCS]) are included in every data stream
    /// transmitted or transferred.
    ///
    /// ## Note:
    ///
    /// No control functions are affected.
    StatusReportTransferMode,

    /// Erasure Mode `ERM`.
    ///
    /// ## Reset: Protect
    ///
    /// Only the contents of unprotected areas are affected by an erasure control function.
    ///
    /// ## Set: All
    ///
    /// The contents of protected as well as of unprotected areas are affected by an erasure control function.
    ///
    /// ## Note
    ///
    /// Control functions affected are: [`EA`][crate::control_sequences::EA], [`ECH`][crate::control_sequences::ECH],
    /// [`ED`][crate::control_sequences::ED], [`EF`][crate::control_sequences::EF],
    /// [`EL`][crate::control_sequences::EL].
    ErasureMode,

    /// Line Editing Mode `VEM`.
    ///
    /// ## Reset: Following
    ///
    /// If the DEVICE COMPONENT SELECT MODE ([`DCSM`]) is set to PRESENTATION, a line insertion causes the contents of
    /// the active line (the line that contains the active presentation position) and of the following lines in the
    /// presentation component to be shifted in the direction of the line progression; a line deletion causes the
    /// contents of the lines following the active line to be shifted in the direction opposite to that of the line
    /// progression.
    ///
    /// If the DEVICE COMPONENT SELECT MODE ([`DCSM`]) is set to DATA, a line insertion causes the contents of the
    /// active line (the line that contains the active data position) and of the following lines in the data component
    /// to be shifted in the direction of the line progression; a line deletion causes the contents of the lines
    /// following the active line to be shifted in the direction opposite to that of the line progression.
    ///
    /// ## Set: Preceding
    ///
    /// If the DEVICE COMPONENT SELECT MODE ([`DCSM`]) is set to PRESENTATION, a line insertion causes the contents of
    /// the active line (the line that contains the active presentation position) and of the preceding lines to be
    /// shifted in the direction opposite to that of the line progression; a line deletion causes the contents of the
    /// lines preceding the active line to be shifted in the direction of the line progression.
    ///
    /// If the DEVICE COMPONENT SELECT MODE ([`DCSM`]) is set to DATA, a line insertion causes the contents of the
    /// active line (the line that contains the active data position) and of the preceding lines to be shifted in the
    /// direction opposite to that of the line progression; a line deletion causes the contents of the lines preceding
    /// the active line to be shifted in the direction of the line progression.
    ///
    /// ## Note
    ///
    /// Control functions affected are: [`DL`][crate::control_sequences::DL], [`IL`][crate::control_sequences::IL].
    LineEditingMode,

    /// Bi-directional support mode `BDSM`.
    ///
    /// ## Reset: Explicit
    ///
    /// Control functions are performed in the data component or in the presentation component, depending on the setting
    /// of the DEVICE COMPONENT SELECT MODE ([`DeviceComponentSelectMode`][Mode::DeviceComponentSelectMode]).
    ///
    /// ## Set: Implicit
    ///
    /// Control functions are performed in the data component. All bi-directional aspects of data are handled by the
    /// device itself.
    BiDirectionalSupportMode,

    /// Device Component Select Mode `DCSM`.
    ///
    /// ## Reset: Presentation
    ///
    /// Certain control functions are performed in the presentation component. The active presentation position (or the
    /// active line, where applicable) in the presentation component is the reference position against which the
    /// relevant control functions are performed.
    ///
    /// ## Set: Data
    ///
    /// Certain control functions are performed in the data component. The active data position (or the active line,
    /// where applicable) in the data component is the reference position against which the relevant control functions
    /// are performed.
    ///
    /// ## Note
    ///
    /// Control functions affected are: [`CPR`][crate::control_sequences::CPR], [`CR`][crate::c0::CR],
    /// [`DCH`][crate::control_sequences::DCH], [`DL`][crate::control_sequences::DL],
    /// [`EA`][crate::control_sequences::EA], [`ECH`][crate::control_sequences::ECH],
    /// [`ED`][crate::control_sequences::ED], [`EF`][crate::control_sequences::EF],
    /// [`EL`][crate::control_sequences::EF], [`ICH`][crate::control_sequences::ICH],
    /// [`IL`][crate::control_sequences::IL], [`LF`][crate::c0::LF], [`NEL`][crate::c1::NEL], [`RI`][crate::c1::RI],
    /// [`SLH`][crate::control_sequences::SLH], [`SLL`][crate::control_sequences::SLL],
    /// [`SPH`][crate::control_sequences::SPH], [`SPL`][crate::control_sequences::SPH].
    DeviceComponentSelectMode,

    /// Character Editing Mode `HEM`.
    ///
    /// ## Reset: Following
    ///
    /// If the DEVICE COMPONENT SELECT MODE ([`DCSM`]) is set to PRESENTATION, a character insertion causes the contents
    /// of the active presentation position and of the following character positions in the presentation component to be
    /// shifted in the direction of the character path; a character deletion causes the contents of the character
    /// positions following the active presentation position to be shifted in the direction opposite to that of the
    /// character path
    ///
    /// If the DEVICE COMPONENT SELECT MODE ([`DCSM`]) is set to DATA, a character insertion causes the contents of the
    /// active data position and of the following character positions in the data component to be shifted in the
    /// direction of the character progression; a character deletion causes the contents of the character positions
    /// following the active data position to be shifted in the direction opposite to that of the character progression.
    ///
    /// ## Set: Preceding
    ///
    /// If the DEVICE COMPONENT SELECT MODE ([`DCSM`]) is set to PRESENTATION, a character insertion causes the contents
    /// of the active presentation position and of the following character positions in the presentation component to be
    /// shifted in the direction opposite to that of the character path; a character deletion causes the contents of the
    /// character positions following the active presentation position to be shifted in the direction of the character
    /// path.
    ///
    /// If the DEVICE COMPONENT SELECT MODE ([`DCSM`]) is set to DATA, a character insertion causes the contents of the
    /// active data position and of preceding character positions in the data component to be shifted in the direction
    /// opposite to that of the character progression; a character deletion causes the contents of the character
    /// positions preceding the active data position to be shifted in the direction of the character progression.
    ///
    /// ## Note
    ///
    /// Control functions affected are: [`DCH`][crate::control_sequences::DCH], [`ICH`][crate::control_sequences::ICH].
    CharacterEditingMode,

    /// Positioning Unit Mode `PUM`.
    ///
    /// ## Reset: Character
    ///
    /// The unit for numeric parameters of the positioning format effectors is one character position.
    ///
    /// ## Set: Size
    ///
    /// The unit for numeric parameters of the positioning format effectors is that established by the parameter value
    /// of SELECT SIZE UNIT ([`SSU`][crate::control_sequences::SSU]).
    ///
    /// ## Note 1
    ///
    /// Control functions affected are: [`CUB`][crate::control_sequences::CUB], [`CUD`][crate::control_sequences::CUD],
    /// [`CUF`][crate::control_sequences::CUF], [`CUU`][crate::control_sequences::CUU],
    /// [`HPA`][crate::control_sequences::HPA], [`HPB`][crate::control_sequences::HPB],
    /// [`HPR`][crate::control_sequences::HPR], [`HVP`][crate::control_sequences::HVP],
    /// [`SLH`][crate::control_sequences::SLH], [`SLL`][crate::control_sequences::SLL],
    /// [`SSU`][crate::control_sequences::SSU], [`VPA`][crate::control_sequences::VPA],
    /// [`VPB`][crate::control_sequences::VPB], [`VPR`][crate::control_sequences::VPR].
    ///
    /// ## Note 2
    ///
    /// As the default parameter value of the control function SELECT SIZE UNIT (SSU) is CHARACTER, this mode is
    /// redundant and should no longer be used.
    ///
    /// # Note 3
    ///
    /// The use of the POSITIONING UNIT MODE ([`PUM`]) is deprecated.
    PositioningUnitMode,

    /// Send/Receive Mode `SRM`.
    ///
    /// ## Reset: Monitor
    ///
    /// Data which are locally entered are immediately imaged.
    ///
    /// ## Set: Simultaneous
    ///
    /// Local input facilities are logically disconnected from the output mechanism; only data which are sent to the
    /// device are imaged.
    ///
    /// ## Note
    ///
    /// No control functions are affected.
    SendReceiveMode,

    /// Format Effector Action Mode `FEAM`.
    ///
    /// ## Reset: Execute
    ///
    /// Formator functions are performed immediately and may be stored in addition to being performed.
    ///
    /// ## Set: Store
    ///
    /// Formator functions are stored but not performed. In this case, the specified action is intended to be performed
    /// by another device when the associated data are transmitted or transferred.
    ///
    /// ## Note
    ///
    /// Control functions affected are: [`BPH`][crate::c1::BPH], [`BS`][crate::c0::BS], [`CR`][crate::c0::CR],
    /// [`DTA`][crate::control_sequences::DTA], [`FF`][crate::c0::FF], [`FNT`][crate::control_sequences::FNT],
    /// [`GCC`][crate::control_sequences::GCC], [`GSM`][crate::control_sequences::GSM],
    /// [`GSS`][crate::control_sequences::GSS], [`HPA`][crate::control_sequences::HPA],
    /// [`HPB`][crate::control_sequences::HPB], [`HPR`][crate::control_sequences::HPR],
    /// [`HT`][crate::c0::HT], [`HTJ`][crate::c1::HTJ], [`HTS`][crate::c1::HTS], [`HVP`][crate::control_sequences::HVP],
    /// [`JFY`][crate::control_sequences::JFY], [`NEL`][crate::c1::NEL], [`PEC`][crate::control_sequences::PEC],
    /// [`PFS`][crate::control_sequences::PFS], [`PLD`][crate::c1::PLD], [`PLU`][crate::c1::PLU],
    /// [`PPA`][crate::control_sequences::PPA], [`PPB`][crate::control_sequences::PPB],
    /// [`PPR`][crate::control_sequences::PPR], [`PTX`][crate::control_sequences::PTX],
    /// [`QUAD`][crate::control_sequences::QUAD], [`RI`][crate::c1::RI], [`SACS`][crate::control_sequences::SACS],
    /// [`SAPV`][crate::control_sequences::SAPV], [`SCO`][crate::control_sequences::SCO],
    /// [`SCS`][crate::control_sequences::SCS], [`SGR`][crate::control_sequences::SGR],
    /// [`SHS`][crate::control_sequences::SHS], [`SLH`][crate::control_sequences::SLH],
    /// [`SLL`][crate::control_sequences::SLL], [`SLS`][crate::control_sequences::SLS],
    /// [`SPD`][crate::control_sequences::SPD], [`SPI`][crate::control_sequences::SPI],
    /// [`SPQR`][crate::control_sequences::SPQR], [`SRCS`][crate::control_sequences::SRCS],
    /// [`SRS`][crate::control_sequences::SRS], [`SSU`][crate::control_sequences::SSU],
    /// [`SSW`][crate::control_sequences::SSW], [`STAB`][crate::control_sequences::STAB],
    /// [`SVS`][crate::control_sequences::SVS], [`TAC`][crate::control_sequences::TAC],
    /// [`TALE`][crate::control_sequences::TALE], [`TATE`][crate::control_sequences::TATE],
    /// [`TBC`][crate::control_sequences::TBC], [`TCC`][crate::control_sequences::TCC],
    /// [`TSS`][crate::control_sequences::TSS], [`VPA`][crate::control_sequences::VPA],
    /// [`VPB`][crate::control_sequences::VPB], [`VPR`][crate::control_sequences::VPR],
    /// [`VTS`][crate::c1::VTS].
    FormatEffectorActionMode,

    /// Format Effector Transfer Mode `FETM`.
    ///
    /// ## Reset: Insert
    ///
    /// Formator functions may be inserted in a data stream to be transmitted or in data to be transferred to an
    /// auxiliary input/output device.
    ///
    /// ## Set: Exclude
    ///
    /// No formator functions other than those received while the FORMAT EFFECTOR ACTION MODE [`FEAM`] is set to
    /// STORE are included in a transmitted data stream or in data transferred to an auxiliary input/output device.
    ///
    /// ## Note
    ///
    /// No control functions are affected.
    FormatEffectorTransferMode,

    /// Multiple Area Transfer Mode `MATM`.
    ///
    /// ## Reset: Single
    ///
    /// Only the contents of the selected area which contains the active presentation position are eligible to be
    /// transmitted or transferred
    ///
    /// ## Set: Multiple
    ///
    /// The contents of all selected areas are eligible to be transmitted or transferred.
    ///
    /// ## Note
    ///
    /// No control functions are affected.
    MultipleAreaTransferMode,

    /// Transfer Termination Mode `TTM`.
    ///
    /// ## Reset: Cursor
    ///
    /// Only the contents of the character positions preceding the active presentation position in the presentation
    /// component are eligible to be transmitted or transferred.
    ///
    /// ## Set: All
    ///
    /// The contents of character positions preceding, following, and at the active presentation position are eligible
    /// to be transmitted or transferred.
    ///
    /// ## Note
    ///
    /// No control functions are affected.
    TransferTerminationMode,

    /// Selected Area Transfer Mode `SATM`.
    ///
    /// ## Reset: Select
    ///
    /// Only the contents of selected areas are eligible to be transmitted or transferred.
    ///
    /// ## Set: All
    ///
    /// The contents of all character positions, irrespective of any explicitly defined selected areas, are eligible to
    /// be transmitted or transferred.
    ///
    /// ## Note
    ///
    /// No control functions are affected.
    SelectedAreaTransferMode,

    /// Tabulation Stop Mode `TSM`.
    ///
    /// ## Reset: Multiple
    ///
    /// Character tabulation stops in the presentation component are set or cleared in the active line (the line that
    /// contains the active presentation position) and in the corresponding character positions of the preceding lines
    /// and of the following lines.
    ///
    /// ## Set: Single
    ///
    /// Character tabulation stops in the presentation component are set or cleared in the active line only.
    ///
    /// ## Note
    ///
    /// Control functions affected are: [`CTC`][crate::control_sequences::CTC], [`DL`][crate::control_sequences::DL],
    /// [`HTS`][crate::c1::HTS], [`IL`][crate::control_sequences::IL], [`TBC`][crate::control_sequences::TBC].
    TabulationStopMode,

    /// Graphic Rendition Combination Mode `GRCM`.
    ///
    /// ## Reset: Replacing
    ///
    /// Each occurrence of the control function SELECT GRAPHIC RENDITION ([`SGR`][crate::control_sequences::SGR])
    /// cancels the effect of any preceding occurrence. Any graphic rendition aspects that are to remain unchanged after
    /// an occurrence of [`SGR`][crate::control_sequences::SGR] have to be re-specified by that
    /// [`SGR`][crate::control_sequences::SGR].
    ///
    /// ## Set: Cumulative
    ///
    /// Each occurrence of the control function SELECT GRAPHIC RENDITION ([`SGR`][crate::control_sequences::SGR]) causes
    /// only those graphic rendition aspects to be changed that are specified by that
    /// [`SGR`][crate::control_sequences::SGR]. All other graphic rendition aspects remain unchanged.
    ///
    /// ## Note
    ///
    /// Control function affected is [`SGR`][crate::control_sequences::SGR].
    GraphicRenditionCombinationMode = 21,

    /// Zero Default Mode `ZDM`.
    ///
    /// ## Reset: Zero
    ///
    /// A parameter value of 0 of a control function means the number `0`.
    ///
    /// ## Set: Default
    ///
    /// A parameter value of `0` represents a default parameter value which may be different from `0`.
    ///
    /// ## Note 1
    ///
    /// This mode was provided for implementations of the first edition of this Standard which specified that "an empty
    /// parameter sub-string or a parameter sub-string which consists of bit combinations `03/00` only represents a
    /// default value which depends on the control function".
    ///
    /// For numeric parameters which are expressed in units established by the parameter value of SELECT SIZE UNIT
    /// ([`SSU`][crate::control_sequences::SSU]) the value `0` could then be specified. For numeric parameters which are
    /// effectively repeat counts, a `0` parameter value corresponded to a "no-op". In either instance, non-negative
    /// computed numeric parameter values might have been used without treating `0` as a special (unusable) case.
    ///
    /// Where an explicit parameter value was not used, implementors were urged to omit a parameter value (use an empty
    /// parameter sub-string) to imply a default parameter value.
    ///
    /// Control functions affected are: [`CBT`][crate::control_sequences::CBT], [`CHA`][crate::control_sequences::CHA],
    /// [`CHT`][crate::control_sequences::CHT], [`CNL`][crate::control_sequences::CNL],
    /// [`CPL`][crate::control_sequences::CPL], [`CPR`][crate::control_sequences::CPR],
    /// [`CUB`][crate::control_sequences::CUB], [`CUD`][crate::control_sequences::CUD],
    /// [`CUF`][crate::control_sequences::CUF], [`CUP`][crate::control_sequences::CUP],
    /// [`CUU`][crate::control_sequences::CUU], [`CVT`][crate::control_sequences::CVT],
    /// [`DCH`][crate::control_sequences::DCH], [`DL`][crate::control_sequences::DL],
    /// [`ECH`][crate::control_sequences::ECH], [`GSM`][crate::control_sequences::GSM],
    /// [`HPA`][crate::control_sequences::HPA], [`HPB`][crate::control_sequences::HPB],
    /// [`HPR`][crate::control_sequences::HPR], [`HVP`][crate::control_sequences::HVP],
    /// [`ICH`][crate::control_sequences::ICH], [`IL`][crate::control_sequences::IL],
    /// [`NP`][crate::control_sequences::NP], [`PP`][crate::control_sequences::PP],
    /// [`PPA`][crate::control_sequences::PPA], [`PPB`][crate::control_sequences::PPB],
    /// [`PPR`][crate::control_sequences::PPR], [`REP`][crate::control_sequences::REP],
    /// [`SD`][crate::control_sequences::SD], [`SL`][crate::control_sequences::SL],
    /// [`SR`][crate::control_sequences::SR], [`SU`][crate::control_sequences::SU],
    /// [`TCC`][crate::control_sequences::TCC], [`VPA`][crate::control_sequences::VPA],
    /// [`VPB`][crate::control_sequences::VPB], [`VPR`][crate::control_sequences::VPR].
    ///
    /// ## Note 2
    ///
    /// Since the publication of the first edition of this Standard in 1976 almost 15 years have expired. The use of
    /// this mode should no longer be required because the definition of default parameter values has been changed.
    ///
    /// # Note 3
    ///
    /// The use of the ZERO DEFAULT MODE ([`ZDM`]) is deprecated.
    ZeroDefaultMode,
}

use crate::control_sequences::{RM, SM};
impl Mode {
    /// Set the mode.
    pub fn set(self) -> ControlFunction {
        SM(vec![self])
    }

    /// Reset the mode.
    pub fn reset(self) -> ControlFunction {
        RM(vec![self])
    }
}

/// Guarded Area Transfer Mode `GATM`.
///
/// See [`Mode::GuardedAreaTransferMode`].
pub const GATM: Mode = Mode::GuardedAreaTransferMode;

/// Keyboard Action Mode `KAM`.
///
/// See [`Mode::KeyboardActionMode`].
pub const KAM: Mode = Mode::KeyboardActionMode;

/// Control Presentation Mode `CRM`.
///
/// See [`Mode::ControlPresentationMode`].
pub const CRM: Mode = Mode::ControlPresentationMode;

/// Insertion Replacement Mode `IRM`.
///
/// See [`Mode::InsertionReplacementMode`].
pub const IRM: Mode = Mode::InsertionReplacementMode;

/// Status Report Transfer Mode `SRTM`.
///
/// See [`Mode::StatusReportTransferMode`].
pub const SRTM: Mode = Mode::StatusReportTransferMode;

/// Erasure Mode `ERM`.
///
/// See [`Mode::ErasureMode`].
pub const ERM: Mode = Mode::ErasureMode;

/// Line Editing Mode `VEM`.
///
/// See [`Mode::LineEditingMode`].
pub const VEM: Mode = Mode::LineEditingMode;

/// Bi-directional support mode `BDSM`.
///
/// See [`Mode::BiDirectionalSupportMode`].
pub const BDSM: Mode = Mode::BiDirectionalSupportMode;

/// Device Component Select Mode `DCSM`.
///
/// See [`Mode::DeviceComponentSelectMode`].
pub const DCSM: Mode = Mode::DeviceComponentSelectMode;

/// Character Editing Mode `HEM`.
///
/// See [`Mode::CharacterEditingMode`].
pub const HEM: Mode = Mode::CharacterEditingMode;

/// Positioning Unit Mode `PUM`.
///
/// See [`Mode::PositioningUnitMode`].
pub const PUM: Mode = Mode::PositioningUnitMode;

/// Send/Receive Mode `SRM`.
///
/// See [`Mode::SendReceiveMode`].
pub const SRM: Mode = Mode::SendReceiveMode;

/// Format Effector Action Mode `FEAM`.
///
/// See [`Mode::FormatEffectorActionMode`].
pub const FEAM: Mode = Mode::FormatEffectorActionMode;

/// Format Effector Transfer Mode `FETM`.
///
/// See [`Mode::FormatEffectorTransferMode`].
pub const FETM: Mode = Mode::FormatEffectorTransferMode;

/// Multiple Area Transfer Mode `MATM`.
///
/// See [`Mode::MultipleAreaTransferMode`].
pub const MATM: Mode = Mode::MultipleAreaTransferMode;

/// Transfer Termination Mode `TTM`.
///
/// See [`Mode::TransferTerminationMode`].
pub const TTM: Mode = Mode::TransferTerminationMode;

/// Selected Area Transfer Mode `SATM`.
///
/// See [`Mode::SelectedAreaTransferMode`].
pub const SATM: Mode = Mode::SelectedAreaTransferMode;

/// Tabulation Stop Mode `TSM`.
///
/// See [`Mode::TabulationStopMode`].
pub const TSM: Mode = Mode::TabulationStopMode;

/// Graphic Rendition Combination Mode `GRCM`.
///
/// See [`Mode::GraphicRenditionCombinationMode`].
pub const GRCM: Mode = Mode::GraphicRenditionCombinationMode;

/// Zero Default Mode `ZDM`.
///
/// See [`Mode::ZeroDefaultMode`].
pub const ZDM: Mode = Mode::ZeroDefaultMode;