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
//! ZLE - Zsh Line Editor
//!
//! Direct port from zsh/Src/Zle/*.c
//!
//! This module implements the full Zsh line editor with:
//! - Vi and Emacs editing modes
//! - Programmable keymaps
//! - Widgets (commands)
//! - Completion integration
//! - History navigation
//! - Multi-line editing
// Core ZLE types (old API for vm_helper compatibility)
// New comprehensive ZLE port from C
pub mod comp_h;
pub mod compcore;
pub mod compctl;
pub mod compctl_h;
pub mod complete;
pub mod complist;
pub mod compmatch;
pub mod compresult;
pub mod computil;
pub mod deltochar;
pub mod termquery;
pub mod textobjects;
pub mod zle_bindings;
pub mod zle_h;
pub mod zle_hist;
pub mod zle_keymap;
pub mod zle_main;
pub mod zle_misc;
pub mod zle_move;
pub mod zle_params;
pub mod zle_refresh;
pub mod zle_thingy;
pub mod zle_tricky;
pub mod zle_utils;
pub mod zle_vi;
pub mod zle_word;
pub mod zleparameter;
pub use zle_h::{widget, WidgetImpl};
pub use zle_keymap::Keymap;
pub use zle_thingy::Thingy;
#[cfg(test)]
mod tests {
use super::*;
/// Keymap default initialises with all 256 first[] slots as None
/// (the `t_undefinedkey` sentinel) and empty multi table. Verifies
/// the new() / Default::default() contract used by every newkeymap
/// + bindkey path — a regression breaking this would mean every
/// keymap starts with random state.
#[test]
fn empty_keymap_has_all_unbound_first_slots() {
let _g = crate::test_util::global_state_lock();
let km = zle_keymap::Keymap::default();
assert!(km.first.iter().all(|t| t.is_none()), "all 256 slots None");
assert!(km.multi.is_empty(), "no multi-byte bindings yet");
assert_eq!(km.flags, 0);
}
/// Thingy::new builds an immortal stub with rc=1 and no widget.
/// Verifies the calloc-equivalent baseline the rest of the thingy
/// pipeline (refthingy / unrefthingy) is allowed to assume.
#[test]
fn freshly_minted_thingy_has_rc_one_and_no_widget() {
let _g = crate::test_util::global_state_lock();
let t = zle_thingy::Thingy::new("test-widget");
assert_eq!(t.rc, 1);
assert!(t.widget.is_none());
assert_eq!(t.nam, "test-widget");
}
}