aboutsummaryrefslogtreecommitdiff
path: root/helix-tui/src/widgets/block.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-tui/src/widgets/block.rs')
-rw-r--r--helix-tui/src/widgets/block.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/helix-tui/src/widgets/block.rs b/helix-tui/src/widgets/block.rs
index bd025a31..98f84abe 100644
--- a/helix-tui/src/widgets/block.rs
+++ b/helix-tui/src/widgets/block.rs
@@ -7,7 +7,7 @@ use crate::{
use helix_view::graphics::{Rect, Style};
/// Border render type. Defaults to [`BorderType::Plain`].
-#[derive(Debug, Clone, Copy, PartialEq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BorderType {
Plain,
Rounded,
@@ -47,7 +47,7 @@ impl Default for BorderType {
/// .border_type(BorderType::Rounded)
/// .style(Style::default().bg(Color::Black));
/// ```
-#[derive(Debug, Default, Clone, PartialEq)]
+#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct Block<'a> {
/// Optional title place on the upper left of the block
title: Option<Spans<'a>>,
@@ -187,16 +187,8 @@ impl<'a> Widget for Block<'a> {
}
if let Some(title) = self.title {
- let lx = if self.borders.intersects(Borders::LEFT) {
- 1
- } else {
- 0
- };
- let rx = if self.borders.intersects(Borders::RIGHT) {
- 1
- } else {
- 0
- };
+ let lx = u16::from(self.borders.intersects(Borders::LEFT));
+ let rx = u16::from(self.borders.intersects(Borders::RIGHT));
let width = area.width.saturating_sub(lx).saturating_sub(rx);
buf.set_spans(area.left() + lx, area.top(), &title, width);
}