summaryrefslogtreecommitdiff
path: root/helix-tui/src/backend
diff options
context:
space:
mode:
authorKeith Simmons2021-06-25 03:58:15 +0000
committerGitHub2021-06-25 03:58:15 +0000
commit4418e17547562e211952b9e8585916e04b858b3b (patch)
tree8427958809392969b035967c1c69e9507207d00e /helix-tui/src/backend
parent74cc4b4a49e05462b2b543737ad4dc32e2265794 (diff)
reverse the dependency between helix-tui and helix-view (#366)
* reverse the dependency between helix-tui and helix-view by moving a fiew types to view * fix tests * clippy and format fixes Co-authored-by: Keith Simmons <keithsim@microsoft.com>
Diffstat (limited to 'helix-tui/src/backend')
-rw-r--r--helix-tui/src/backend/crossterm.rs35
-rw-r--r--helix-tui/src/backend/mod.rs4
-rw-r--r--helix-tui/src/backend/test.rs3
3 files changed, 5 insertions, 37 deletions
diff --git a/helix-tui/src/backend/crossterm.rs b/helix-tui/src/backend/crossterm.rs
index 189f9dce..eff098b3 100644
--- a/helix-tui/src/backend/crossterm.rs
+++ b/helix-tui/src/backend/crossterm.rs
@@ -1,10 +1,4 @@
-use crate::{
- backend::Backend,
- buffer::Cell,
- layout::Rect,
- style::{Color, Modifier},
- terminal::CursorKind,
-};
+use crate::{backend::Backend, buffer::Cell};
use crossterm::{
cursor::{CursorShape, Hide, MoveTo, SetCursorShape, Show},
execute, queue,
@@ -14,6 +8,7 @@ use crossterm::{
},
terminal::{self, Clear, ClearType},
};
+use helix_view::graphics::{Color, CursorKind, Modifier, Rect};
use std::io::{self, Write};
pub struct CrosstermBackend<W: Write> {
@@ -133,32 +128,6 @@ fn map_error(error: crossterm::Result<()>) -> io::Result<()> {
error.map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))
}
-impl From<Color> for CColor {
- fn from(color: Color) -> Self {
- match color {
- Color::Reset => CColor::Reset,
- Color::Black => CColor::Black,
- Color::Red => CColor::DarkRed,
- Color::Green => CColor::DarkGreen,
- Color::Yellow => CColor::DarkYellow,
- Color::Blue => CColor::DarkBlue,
- Color::Magenta => CColor::DarkMagenta,
- Color::Cyan => CColor::DarkCyan,
- Color::Gray => CColor::Grey,
- Color::DarkGray => CColor::DarkGrey,
- Color::LightRed => CColor::Red,
- Color::LightGreen => CColor::Green,
- Color::LightBlue => CColor::Blue,
- Color::LightYellow => CColor::Yellow,
- Color::LightMagenta => CColor::Magenta,
- Color::LightCyan => CColor::Cyan,
- Color::White => CColor::White,
- Color::Indexed(i) => CColor::AnsiValue(i),
- Color::Rgb(r, g, b) => CColor::Rgb { r, g, b },
- }
- }
-}
-
#[derive(Debug)]
struct ModifierDiff {
pub from: Modifier,
diff --git a/helix-tui/src/backend/mod.rs b/helix-tui/src/backend/mod.rs
index 5cf21768..c6c11019 100644
--- a/helix-tui/src/backend/mod.rs
+++ b/helix-tui/src/backend/mod.rs
@@ -1,8 +1,8 @@
use std::io;
use crate::buffer::Cell;
-use crate::layout::Rect;
-use crate::terminal::CursorKind;
+
+use helix_view::graphics::{CursorKind, Rect};
#[cfg(feature = "crossterm")]
mod crossterm;
diff --git a/helix-tui/src/backend/test.rs b/helix-tui/src/backend/test.rs
index 4681831d..a03bcd8e 100644
--- a/helix-tui/src/backend/test.rs
+++ b/helix-tui/src/backend/test.rs
@@ -1,9 +1,8 @@
use crate::{
backend::Backend,
buffer::{Buffer, Cell},
- layout::Rect,
- terminal::CursorKind,
};
+use helix_view::graphics::{CursorKind, Rect};
use std::{fmt::Write, io};
use unicode_width::UnicodeWidthStr;