diff options
| author | Ayose <ayosec@gmail.com> | 2021-05-31 20:53:23 +0100 |
|---|---|---|
| committer | Ayose <ayosec@gmail.com> | 2021-05-31 20:53:23 +0100 |
| commit | 3caa09ef9b339ebed1329eed016b8a5704bd2c77 (patch) | |
| tree | 42b4fb05a26c852fd23e93311852f07ebf76d8f1 | |
| parent | f4bdc6f038732b0d4e8803f1df9beb9d2da05f47 (diff) | |
| download | r-alacritty-3caa09ef9b339ebed1329eed016b8a5704bd2c77.tar.gz r-alacritty-3caa09ef9b339ebed1329eed016b8a5704bd2c77.tar.bz2 r-alacritty-3caa09ef9b339ebed1329eed016b8a5704bd2c77.zip | |
Define MAX_GRAPHIC_DIMENSIONS as a 2-elements array.
| -rw-r--r-- | alacritty_terminal/src/graphics/mod.rs | 2 | ||||
| -rw-r--r-- | alacritty_terminal/src/graphics/sixel.rs | 2 | ||||
| -rw-r--r-- | alacritty_terminal/src/term/mod.rs | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/alacritty_terminal/src/graphics/mod.rs b/alacritty_terminal/src/graphics/mod.rs index 30424c2b..a285228f 100644 --- a/alacritty_terminal/src/graphics/mod.rs +++ b/alacritty_terminal/src/graphics/mod.rs @@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize}; use crate::term::color::Rgb; /// Max allowed dimensions (width, height) for the graphic, in pixels. -pub const MAX_GRAPHIC_DIMENSIONS: (usize, usize) = (4096, 4096); +pub const MAX_GRAPHIC_DIMENSIONS: [usize; 2] = [4096, 4096]; /// Unique identifier for every graphic added to a grid. #[derive(Serialize, Deserialize, Eq, PartialEq, Clone, Debug, Copy, Hash, PartialOrd, Ord)] diff --git a/alacritty_terminal/src/graphics/sixel.rs b/alacritty_terminal/src/graphics/sixel.rs index 221fe7cd..d617e53b 100644 --- a/alacritty_terminal/src/graphics/sixel.rs +++ b/alacritty_terminal/src/graphics/sixel.rs @@ -391,7 +391,7 @@ impl Parser { return Ok(()); } - if width > MAX_GRAPHIC_DIMENSIONS.0 || height > MAX_GRAPHIC_DIMENSIONS.1 { + if width > MAX_GRAPHIC_DIMENSIONS[0] || height > MAX_GRAPHIC_DIMENSIONS[1] { return Err(Error::TooBigImage { width, height }); } diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index d39c5f2e..959f99ef 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -1770,7 +1770,7 @@ impl<T: EventListener> Handler for Term<T> { let (ps, pv) = if pa == 1 || pa == 4 { match pi { 1 => (0, &[sixel::MAX_COLOR_REGISTERS][..]), - 2 => (0, &[MAX_GRAPHIC_DIMENSIONS.0, MAX_GRAPHIC_DIMENSIONS.1][..]), + 2 => (0, &MAX_GRAPHIC_DIMENSIONS[..]), _ => (1, &[][..]), // Report error in Pi } } else { @@ -1800,7 +1800,7 @@ impl<T: EventListener> Handler for Term<T> { } } - if graphic.width > MAX_GRAPHIC_DIMENSIONS.0 || graphic.height > MAX_GRAPHIC_DIMENSIONS.1 { + if graphic.width > MAX_GRAPHIC_DIMENSIONS[0] || graphic.height > MAX_GRAPHIC_DIMENSIONS[1] { return; } |