Skip to main content

Crate par_term

Crate par_term 

Source
Expand description

Library exports for testing and potential library use.

§ARC-011 — Crate Size Note

The root crate src/ is ~70,587 lines across ~310 files. This is a compile-time bottleneck — any change to a single file recompiles the entire crate.

Planned decomposition (deferred — multi-sprint effort):

  1. Extract par-term-ui crate (~15K lines): egui overlay modules

    • ai_inspector/, clipboard_history_ui, close_confirmation_ui, command_history_ui, help_ui, integrations_ui, paste_special_ui, profile_drawer_ui, quit_confirmation_ui, remote_shell_install_ui, shader_install_ui, ssh_connect_ui, tmux_session_picker_ui
  2. Extract par-term-badge crate (~3K lines): badge.rs + progress_bar.rs

  3. Extract par-term-session crate (~5K lines): session/*, session_logger/

Tracking: Issue ARC-011 in AUDIT.md.

§Mutex Usage Policy

par-term uses three mutex types for different concurrency scenarios. New code should follow these rules:

  • tokio::sync::RwLock — canonical choice for TerminalManager and other state shared between async tasks and the sync winit event loop. From sync contexts use try_read() / try_write() (non-blocking) or blocking_read() / blocking_write() only for infrequent user-initiated operations. Never call the blocking variants from within a Tokio worker thread — it will deadlock.

  • parking_lot::Mutex — use for sync-only state where a fast, non-async lock is needed (e.g. upload-error field, watcher state). Do NOT call blocking_lock() on a tokio mutex from within an async context.

  • std::sync::Mutex — acceptable for simple, short-lived locks in code that cannot depend on parking_lot (e.g. platform FFI modules). Prefer parking_lot for new code.

Canonical Tab-level locking rules are documented on tab::Tab. See docs/MUTEX_PATTERNS.md for detailed patterns, deadlock avoidance rules, and examples showing correct lock acquisition in each context.

Re-exports§

pub use par_term_mcp as mcp_server;
pub use par_term_settings_ui as settings_ui;
pub use par_term_tmux as tmux;

Modules§

acp_harness
Reusable components for the par-term-acp-harness test binary.
ai_inspector
app
Application module for par-term
arrangements
Window arrangement types and manager for saving/restoring window layouts.
atomic_save
Crash-safe atomic file writes — re-exported from par-term-config.
audio_bell
badge
Badge system for displaying session information overlays.
cli
Command-line interface for par-term.
clipboard_history_ui
close_confirmation_ui
Close confirmation dialog for tabs with running jobs.
command_history
Persistent command history for fuzzy search.
command_history_ui
Fuzzy command history search overlay UI.
config
Terminal configuration management.
config_migration
One-time best-effort migration of user data from a legacy config directory into the canonical XDG location (Config::config_dir()).
copy_mode
Vi-style Copy Mode state machine.
debug
font_metrics
CPU-only font metrics calculation for window sizing.
help_ui
http
HTTP client helper with native-tls support.
integrations_ui
Combined integrations welcome dialog.
macos_blur
macOS window blur using private CGS API
macos_metal
macOS-specific CAMetalLayer configuration
macos_space
macOS window Space (virtual desktop) targeting using private SLS APIs
menu
Menu support for par-term
pane
Pane management for split terminal support
paste_special_ui
Paste Special UI - Command palette for text transformations.
paste_transform
Paste transformation utilities.
platform
Platform abstraction layer for par-term.
profile
Profile management for terminal session configurations
profile_drawer_ui
Profile drawer UI using egui
progress_bar
Progress bar overlay rendering using egui.
quit_confirmation_ui
Quit confirmation dialog for the application.
remote_shell_install_ui
Remote shell integration install confirmation dialog.
scroll_state
search
Terminal search functionality.
selection
session
Session state types for save/restore on startup.
session_logger
Session logging and recording for terminal sessions.
settings_window
Separate settings window for the terminal emulator.
shader_install_ui
Shader installation prompt UI.
shader_installer
Shared shader installation logic.
shader_lint
Shader linting and readability scoring helpers.
shader_watcher
Shader hot reload watcher
shell_integration_installer
Shell integration installation logic.
shell_quote
Shell quoting utilities for safe filename handling.
smart_selection
Smart selection module for pattern-based text selection.
snippets
Snippet variable substitution and insertion engine.
ssh_connect_ui
SSH Quick Connect dialog.
status_bar
Status bar system for displaying session and system information.
tab
Tab management for multi-tab terminal support
tab_bar_ui
Tab bar UI using egui
tmux_session_picker_ui
tmux Session Picker UI
tmux_status_bar_ui
tmux status bar UI using egui
traits
Shared trait definitions for par-term components.
traits_impl
Concrete implementations of the traits defined in crate::traits.
ui_constants
Named constants for UI layout dimensions.
update_dialog
Update notification dialog overlay.
url_detection

Macros§

debug_and_log_error
Emit a message to both the custom debug log (at Error level) and the standard log crate at log::error! level.
debug_and_log_warn
Emit a message to both the custom debug log (at Error level) and the standard log crate at log::warn! level.
debug_error
debug_info
debug_log
debug_trace

Constants§

VERSION
Application version (root crate version, for use by sub-crates). Sub-crates should receive this via parameter rather than using env!("CARGO_PKG_VERSION") which resolves to the sub-crate’s version.