diff options
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/completion.rs | 11 | ||||
-rw-r--r-- | helix-term/src/ui/editor.rs | 17 | ||||
-rw-r--r-- | helix-term/src/ui/markdown.rs | 12 | ||||
-rw-r--r-- | helix-term/src/ui/menu.rs | 12 | ||||
-rw-r--r-- | helix-term/src/ui/mod.rs | 8 | ||||
-rw-r--r-- | helix-term/src/ui/picker.rs | 10 | ||||
-rw-r--r-- | helix-term/src/ui/popup.rs | 11 | ||||
-rw-r--r-- | helix-term/src/ui/prompt.rs | 16 | ||||
-rw-r--r-- | helix-term/src/ui/text.rs | 11 |
9 files changed, 48 insertions, 60 deletions
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index 85543610..74a82dab 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -1,15 +1,14 @@ use crate::compositor::{Component, Compositor, Context, EventResult}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; -use tui::{ - buffer::Buffer as Surface, - layout::Rect, - style::{Color, Style}, -}; +use tui::buffer::Buffer as Surface; use std::borrow::Cow; use helix_core::{Position, Transaction}; -use helix_view::Editor; +use helix_view::{ + graphics::{Color, Rect, Style}, + Editor, +}; use crate::commands; use crate::ui::{menu, Markdown, Menu, Popup, PromptEvent}; diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 1c443bc7..93f000e7 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -12,21 +12,20 @@ use helix_core::{ LineEnding, Position, Range, }; use helix_lsp::LspProgressMap; -use helix_view::input::{KeyCode, KeyEvent, KeyModifiers}; -use helix_view::{document::Mode, Document, Editor, Theme, View}; +use helix_view::{ + document::Mode, + graphics::{Color, CursorKind, Modifier, Rect, Style}, + input::KeyEvent, + keyboard::{KeyCode, KeyModifiers}, + Document, Editor, Theme, View, +}; use std::borrow::Cow; use crossterm::{ cursor, event::{read, Event, EventStream}, }; -use tui::{ - backend::CrosstermBackend, - buffer::Buffer as Surface, - layout::Rect, - style::{Color, Modifier, Style}, - terminal::CursorKind, -}; +use tui::{backend::CrosstermBackend, buffer::Buffer as Surface}; pub struct EditorView { keymaps: Keymaps, diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs index 72a3e4ff..36d570cd 100644 --- a/helix-term/src/ui/markdown.rs +++ b/helix-term/src/ui/markdown.rs @@ -1,16 +1,14 @@ use crate::compositor::{Component, Compositor, Context, EventResult}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; -use tui::{ - buffer::Buffer as Surface, - layout::Rect, - style::{Color, Style}, - text::Text, -}; +use tui::{buffer::Buffer as Surface, text::Text}; use std::{borrow::Cow, sync::Arc}; use helix_core::{syntax, Position}; -use helix_view::{Editor, Theme}; +use helix_view::{ + graphics::{Color, Rect, Style}, + Editor, Theme, +}; pub struct Markdown { contents: String, diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index 0a264f7c..f32ce01c 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -1,11 +1,6 @@ use crate::compositor::{Component, Compositor, Context, EventResult}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; -use tui::{ - buffer::Buffer as Surface, - layout::Rect, - style::{Color, Style}, - widgets::Table, -}; +use tui::{buffer::Buffer as Surface, widgets::Table}; pub use tui::widgets::{Cell, Row}; @@ -15,7 +10,10 @@ use fuzzy_matcher::skim::SkimMatcherV2 as Matcher; use fuzzy_matcher::FuzzyMatcher; use helix_core::Position; -use helix_view::Editor; +use helix_view::{ + graphics::{Color, Rect, Style}, + Editor, +}; pub trait Item { // TODO: sort_text diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index 29d555ac..14dc9169 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -18,12 +18,12 @@ pub use prompt::{Prompt, PromptEvent}; pub use spinner::{ProgressSpinners, Spinner}; pub use text::Text; -pub use tui::layout::Rect; -pub use tui::style::{Color, Modifier, Style}; - use helix_core::regex::Regex; use helix_core::register::Registers; -use helix_view::{Document, Editor, View}; +use helix_view::{ + graphics::{Color, Modifier, Rect, Style}, + Document, Editor, View, +}; use std::path::{Path, PathBuf}; diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index d1152659..15e6b062 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -2,8 +2,6 @@ use crate::compositor::{Component, Compositor, Context, EventResult}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; use tui::{ buffer::Buffer as Surface, - layout::Rect, - style::{Color, Style}, widgets::{Block, BorderType, Borders}, }; @@ -14,9 +12,11 @@ use std::borrow::Cow; use crate::ui::{Prompt, PromptEvent}; use helix_core::Position; -use helix_view::editor::Action; -use helix_view::Editor; -use tui::terminal::CursorKind; +use helix_view::{ + editor::Action, + graphics::{Color, CursorKind, Rect, Style}, + Editor, +}; pub struct Picker<T> { options: Vec<T>, diff --git a/helix-term/src/ui/popup.rs b/helix-term/src/ui/popup.rs index 8488d1c6..af72735c 100644 --- a/helix-term/src/ui/popup.rs +++ b/helix-term/src/ui/popup.rs @@ -1,15 +1,14 @@ use crate::compositor::{Component, Compositor, Context, EventResult}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; -use tui::{ - buffer::Buffer as Surface, - layout::Rect, - style::{Color, Style}, -}; +use tui::buffer::Buffer as Surface; use std::borrow::Cow; use helix_core::Position; -use helix_view::Editor; +use helix_view::{ + graphics::{Color, Rect, Style}, + Editor, +}; // TODO: share logic with Menu, it's essentially Popup(render_fn), but render fn needs to return // a width/height hint. maybe Popup(Box<Component>) diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index 63078c39..6bb1b006 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -1,14 +1,17 @@ use crate::compositor::{Component, Compositor, Context, EventResult}; use crate::ui; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; -use helix_core::Position; -use helix_view::{Editor, Theme}; use std::{borrow::Cow, ops::RangeFrom}; -use tui::terminal::CursorKind; +use tui::buffer::Buffer as Surface; use helix_core::{ unicode::segmentation::{GraphemeCursor, GraphemeIncomplete}, unicode::width::UnicodeWidthStr, + Position, +}; +use helix_view::{ + graphics::{Color, CursorKind, Margin, Modifier, Rect, Style}, + Editor, Theme, }; pub type Completion = (RangeFrom<usize>, Cow<'static, str>); @@ -251,12 +254,6 @@ impl Prompt { } } -use tui::{ - buffer::Buffer as Surface, - layout::Rect, - style::{Color, Modifier, Style}, -}; - const BASE_WIDTH: u16 = 30; impl Prompt { @@ -343,7 +340,6 @@ impl Prompt { let background = theme.get("ui.help"); surface.clear_with(area, background); - use tui::layout::Margin; text.render( area.inner(&Margin { vertical: 1, diff --git a/helix-term/src/ui/text.rs b/helix-term/src/ui/text.rs index 6225e769..7c491841 100644 --- a/helix-term/src/ui/text.rs +++ b/helix-term/src/ui/text.rs @@ -1,15 +1,14 @@ use crate::compositor::{Component, Compositor, Context, EventResult}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; -use tui::{ - buffer::Buffer as Surface, - layout::Rect, - style::{Color, Style}, -}; +use tui::buffer::Buffer as Surface; use std::borrow::Cow; use helix_core::Position; -use helix_view::Editor; +use helix_view::{ + graphics::{Color, Rect, Style}, + Editor, +}; pub struct Text { contents: String, |