aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/atuin_pty_proxy/osc133.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-11 14:20:49 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-11 14:20:49 +0200
commit199563550dd41c3dfb703bd3747604a8a03cdbc5 (patch)
tree30cfa3e5539f782b7571091c742ee1c219e138fb /crates/turtle/src/atuin_pty_proxy/osc133.rs
parentchore: Restore db migrations (diff)
downloadatuin-199563550dd41c3dfb703bd3747604a8a03cdbc5.zip
chore: Remove all `pub`s
They will not be marked by rustc/cargo as unused, and as atuin doesn't expose an API all of them _should_ be `pub(crate)`
Diffstat (limited to 'crates/turtle/src/atuin_pty_proxy/osc133.rs')
-rw-r--r--crates/turtle/src/atuin_pty_proxy/osc133.rs34
1 files changed, 17 insertions, 17 deletions
diff --git a/crates/turtle/src/atuin_pty_proxy/osc133.rs b/crates/turtle/src/atuin_pty_proxy/osc133.rs
index 5b70f0aa..d79166a6 100644
--- a/crates/turtle/src/atuin_pty_proxy/osc133.rs
+++ b/crates/turtle/src/atuin_pty_proxy/osc133.rs
@@ -25,7 +25,7 @@
/// Events emitted when an OSC 133 marker is detected.
#[derive(Debug, Clone, PartialEq, Eq)]
-pub enum Event {
+pub(crate) enum Event {
/// `ESC ] 133 ; A ST` — the shell is about to display its prompt.
PromptStart,
/// `ESC ] 133 ; B ST` — the prompt has ended; the user may type a command.
@@ -41,7 +41,7 @@ pub enum Event {
/// Parameters attached to an OSC 133 marker.
#[derive(Debug, Default, Clone, PartialEq, Eq)]
-pub struct Params {
+pub(crate) struct Params {
items: Vec<Param>,
}
@@ -49,13 +49,13 @@ impl Params {
/// Iterate over all marker parameters in order.
#[cfg(test)]
#[inline]
- pub fn iter(&self) -> impl Iterator<Item = &Param> {
+ pub(crate) fn iter(&self) -> impl Iterator<Item = &Param> {
self.items.iter()
}
/// Return the value for the first `key=value` parameter with this key.
#[inline]
- pub fn get(&self, key: &str) -> Option<&str> {
+ pub(crate) fn get(&self, key: &str) -> Option<&str> {
self.items.iter().find_map(|item| match item {
Param::KeyValue {
key: item_key,
@@ -68,7 +68,7 @@ impl Params {
/// A single OSC 133 marker parameter.
#[derive(Debug, Clone, PartialEq, Eq)]
-pub enum Param {
+pub(crate) enum Param {
/// A positional parameter without an equals sign.
Value(String),
/// A `key=value` parameter.
@@ -77,29 +77,29 @@ pub enum Param {
/// An OSC 133 event with its position in the most recent input chunk.
#[derive(Debug, Clone, PartialEq, Eq)]
-pub struct LocatedEvent {
+pub(crate) struct LocatedEvent {
/// The OSC 133 event that was parsed.
- pub event: Event,
+ pub(crate) event: Event,
/// Offset where this marker starts in the current chunk.
///
/// If a marker started in an earlier [`Parser::push_located`] call, this is
/// `0` in the chunk that completed the marker.
- pub start_offset: usize,
+ pub(crate) start_offset: usize,
/// Offset immediately after this marker's terminator in the current chunk.
///
/// If a marker spans multiple [`Parser::push_located`] calls, this is still
/// the offset in the chunk that completed the marker.
- pub offset: usize,
+ pub(crate) offset: usize,
/// The semantic zone after applying this event.
- pub zone: Zone,
+ pub(crate) zone: Zone,
/// Metadata parameters attached to this marker.
- pub params: Params,
+ pub(crate) params: Params,
}
/// The current semantic zone as determined by the most recent OSC 133 marker.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
#[expect(dead_code)]
-pub enum Zone {
+pub(crate) enum Zone {
/// No marker seen yet, or after a `D` marker (between commands).
#[default]
Unknown,
@@ -149,7 +149,7 @@ enum State {
/// OSC 133 markers and reports [`Event`]s through a caller-supplied callback
/// without modifying the data. It can sit transparently between a PTY reader
/// and stdout.
-pub struct Parser {
+pub(crate) struct Parser {
state: State,
zone: Zone,
sequence_start: Option<usize>,
@@ -166,7 +166,7 @@ impl Default for Parser {
impl Parser {
/// Create a new parser in the initial (ground / unknown-zone) state.
#[inline]
- pub fn new() -> Self {
+ pub(crate) fn new() -> Self {
Self {
state: State::Ground,
zone: Zone::Unknown,
@@ -179,7 +179,7 @@ impl Parser {
/// The current semantic zone based on markers seen so far.
#[inline]
#[expect(dead_code)]
- pub fn zone(&self) -> Zone {
+ pub(crate) fn zone(&self) -> Zone {
self.zone
}
@@ -197,7 +197,7 @@ impl Parser {
/// caller — this method only *observes* the stream.
#[cfg(test)]
#[inline]
- pub fn push(&mut self, data: &[u8], mut on_event: impl FnMut(Event)) {
+ pub(crate) fn push(&mut self, data: &[u8], mut on_event: impl FnMut(Event)) {
self.push_located(data, |located| on_event(located.event));
}
@@ -208,7 +208,7 @@ impl Parser {
/// it suitable for callers that need to split the original chunk at marker
/// boundaries.
#[inline]
- pub fn push_located(&mut self, data: &[u8], mut on_event: impl FnMut(LocatedEvent)) {
+ pub(crate) fn push_located(&mut self, data: &[u8], mut on_event: impl FnMut(LocatedEvent)) {
self.sequence_start = (self.state != State::Ground).then_some(0);
for (offset, &byte) in data.iter().enumerate() {