on master help sign in
Apply suggestions from blaz for infobox
commit9effe71b7d2133f18545d182cef384ea3fd1c0ff authorIvan Tham <pickfire@riseup.net> dateWed 30 Jun 2021, 00:17 (5 years ago) parent4c190ec
12 files changed+11−18
Cargo.lock−2 helix-term/src/ui/info.rs+1−5 helix-tui/Cargo.toml−1 helix-tui/src/backend/test.rs+1−1 helix-tui/src/buffer.rs+1−1 helix-tui/src/text.rs+1−1 helix-tui/src/widgets/paragraph.rs+1−1 helix-tui/src/widgets/reflow.rs+1−1 helix-tui/src/widgets/table.rs+1−1 helix-view/Cargo.toml−1 helix-view/src/info.rs+1−1 helix-view/src/input.rs+3−2
Cargo.lock−2
@@ -396,7 +396,6 @@ dependencies = [
396396 "helix-view",
397397 "serde",
398398 "unicode-segmentation",
399− "unicode-width",
400399]
401400
402401[[package]]
@@ -419,7 +418,6 @@ dependencies = [
419418 "slotmap",
420419 "tokio",
421420 "toml",
422− "unicode-width",
423421 "url",
424422 "which",
425423]
helix-term/src/ui/info.rs+1−5
@@ -11,11 +11,7 @@ impl Component for Info {
1111 let (w, h) = (*width + 2, *height + 2);
1212 // -2 to subtract command line + statusline. a bit of a hack, because of splits.
1313 let area = Rect::new(viewport.width - w, viewport.height - h - 2, w, h);
14− let margin = Margin {
15− vertical: 1,
16− horizontal: 1,
17− };
18− let Rect { x, y, .. } = area.inner(&margin);
14+ let Rect { x, y, .. } = block.inner(area);
1915 for (y, line) in (y..).zip(self.text.lines()) {
2016 surface.set_string(x, y, line, Style::default());
2117 }
helix-tui/Cargo.toml−1
@@ -19,7 +19,6 @@ default = ["crossterm"]
1919bitflags = "1.0"
2020cassowary = "0.3"
2121unicode-segmentation = "1.2"
22−unicode-width = "0.1"
2322crossterm = { version = "0.20", optional = true }
2423serde = { version = "1", "optional" = true, features = ["derive"]}
2524helix-view = { version = "0.3", path = "../helix-view", features = ["term"] }
helix-tui/src/backend/test.rs+1−1
@@ -2,9 +2,9 @@ use crate::{
22 backend::Backend,
33 buffer::{Buffer, Cell},
44};
5+use helix_core::unicode::width::UnicodeWidthStr;
56use helix_view::graphics::{CursorKind, Rect};
67use std::{fmt::Write, io};
7−use unicode_width::UnicodeWidthStr;
88
99/// A backend used for the integration tests.
1010#[derive(Debug)]
helix-tui/src/buffer.rs+1−1
@@ -1,7 +1,7 @@
11use crate::text::{Span, Spans};
2+use helix_core::unicode::width::UnicodeWidthStr;
23use std::cmp::min;
34use unicode_segmentation::UnicodeSegmentation;
4−use unicode_width::UnicodeWidthStr;
55
66use helix_view::graphics::{Color, Modifier, Rect, Style};
77
helix-tui/src/text.rs+1−1
@@ -47,10 +47,10 @@
4747//! ]);
4848//! ```
4949use helix_core::line_ending::str_is_line_ending;
50+use helix_core::unicode::width::UnicodeWidthStr;
5051use helix_view::graphics::Style;
5152use std::borrow::Cow;
5253use unicode_segmentation::UnicodeSegmentation;
53−use unicode_width::UnicodeWidthStr;
5454
5555/// A grapheme associated to a style.
5656#[derive(Debug, Clone, PartialEq)]
helix-tui/src/widgets/paragraph.rs+1−1
@@ -7,9 +7,9 @@ use crate::{
77 Block, Widget,
88 },
99};
10+use helix_core::unicode::width::UnicodeWidthStr;
1011use helix_view::graphics::{Rect, Style};
1112use std::iter;
12−use unicode_width::UnicodeWidthStr;
1313
1414fn get_line_offset(line_width: u16, text_area_width: u16, alignment: Alignment) -> u16 {
1515 match alignment {
helix-tui/src/widgets/reflow.rs+1−1
@@ -1,7 +1,7 @@
11use crate::text::StyledGrapheme;
22use helix_core::line_ending::str_is_line_ending;
3+use helix_core::unicode::width::UnicodeWidthStr;
34use unicode_segmentation::UnicodeSegmentation;
4−use unicode_width::UnicodeWidthStr;
55
66const NBSP: &str = "\u{00a0}";
77
helix-tui/src/widgets/table.rs+1−1
@@ -9,9 +9,9 @@ use cassowary::{
99 WeightedRelation::*,
1010 {Expression, Solver},
1111};
12+use helix_core::unicode::width::UnicodeWidthStr;
1213use helix_view::graphics::{Rect, Style};
1314use std::collections::HashMap;
14−use unicode_width::UnicodeWidthStr;
1515
1616/// A [`Cell`] contains the [`Text`] to be displayed in a [`Row`] of a [`Table`].
1717///
helix-view/Cargo.toml−1
@@ -31,7 +31,6 @@ slotmap = "1"
3131
3232encoding_rs = "0.8"
3333chardetng = "0.1"
34−unicode-width = "0.1"
3534
3635serde = { version = "1.0", features = ["derive"] }
3736toml = "0.5"
helix-view/src/info.rs+1−1
@@ -1,6 +1,6 @@
11use crate::input::KeyEvent;
2+use helix_core::unicode::width::UnicodeWidthStr;
23use std::fmt::Write;
3−use unicode_width::UnicodeWidthStr;
44
55#[derive(Debug)]
66/// Info box used in editor. Rendering logic will be in other crate.
helix-view/src/input.rs+3−2
@@ -1,5 +1,6 @@
11//! Input event handling, currently backed by crossterm.
22use anyhow::{anyhow, Error};
3+use helix_core::unicode::width::UnicodeWidthStr;
34use serde::de::{self, Deserialize, Deserializer};
45use std::fmt;
56
@@ -90,9 +91,9 @@ impl fmt::Display for KeyEvent {
9091 }
9192}
9293
93−impl unicode_width::UnicodeWidthStr for KeyEvent {
94+impl UnicodeWidthStr for KeyEvent {
9495 fn width(&self) -> usize {
95− use unicode_width::UnicodeWidthChar;
96+ use helix_core::unicode::width::UnicodeWidthChar;
9697 let mut width = match self.code {
9798 KeyCode::Backspace => keys::BACKSPACE.len(),
9899 KeyCode::Enter => keys::ENTER.len(),