Skip to main content

rmux_core/
lib.rs

1#![forbid(unsafe_code)]
2#![deny(missing_docs)]
3
4//! Pure in-memory RMUX domain model state.
5//!
6//! This crate models sessions, windows, panes, layout geometry, and exact
7//! target resolution without any OS, network, or process integration.
8
9/// tmux-compatible message for invalid `-O` sort-order arguments.
10pub const INVALID_SORT_ORDER: &str = "invalid sort order";
11
12mod box_lines;
13mod buffers;
14/// Shared tmux-compatible `list-commands` inventory and renderer.
15pub mod command_inventory;
16pub mod command_parser;
17pub mod command_queue;
18mod dec_modes;
19mod environment;
20/// Bounded event buffers and cursor accounting.
21pub mod events;
22pub mod formats;
23mod glob;
24mod grid;
25mod hooks;
26mod hyperlinks;
27pub mod identity;
28/// tmux-compatible VT parser state machine, CSI/ESC/OSC dispatch, and SGR.
29pub mod input;
30mod keys;
31mod layout;
32mod lifecycle;
33mod options;
34mod pane;
35mod screen;
36mod session;
37pub mod style;
38mod target;
39mod target_find;
40mod terminal;
41mod terminal_passthrough;
42mod terminal_screen;
43mod terminal_sequences;
44pub mod tmux_precedence;
45mod transcript;
46mod utf8;
47mod vis;
48mod window;
49
50pub use box_lines::BoxLines;
51pub use buffers::{BufferStore, BufferView, RenameBufferOutcome, SetBufferOutcome};
52pub use dec_modes::{render_dec_modes, render_dec_modes_for_snapshot};
53pub use environment::{EnvironmentStore, ShowEnvironmentEntry, ENVIRON_HIDDEN};
54pub use formats::format_skip_delimiter;
55pub use grid::GridRenderOptions;
56pub use hooks::{
57    hook_explicit_scope_for_target, hook_global_root, hook_natural_scope_for_session_target,
58    hook_natural_scope_for_target, validate_hook_registration, validate_hook_scope,
59    HookBindingView, HookDispatch, HookGlobalRoot, HookScopeIdentity, HookSetOptions, HookStore,
60};
61pub use identity::{PaneId, SessionId, SessionName, WindowId};
62pub use input::{
63    colour_join_rgb, Colour, GridAttr, COLOUR_DEFAULT, COLOUR_FLAG_256, COLOUR_FLAG_RGB,
64    COLOUR_NONE, COLOUR_TERMINAL,
65};
66pub use keys::{
67    key_code_is_mouse_move, key_code_lookup_bits, key_code_to_bytes, key_string_lookup_key,
68    key_string_lookup_string, parse_binding_command_tokens,
69    parse_binding_command_tokens_with_parser, KeyBinding, KeyBindingDisplay, KeyBindingSortOrder,
70    KeyBindingStore, KeyBindingTable, KeyBindingTableRef, KeyCode, KEYC_ANY, KEYC_BSPACE,
71    KEYC_BUILD_MODIFIERS, KEYC_CTRL, KEYC_CURSOR, KEYC_DRAGGING, KEYC_IMPLIED_META, KEYC_KEYPAD,
72    KEYC_LITERAL, KEYC_MASK_FLAGS, KEYC_MASK_KEY, KEYC_MASK_MODIFIERS, KEYC_MASK_TYPE, KEYC_META,
73    KEYC_NONE, KEYC_SENT, KEYC_SHIFT, KEYC_UNKNOWN, KEYC_USER, KEYC_VI, LIST_KEYS_TEMPLATE,
74};
75pub use lifecycle::LifecycleEvent;
76pub use options::{
77    default_global_scope_for_option_name, option_affects_alerts, option_affects_rendering,
78    option_name_by_name, resolve_option_name, resolve_option_name_typed, validate_option_mutation,
79    validate_option_name_mutation, OptionLookupError, OptionMutationOutcome, OptionNotification,
80    OptionStore, ShowOptionsMode,
81};
82pub use pane::{Pane, PaneGeometry};
83pub use screen::{Screen, ScreenCellRef, ScreenCellView, ScreenLineView};
84pub use session::{
85    BreakPaneOptions, KillPaneOutcome, PaneJoinOptions, PaneSwapOptions, Session,
86    SessionPaneTarget, SessionStore,
87};
88pub use style::{
89    colour_to_string, parse_colour, style_parse, style_tostring, ColourParseError, Style,
90    StyleAlign, StyleCell, StyleDefaultType, StyleList, StyleParseError, StyleRange, StyleWidth,
91};
92pub use target_find::{
93    command_target_metadata, CommandTargetMetadata, CommandTargetSpec,
94    MissingCurrentTargetFallback, TargetFindContext, TargetFindFlags, TargetFindType,
95    UnresolvedTarget,
96};
97pub use terminal_passthrough::{
98    TerminalClipboardQuery, TerminalPaletteIndex, TerminalPassthrough, TerminalPassthroughKind,
99};
100pub use terminal_screen::TerminalScreen;
101pub use terminal_sequences::{alternate_screen_enter_sequence, alternate_screen_exit_sequence};
102pub use transcript::{ScreenCaptureRange, Transcript};
103pub use utf8::{text_width, truncate_right_to_width, truncate_to_width, Utf8Config};
104pub use vis::encode_paste_bytes;
105pub use window::{
106    AlertFlags, Window, WindowPaneActivity, WINDOW_ACTIVITY, WINDOW_ALERTFLAGS, WINDOW_BELL,
107    WINDOW_SILENCE, WINLINK_ACTIVITY, WINLINK_ALERTFLAGS, WINLINK_BELL, WINLINK_SILENCE,
108};
109
110/// Returns whether `text` matches the tmux-style glob `pattern`.
111#[must_use]
112pub fn fnmatch(pattern: &str, text: &str) -> bool {
113    glob::fnmatch(pattern, text)
114}