Skip to content

Commit 650227f

Browse files
committed
chore: update to shadow-terminal v0.2.0
Required updating to some breaking changes.
1 parent 0780205 commit 650227f

File tree

23 files changed

+230
-119
lines changed

23 files changed

+230
-119
lines changed

Cargo.lock

Lines changed: 94 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,8 @@ tracing = "0.1.40"
2323
tracing-subscriber = {version = "0.3.18", features = ["env-filter"]}
2424

2525
[workspace.dependencies.shadow-terminal]
26-
version = "0.1.1"
27-
# path = "../../shadow-terminal"
28-
29-
[workspace.dependencies.termwiz]
30-
package = "tattoy-termwiz"
31-
features = ["use_serde"]
32-
version = "0.24.0-fork"
33-
# path = "../wezterm/termwiz"
26+
version = "0.2.0"
27+
# path = "../shadow-terminal/shadow-terminal/"
3428

3529
# Canonical lints for whole crate
3630
#

crates/tattoy/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ serde.workspace = true
2727
serde_json.workspace = true
2828
tattoy-protocol = { path = "../tattoy-protocol", version = "0.1.0" }
2929
tempfile.workspace = true
30-
termwiz.workspace = true
3130
tokio.workspace = true
3231
toml = "0.8.20"
3332
tracing.workspace = true

crates/tattoy/src/blender.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use palette::{
55
color_difference::Wcag21RelativeContrast as _, DarkenAssign as _, IntoColor as _,
66
LightenAssign as _,
77
};
8-
use termwiz::cell::Cell;
8+
use shadow_terminal::termwiz;
99

1010
/// This is the default colour for when an opaque cell is over a "blank" cell.
1111
///
@@ -27,7 +27,7 @@ enum Kind {
2727
/// having a dedicated module hopefully makes things a bit simpler.
2828
pub(crate) struct Blender<'cell> {
2929
/// The normal underlying cell
30-
cell: &'cell mut Cell,
30+
cell: &'cell mut termwiz::cell::Cell,
3131
/// The true colour value to use when the cell doesn't have a colour.
3232
default_colour: termwiz::color::SrgbaTuple,
3333
/// The opacity of the cell above.
@@ -37,7 +37,7 @@ pub(crate) struct Blender<'cell> {
3737
impl<'cell> Blender<'cell> {
3838
/// Instantiate
3939
pub const fn new(
40-
cell: &'cell mut Cell,
40+
cell: &'cell mut termwiz::cell::Cell,
4141
maybe_default_bg_colour: Option<termwiz::color::SrgbaTuple>,
4242
cell_above_opacity: f32,
4343
) -> Self {
@@ -104,7 +104,7 @@ impl<'cell> Blender<'cell> {
104104
}
105105

106106
/// Blend the cell's colours with the cell above.
107-
pub fn blend_all(&mut self, cell_above: &Cell) {
107+
pub fn blend_all(&mut self, cell_above: &termwiz::cell::Cell) {
108108
let character_above = cell_above.str();
109109
let character_above_is_empty = character_above.is_empty() || character_above == " ";
110110
if character_above_is_empty {
@@ -269,7 +269,7 @@ mod test {
269269
async fn blend_pixels(
270270
maybe_first: Option<(usize, usize, crate::surface::Colour)>,
271271
maybe_second: Option<(usize, usize, crate::surface::Colour)>,
272-
) -> Cell {
272+
) -> termwiz::cell::Cell {
273273
let mut renderer = make_renderer().await;
274274
let mut tattoy_below = crate::surface::Surface::new("below".into(), 1, 1, 1, 1.0);
275275
if let Some(first) = maybe_first {

crates/tattoy/src/compositor.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Composite individual cells into the final renderablsee frame.
22
use color_eyre::eyre::{ContextCompat as _, Result};
3+
use shadow_terminal::termwiz;
34

45
/// Composite cells together, honouring alpha blending, text and pixels.
56
#[derive(Default)]

crates/tattoy/src/config/input.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Supporting user-defined keybindings.
22
3+
use shadow_terminal::termwiz;
4+
35
/// The user config for defining keybindings.
46
#[derive(serde::Serialize, serde::Deserialize, PartialEq, Eq, Debug, Clone)]
57
pub(crate) struct KeybindingConfigRaw {

crates/tattoy/src/config/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
use color_eyre::eyre::ContextCompat as _;
44
use color_eyre::eyre::Result;
55

6+
use shadow_terminal::termwiz;
7+
68
/// A copy of the default config file. It gets copied to the user's config folder the first time
79
/// they start Tattoy.
810
static DEFAULT_CONFIG: &str = include_str!("../../default_config.toml");

crates/tattoy/src/palette/converter.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Convert palette indexes to true colour values.
22
33
use color_eyre::{eyre::ContextCompat as _, Result};
4+
use shadow_terminal::termwiz;
45

56
/// This might be a big assumption, but I think the convention is that text uses this colour from
67
/// the palette when no other index or true colour is specified.
@@ -112,12 +113,17 @@ impl Palette {
112113
}
113114

114115
/// Convert TTY cell palette indexes into their true colour values.
115-
pub fn convert_cells_to_true_colour(&self, output: &mut shadow_terminal::output::Output) {
116+
pub fn convert_cells_to_true_colour(
117+
&self,
118+
output: &mut shadow_terminal::output::native::Output,
119+
) {
116120
match output {
117-
shadow_terminal::output::Output::Diff(surface_diff) => {
121+
shadow_terminal::output::native::Output::Diff(surface_diff) => {
118122
let changes = match surface_diff {
119-
shadow_terminal::output::SurfaceDiff::Scrollback(diff) => &mut diff.changes,
120-
shadow_terminal::output::SurfaceDiff::Screen(diff) => &mut diff.changes,
123+
shadow_terminal::output::native::SurfaceDiff::Scrollback(diff) => {
124+
&mut diff.changes
125+
}
126+
shadow_terminal::output::native::SurfaceDiff::Screen(diff) => &mut diff.changes,
121127
_ => {
122128
tracing::error!(
123129
"Unrecognised surface diff when converting cells to true colour"
@@ -132,12 +138,12 @@ impl Palette {
132138
}
133139
}
134140
}
135-
shadow_terminal::output::Output::Complete(complete_surface) => {
141+
shadow_terminal::output::native::Output::Complete(complete_surface) => {
136142
let cells = match complete_surface {
137-
shadow_terminal::output::CompleteSurface::Scrollback(scrollback) => {
143+
shadow_terminal::output::native::CompleteSurface::Scrollback(scrollback) => {
138144
scrollback.surface.screen_cells()
139145
}
140-
shadow_terminal::output::CompleteSurface::Screen(screen) => {
146+
shadow_terminal::output::native::CompleteSurface::Screen(screen) => {
141147
screen.surface.screen_cells()
142148
}
143149
_ => {

crates/tattoy/src/palette/osc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//! index.
33
44
use color_eyre::eyre::{ContextCompat as _, Result};
5+
use shadow_terminal::termwiz;
56
use termwiz::terminal::Terminal as _;
67
use tokio::io::{AsyncReadExt as _, AsyncWriteExt as _};
78

crates/tattoy/src/raw_input.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use std::io::Read as _;
44

55
use color_eyre::eyre::Result;
6+
use shadow_terminal::termwiz;
67

78
/// Bytes from STDIN
89
pub type BytesFromSTDIN = [u8; 128];

0 commit comments

Comments
 (0)