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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
//! Direct port of `Src/Zle/zle.h` — line-editor type / constant
//! header.
//!
//! Original C copyright: Paul Falstad 1992-1997.
//!
//! Hosts the type aliases (`Widget` / `Thingy` / `Keymap` /
//! `Cutbuffer` / etc.), enum / `#define` constants used across the
//! ZLE port, and the `struct widget` / `struct thingy` /
//! `struct modifier` / `struct change` / `struct vichange` /
//! `struct cutbuffer` / `struct brinfo` / `struct compldat` /
//! `struct region_highlight` / `struct watch_fd` / `REFRESH_ELEMENT`
//! shapes the C source uses.
//!
//! Multibyte note: zshrs uses native UTF-8 throughout, so the C
//! `#ifdef MULTIBYTE_SUPPORT` (zle.h:30-105) `wchar_t` types collapse
//! onto Rust `char` / `String`. The non-multibyte fallback (`char`
//! / `int`) is the parallel C path; the type aliases below pick
//! the shape that maps cleanly onto Rust.
use crate;
// =====================================================================
// Wide-character types — `Src/Zle/zle.h:30-110`.
// =====================================================================
//
// C dispatches between `wchar_t` (MULTIBYTE_SUPPORT, zle.h:30-104)
// and `char` (non-multibyte, zle.h:105-181). Rust uses `char` for
// code-points and `String` for owned text — those primitives cover
// both C paths.
/// Port of `ZLE_CHAR_T` from zle.h:31 / zle.h:107.
// --- AUTO: cross-zle hoisted-fn use glob ---
// (was: use crate::ported::zle::widget::*; — widget.rs deleted)
use crate*;
use crate*;
use crate*;
use crate*;
use crate*;
use crate*;
use crate*;
use crate*;
use crate*;
use crate*;
use crate*;
use crate*;
pub type ZLE_CHAR_T = char; // c:31
/// Port of `ZLE_STRING_T` from zle.h:32 / zle.h:108.
pub type ZLE_STRING_T = String; // c:32
/// Port of `ZLE_INT_T` from zle.h:33 / zle.h:109.
pub type ZLE_INT_T = i32; // c:33
/// Port of `ZLE_CHAR_SIZE` from zle.h:34. Rust `char` is always 4
/// bytes (USVs); the C `wchar_t` is 4 on every supported host.
pub const ZLE_CHAR_SIZE: usize = 4; // c:34
/// Port of `ZLEEOF` from zle.h:37 / zle.h:112.
pub const ZLEEOF: i32 = -1; // c:37 WEOF
/// Port of `Th(X)` macro from zle.h:316. `#define Th(X) (&thingies[X])`.
/// Resolves a fixed-thingy index into its Thingy reference.
///
/// In C, `thingies[]` is auto-generated by `mkbltnmlst.sh` from the
/// `mod_export Thingy` declarations sprinkled across `zle.h`/`zle_*.c`.
/// Each `t_<name>` constant indexes one slot. zshrs hasn't ported
/// that build-time auto-gen, so this helper uses the manually-kept
/// index→name table in `T_THINGY_NAMES` below and forwards to
/// `lookup_thingy(name)` — same observable contract as the C macro.
/// Fixed-thingy index table. Order matches the `mod_export Thingy
/// t_<name>` declaration order in `Src/Zle/zle.h` so callers can use
/// `Th(t_acceptline as i32)` exactly as they would in C. Add new
/// entries here when `t_<name>` constants get back-ported; the
/// indices are stable per zsh ABI.
pub const T_THINGY_NAMES: & = &;
/// Port of `invicmdmode()` macro from zle.h:324.
/// `#define invicmdmode() (!strcmp(curkeymapname, "vicmd"))`.
/// True when the current keymap is the vi command-mode keymap.
/// The Rust `in_vi_cmd_mode()` free fn (zle_main.rs:815) is the
/// state-bound counterpart; this free-fn uses the global keymap name.
// =====================================================================
// `ZS_*` wide-string macros — `Src/Zle/zle.h:40-51`.
// C #defines route to wmemcpy/wcslen/etc. on MULTIBYTE_SUPPORT builds
// and to the memcpy/strlen counterparts otherwise. Rust uses `char` /
// `[char]` directly so each macro maps to a slice operation.
// =====================================================================
/// Port of `ZS_memcpy` from zle.h:40 (`#define ZS_memcpy wmemcpy`).
/// Copies `n` chars from `src` into `dst`.
/// Port of `ZS_memmove` from zle.h:41 (`#define ZS_memmove wmemmove`).
/// Same as ZS_memcpy but tolerates overlapping ranges (vec move
/// semantics handle overlap).
/// Port of `ZS_memset` from zle.h:42 (`#define ZS_memset wmemset`).
/// Fills `dst[..n]` with `c`.
/// Port of `ZS_memcmp` from zle.h:43 (`#define ZS_memcmp wmemcmp`).
/// Returns Ordering of the first `n` chars.
/// Port of `ZS_strlen` from zle.h:44 (`#define ZS_strlen wcslen`).
/// Returns the length to the first NUL char (or full slice length
/// if no NUL found).
/// Port of `ZS_strcpy` from zle.h:45 (`#define ZS_strcpy wcscpy`).
/// Copies `src` (up to first NUL or end) into `dst`, NUL-terminates
/// when there's room.
/// Port of `ZS_strncpy` from zle.h:46 (`#define ZS_strncpy wcsncpy`).
/// Copies up to `n` chars; pads remainder with NUL if `src` is shorter.
/// Port of `ZS_strncmp` from zle.h:47 (`#define ZS_strncmp wcsncmp`).
/// Returns Ordering of up to `n` chars (stops at NUL).
/// Port of `ZS_strchr` from zle.h:50 (`#define ZS_strchr wcschr`).
/// Returns the index of the first occurrence of `c` in `s`, or `None`.
/// Port of `ZS_memchr` from zle.h:51 (`#define ZS_memchr wmemchr`).
/// Returns the index of the first occurrence of `c` in `s[..n]`.
/// Port of `ZS_width` from zle.h:49 (`#define ZS_width wcslen`).
/// Returns the display width of a string (collapses to char count
/// for the non-multibyte path; in zshrs we treat each char as 1 col).
// =====================================================================
// `ZC_*` wide-character classification macros — `Src/Zle/zle.h:60-73`.
// C #defines route to `iswalpha`/`iswalnum`/etc. on MULTIBYTE_SUPPORT
// builds and to the `<ctype.h>` counterparts otherwise. Rust's
// `char::is_*` methods cover both paths uniformly.
// =====================================================================
/// Port of `ZC_ialpha` from zle.h:60.
// c:60
/// Port of `ZC_ialnum` from zle.h:61.
// c:61
/// Port of `ZC_iblank` from zle.h:62 (`wcsiblank`). True for blank
/// chars excluding newline (matches zsh's `iblank` predicate).
// c:62
/// Port of `ZC_icntrl` from zle.h:63.
// c:63
/// Port of `ZC_idigit` from zle.h:64.
// c:64
/// Port of `ZC_iident` from zle.h:65 (`wcsitype(c, IIDENT)`). Identifier
/// char per zsh's IIDENT class: alphanumeric or `_`.
// c:65
/// Port of `ZC_ilower` from zle.h:66.
// c:66
/// Port of `ZC_inblank` from zle.h:67 (`iswspace`). True for any
/// whitespace char (incl. newline).
// c:67
/// Port of `ZC_iupper` from zle.h:68.
// c:68
/// Port of `ZC_iword` from zle.h:69 (`wcsitype(c, IWORD)`). Word
/// char per zsh's IWORD class: alphanumeric or `_`.
// c:69
/// Port of `ZC_ipunct` from zle.h:70.
// c:70
/// Port of `ZC_tolower` from zle.h:72.
/// Port of `ZC_toupper` from zle.h:73.
// =====================================================================
// `LASTFULLCHAR` — `Src/Zle/zle.h:75-76`. Macro alias resolving to
// `lastchar_wide` (the most-recent fully-decoded codepoint). Lives
// as a field on `Zle` (`lastchar_wide: ZleInt`); the macro name is
// kept here as an alias for searchability.
// =====================================================================
// =====================================================================
// Widget — `Src/Zle/zle.h:184-220`.
// =====================================================================
/// Port of `typedef struct widget *Widget` from zle.h:184.
pub type WidgetPtr = ; // c:184
/// Port of `typedef struct thingy *Thingy` from zle.h:185.
pub type ThingyPtr = ; // c:185
/// Port of `ZleIntFunc` from zle.h:189. C: `int (*)(char **)` —
/// every internal widget conforms to this signature.
pub type ZleIntFunc = fn ; // c:189
/// Port of `struct widget` from `Src/Zle/zle.h:191-203`.
/// ```c
/// struct widget {
/// int flags; /* WIDGET_* / ZLE_* flag bitset */
/// Thingy first; /* `first` thingy that names this widget */
/// union {
/// ZleIntFunc fn; /* internal widget */
/// char *fnnam; /* shell-function name for user-defined */
/// struct { ZleIntFunc fn; char *wid; char *func; } comp;
/// } u;
/// };
/// ```
// Legacy aliases preserved for back-compat with files that historically
// imported `Widget` / `WidgetFunc` (PascalCase) from the deleted
// `widget.rs` shim. New code should use `widget` / `WidgetImpl`
// directly.
pub use WidgetImpl as WidgetFunc;
pub type Widget = widget;
/// Tagged port of the `widget.u` union from `Src/Zle/zle.h:194-202`.
/// C uses an inline anonymous union; Rust enum tags the active
/// variant.
// Widget flags — `Src/Zle/zle.h:205-220`.
pub const WIDGET_INT: i32 = 1 << 0; /* widget is internally implemented */ // c:205
pub const WIDGET_NCOMP: i32 = 1 << 1; /* new style completion widget */ // c:206
pub const ZLE_MENUCMP: i32 = 1 << 2; /* DON'T invalidate completion list */ // c:207
pub const ZLE_YANKAFTER: i32 = 1 << 3; // c:208
pub const ZLE_YANKBEFORE:i32 = 1 << 4; // c:209
pub const ZLE_YANK: i32 = ZLE_YANKAFTER | ZLE_YANKBEFORE; // c:210
pub const ZLE_LINEMOVE: i32 = 1 << 5; /* line-oriented movement */ // c:211
pub const ZLE_VIOPER: i32 = 1 << 6; /* widget reads further keys so wait if prefix */ // c:212
pub const ZLE_LASTCOL: i32 = 1 << 7; /* command maintains lastcol correctly */ // c:213
pub const ZLE_KILL: i32 = 1 << 8; // c:214
pub const ZLE_KEEPSUFFIX:i32 = 1 << 9; /* DON'T remove added suffix */ // c:215
pub const ZLE_NOTCOMMAND:i32 = 1 << 10; /* widget should not alter lastcmd */ // c:216
pub const ZLE_ISCOMP: i32 = 1 << 11; /* usable for new style completion */ // c:217
pub const WIDGET_INUSE: i32 = 1 << 12; /* widget is in use */ // c:218
pub const WIDGET_FREE: i32 = 1 << 13; /* request to free when no longer in use */ // c:219
pub const ZLE_NOLAST: i32 = 1 << 14; /* widget should not alter lbindk */ // c:220
// =====================================================================
// Thingy — `Src/Zle/zle.h:224-235`.
// =====================================================================
/// Port of `struct thingy` from `Src/Zle/zle.h:224-231`. HashNode
/// subtype keyed by name; circular list (`samew`) of all thingies
/// pointing at the same widget.
/// `DISABLED` is `(1<<0)` (generic hashnode flag — defined in zsh.h).
/// `TH_IMMORTAL` from zle.h:234 — can't refer to a different widget.
pub const TH_IMMORTAL: i32 = 1 << 1; // c:234
// =====================================================================
// Modifier — `Src/Zle/zle.h:243-263`.
// =====================================================================
/// Port of `struct modifier` from `Src/Zle/zle.h:245-251`.
/// Command modifier prefix state (numeric arg, vi cut buffer, etc.).
pub const MOD_MULT: i32 = 1 << 0; /* a repeat count has been selected */ // c:253
pub const MOD_TMULT: i32 = 1 << 1; /* a repeat count is being entered */ // c:254
pub const MOD_VIBUF: i32 = 1 << 2; /* a vi cut buffer has been selected */ // c:255
pub const MOD_VIAPP: i32 = 1 << 3; /* appending to the vi cut buffer */ // c:256
pub const MOD_NEG: i32 = 1 << 4; /* last command was negate argument */ // c:257
pub const MOD_NULL: i32 = 1 << 5; /* throw away text for the vi cut buffer */ // c:258
pub const MOD_CHAR: i32 = 1 << 6; /* force character-wise movement */ // c:259
pub const MOD_LINE: i32 = 1 << 7; /* force line-wise movement */ // c:260
pub const MOD_PRI: i32 = 1 << 8; /* OS primary selection for the vi cut buffer */ // c:261
pub const MOD_CLIP: i32 = 1 << 9; /* OS clipboard for the vi cut buffer */ // c:262
pub const MOD_OSSEL: i32 = MOD_PRI | MOD_CLIP; /* either system selection */ // c:263
// =====================================================================
// Cut-buffer flag bits — `Src/Zle/zle.h:271-280`.
// =====================================================================
pub const CUT_FRONT: i32 = 1 << 0; /* Text goes in front of cut buffer */ // c:271
pub const CUT_REPLACE: i32 = 1 << 1; /* Text replaces cut buffer */ // c:272
/// `CUT_RAW` (zle.h:273-279). Raw character counts (not used in
/// `cut` itself). This is used when the values are offsets into
/// the zleline array rather than numbers of visible characters
/// directly input by the user.
pub const CUT_RAW: i32 = 1 << 2; // c:273
pub const CUT_YANK: i32 = 1 << 3; /* vi yank: use register 0 instead of 1-9 */ // c:280
// =====================================================================
// Change (undo system) — `Src/Zle/zle.h:282-298`.
// =====================================================================
/// Port of `struct change` from `Src/Zle/zle.h:284-295`. The undo
/// log is a doubly-linked list of these entries.
pub const CH_NEXT: i32 = 1 << 0; /* next structure is also part of this change */ // c:297
pub const CH_PREV: i32 = 1 << 1; /* previous structure is also part of this change */ // c:298
// =====================================================================
// VI change — `Src/Zle/zle.h:300-313`.
// =====================================================================
/// Port of `struct vichange` from `Src/Zle/zle.h:308-312`. Stores
/// the byte sequence of a vi command for `.` (vi-repeat-change).
///
/// From zle.h:302-307: examination of the code suggests vichgbuf
/// is consistently tied to raw byte input, so it is left as a
/// character array rather than turned into wide characters. In
/// particular, when we replay it we use `ungetbytes()`.
// =====================================================================
// Keymap — `Src/Zle/zle.h:316-322`.
// =====================================================================
// `KeymapPtr` / `keymap_opaque` deleted — Rust-invented placeholder
// for the `typedef struct keymap *Keymap` opaque alias at zle.h:320.
// The real `Keymap` struct (full port of `struct keymap` at
// `zle_keymap.c:64`) lives in `zle_keymap.rs` and callers
// reference it directly via `Arc<Keymap>`.
/// Port of `KeyScanFunc` from zle.h:322.
/// C: `void (*KeyScanFunc) (char *, Thingy, char *, void *)`.
pub type KeyScanFunc = fn; // c:322
// =====================================================================
// Suffix removal — `Src/Zle/zle.h:326-333`.
// =====================================================================
/// Port of `NO_INSERT_CHAR` from zle.h:329 / zle.h:331.
pub const NO_INSERT_CHAR: i32 = 256; // c:331
/// Port of `removesuffix()` from zle.h:333.
/// C: `iremovesuffix(NO_INSERT_CHAR, 0)`.
// =====================================================================
// Cutbuffer — `Src/Zle/zle.h:335-352`.
// =====================================================================
/// Port of `struct cutbuffer` from `Src/Zle/zle.h:342-346`.
/// From zle.h:335-340: cut/kill buffer. The buffer itself is purely
/// binary data, not NUL-terminated. `len` is a character count
/// (N.B. number of characters, not size in bytes). `flags` uses the
/// CUTBUFFER_* constants defined below.
/// Port of `typedef struct cutbuffer *Cutbuffer` from zle.h:348.
pub type CutbufferPtr = ; // c:348
pub const CUTBUFFER_LINE: u8 = 1; /* for vi: buffer contains whole lines of data */ // c:350
pub const KRINGCTDEF: i32 = 8; /* default number of buffers in the kill ring */ // c:352
// =====================================================================
// Completion modes — `Src/Zle/zle.h:354-362`.
// =====================================================================
pub const COMP_COMPLETE: i32 = 0; // c:356
pub const COMP_LIST_COMPLETE: i32 = 1; // c:357
pub const COMP_SPELL: i32 = 2; // c:358
pub const COMP_EXPAND: i32 = 3; // c:359
pub const COMP_EXPAND_COMPLETE: i32 = 4; // c:360
pub const COMP_LIST_EXPAND: i32 = 5; // c:361
/// Port of `COMP_ISEXPAND(X)` from zle.h:362.
// c:362
// =====================================================================
// Brace runs (Brinfo) — `Src/Zle/zle.h:364-375`.
// =====================================================================
/// Port of `typedef struct brinfo *Brinfo` from zle.h:366.
pub type BrinfoPtr = ; // c:366
/// Port of `struct brinfo` from `Src/Zle/zle.h:368-375`.
/// One brace run during brace-expansion completion.
// =====================================================================
// Hook offsets — `Src/Zle/zle.h:377-402`.
// =====================================================================
pub const LISTMATCHESHOOK: i32 = 0; // c:379
pub const COMPLETEHOOK: i32 = 1; // c:380
pub const BEFORECOMPLETEHOOK: i32 = 2; // c:381
pub const AFTERCOMPLETEHOOK: i32 = 3; // c:382
pub const ACCEPTCOMPHOOK: i32 = 4; // c:383
pub const INVALIDATELISTHOOK: i32 = 5; // c:384
// =====================================================================
// Compldat — `Src/Zle/zle.h:386-394`.
// =====================================================================
/// Port of `typedef struct compldat *Compldat` from zle.h:388.
pub type CompldatPtr = ; // c:388
/// Port of `struct compldat` from `Src/Zle/zle.h:390-394`. Payload
/// passed to the COMPLETEHOOK callback.
/// Port of `listmatches()` from zle.h:398.
/// C: `runhookdef(LISTMATCHESHOOK, NULL)`.
/// Port of `invalidatelist()` from zle.h:402.
/// C: `runhookdef(INVALIDATELISTHOOK, NULL)`.
// =====================================================================
// setline flags — `Src/Zle/zle.h:404-408`.
// =====================================================================
pub const ZSL_COPY: i32 = 1; /* Copy the argument, don't modify it */ // c:406
pub const ZSL_TOEND: i32 = 2; /* Go to the end of the new line */ // c:407
// =====================================================================
// Suffix type / flags — `Src/Zle/zle.h:411-422`.
// =====================================================================
/// Port of `enum suffixtype` from zle.h:412 (type arguments to
/// `addsuffix()`).
pub const SUFTYP_POSSTR: i32 = 0; /* String of characters to match */ // c:413
pub const SUFTYP_NEGSTR: i32 = 1; /* String of characters not to match */ // c:414
pub const SUFTYP_POSRNG: i32 = 2; /* Range of characters to match */ // c:415
pub const SUFTYP_NEGRNG: i32 = 3; /* Range of characters not to match */ // c:416
/// Port of `enum suffixflags` from zle.h:420 (additional flags to
/// suffixes).
pub const SUFFLAGS_SPACE: i32 = 0x0001; /* Add a space when removing suffix */ // c:421
// =====================================================================
// Region highlight — `Src/Zle/zle.h:425-473`.
// =====================================================================
/// `ZRH_PREDISPLAY` — region offsets include predisplay text.
pub const ZRH_PREDISPLAY: i32 = 1; // c:428
/// Port of `struct region_highlight` from `Src/Zle/zle.h:435-461`.
/// Attributes used for highlighting regions and the mark.
/// Port of `N_SPECIAL_HIGHLIGHTS` from zle.h:473.
/// Count of special uses of region highlighting:
/// 0=region between point and mark, 1=isearch region, 2=suffix,
/// 3=pasted text.
pub const N_SPECIAL_HIGHLIGHTS: i32 = 4; // c:473
// =====================================================================
// Cursor context — `Src/Zle/zle.h:475-486`.
// =====================================================================
/// Port of `enum cursorcontext` from zle.h:476.
pub const CURC_EDIT: i32 = 0; // c:477
pub const CURC_COMMAND: i32 = 1; // c:478
pub const CURC_INSERT: i32 = 2; // c:479
pub const CURC_OVERWRITE: i32 = 3; // c:480
pub const CURC_PENDING: i32 = 4; // c:481
pub const CURC_REGION_START: i32 = 5; // c:482
pub const CURC_REGION_END: i32 = 6; // c:483
pub const CURC_VISUAL: i32 = 7; // c:484
pub const CURC_DEFAULT: i32 = 8; // c:485
// =====================================================================
// Cursor flag bits — `Src/Zle/zle.h:488-500`.
// =====================================================================
pub const CURF_DEFAULT: i32 = 0; // c:488
pub const CURF_UNDERLINE: i32 = 1; // c:489
pub const CURF_BAR: i32 = 2; // c:490
pub const CURF_BLOCK: i32 = 3; // c:491
pub const CURF_SHAPE_MASK: i32 = 3; // c:492
pub const CURF_BLINK: i32 = 1 << 2; // c:493
pub const CURF_STEADY: i32 = 1 << 3; // c:494
pub const CURF_HIDDEN: i32 = 1 << 4; // c:495
pub const CURF_COLOR: i32 = 1 << 5; // c:496
pub const CURF_COLOR_MASK: u32 = | ; // c:497
pub const CURF_RED_SHIFT: i32 = 24; // c:498
pub const CURF_GREEN_SHIFT: i32 = 16; // c:499
pub const CURF_BLUE_SHIFT: i32 = 8; // c:500
// =====================================================================
// Refresh element — `Src/Zle/zle.h:502-529`.
// =====================================================================
/// Port of `REFRESH_CHAR` from zle.h:507 (multibyte) / zle.h:509
/// (non-multibyte). Rust uses `char` since native UTF-8 covers both.
pub type REFRESH_CHAR = char; // c:507
/// Port of `REFRESH_ELEMENT` from `Src/Zle/zle.h:515-526`.
/// One character cell in the on-screen display buffer.
/// From zle.h:516-520: the (possibly wide) character. If `atr`
/// contains `TXT_MULTIWORD_MASK`, an index into the set of
/// multiword symbols (only if MULTIBYTE_SUPPORT is present).
/// Port of `REFRESH_STRING` from zle.h:529. A string of screen cells.
pub type REFRESH_STRING = ; // c:529
// =====================================================================
// ZSH_INVALID_WCHAR — `Src/Zle/zle.h:532-553`.
// =====================================================================
//
// From zle.h:533-539: with ISO 10646 there is a private range
// defined within the encoding. We use this for storing single-byte
// characters in sections of strings that wouldn't convert to wide
// characters. This allows to preserve the string when transformed
// back to multibyte strings.
/// `ZSH_INVALID_WCHAR_BASE` from zle.h:541. The start of the
/// private range we use, for 256 characters.
pub const ZSH_INVALID_WCHAR_BASE: u32 = 0xe000; // c:541
/// Port of `ZSH_INVALID_WCHAR_TEST(x)` from zle.h:544. Detect a
/// wide character within our range.
/// Port of `ZSH_INVALID_WCHAR_TO_CHAR(x)` from zle.h:548. Turn a
/// wide character in that range back to single byte.
/// Port of `ZSH_INVALID_WCHAR_TO_INT(x)` from zle.h:550. Turn a
/// wide character in that range to an integer.
/// Port of `ZSH_CHAR_TO_INVALID_WCHAR(x)` from zle.h:553. Turn a
/// single byte character into a private wide character.
// =====================================================================
// METACHECK — `Src/Zle/zle.h:560-567`.
// =====================================================================
//
// Debug-only assertion macros. Production builds collapse to no-op,
// matching the C `#ifdef DEBUG` paths.
/// Port of `METACHECK()` from zle.h:561.
/// C: `DPUTS(zlemetaline == NULL, "line not metafied")`.
/// Port of `UNMETACHECK()` from zle.h:563.
/// C: `DPUTS(zlemetaline != NULL, "line metafied")`.
// =====================================================================
// watch_fd — `Src/Zle/zle.h:570-578`.
// =====================================================================
/// Port of `typedef struct watch_fd *Watch_fd` from zle.h:570.
pub type WatchFdPtr = ; // c:570
/// Port of `struct watch_fd` from `Src/Zle/zle.h:572-578`.
/// One `zle -F` file-descriptor watcher.