feat: add bar element margins and space LSP indicators
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
- [x] add `C` and `D` for deleting line from current cursor position (and entering insert mode: `C`); add `Y` for copying line from current cursor position; add `r` for replacing character at cursor position; add `s` for deleting character at current cursor position and entering insert mode; add `d<count>w` for deleting whole words; add `d<count>b` for deleting backwards (same as `d<count>w` but backwards).
|
- [x] add `C` and `D` for deleting line from current cursor position (and entering insert mode: `C`); add `Y` for copying line from current cursor position; add `r` for replacing character at cursor position; add `s` for deleting character at current cursor position and entering insert mode; add `d<count>w` for deleting whole words; add `d<count>b` for deleting backwards (same as `d<count>w` but backwards).
|
||||||
- [x] diff view: make foreground of etched areas (where no lines exist) the same dimmed color as the normal gutter text
|
- [x] diff view: make foreground of etched areas (where no lines exist) the same dimmed color as the normal gutter text
|
||||||
- [x] copying is pretty slow; optimize performance to reduce latency.
|
- [x] copying is pretty slow; optimize performance to reduce latency.
|
||||||
- [ ] enable margins in bar elements (i.e. for top and bottom bars) and give the lsp symbol (next to language) a default margin of 1 column on either side.
|
- [x] enable margins in bar elements (i.e. for top and bottom bars) and give the lsp symbol (next to language) a default margin of 1 column on either side.
|
||||||
- [ ] pull a pr description and display it in a buffer:
|
- [ ] pull a pr description and display it in a buffer:
|
||||||
- open a selector that allows you to pick a pr from remote
|
- open a selector that allows you to pick a pr from remote
|
||||||
- selector should be searchable
|
- selector should be searchable
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ config.bind "leader s", config.core.diff.orientation.toggle
|
|||||||
|
|
||||||
### Top and bottom bars
|
### Top and bottom bars
|
||||||
|
|
||||||
`config.bar.top` and `config.bar.bottom` each accept ordered `left`, `center`, and `right` arrays of segment names. Both bars accept every builtin and custom segment, with the same anchors, title templates, padding, styled edges, and collision handling. Left and right groups anchor to their respective edges; the center group is centered on the whole row, not on the gap remaining between the other groups. Array order is display order within each group. Omitted groups and segment options retain that bar's defaults; an empty array removes that group.
|
`config.bar.top` and `config.bar.bottom` each accept ordered `left`, `center`, and `right` arrays of segment names. Both bars accept every builtin and custom segment, with the same anchors, title templates, margins, padding, styled edges, and collision handling. Left and right groups anchor to their respective edges; the center group is centered on the whole row, not on the gap remaining between the other groups. Array order is display order within each group. Omitted groups and segment options retain that bar's defaults; an empty array removes that group.
|
||||||
|
|
||||||
Use the two setters independently; a combined `config.bar = { ... }` assignment is not supported.
|
Use the two setters independently; a combined `config.bar = { ... }` assignment is not supported.
|
||||||
|
|
||||||
@@ -68,6 +68,7 @@ Vamp.configure do |config|
|
|||||||
left: [:mode, :path, :diagnostics, :selections, :count, :pending, :buffer],
|
left: [:mode, :path, :diagnostics, :selections, :count, :pending, :buffer],
|
||||||
center: [], right: [:language, :lsp, :position],
|
center: [], right: [:language, :lsp, :position],
|
||||||
mode: { padding: 1, leading_edge: "", trailing_edge: "▓░" },
|
mode: { padding: 1, leading_edge: "", trailing_edge: "▓░" },
|
||||||
|
lsp: { margin: 1 },
|
||||||
position: { padding: 1, leading_edge: "░▓", trailing_edge: "" }
|
position: { padding: 1, leading_edge: "░▓", trailing_edge: "" }
|
||||||
}
|
}
|
||||||
config.bar.bottom = {
|
config.bar.bottom = {
|
||||||
@@ -91,9 +92,11 @@ Each segment's `title` is a literal template supporting only `{index}`, `{view}`
|
|||||||
|
|
||||||
`:lsp` displays only ready servers assigned to the focused buffer, in configured stack order joined with ` + `. Disabled, initializing, failed, or unassigned servers do not appear. Names come from the initialization reply's `serverInfo.name`, falling back to the configured executable basename; no arbitrary named label can make an inactive server appear active.
|
`:lsp` displays only ready servers assigned to the focused buffer, in configured stack order joined with ` + `. Disabled, initializing, failed, or unassigned servers do not appear. Names come from the initialization reply's `serverInfo.name`, falling back to the configured executable basename; no arbitrary named label can make an inactive server appear active.
|
||||||
|
|
||||||
|
`margin` adds unstyled space outside both edges of a segment, unlike the styled internal `padding`. It accepts integers from `0` through `64`, defaults to `0`, and defaults to `1` for `:lsp` in either bar. For example, `config.bar.bottom = { lsp: { margin: 0 } }` removes LSP's external spacing without changing its padding. Margins count toward anchor placement and collision handling; empty segments consume no margin, and margins yield along with padding and edges when only clipped content fits.
|
||||||
|
|
||||||
`padding` adds spaces inside the segment's styling, on both sides of its title, and accepts integers from `0` through `64` (default `1`). `leading_edge` and `trailing_edge` are separate styled glyph strings, not padding; `""` removes an edge. Tabs default to `"░▓"` / `"▓░"` edges; mode has only the trailing `"▓░"` edge, position and battery only the leading `"░▓"` edge, and other segments have none. `first_leading_edge` optionally overrides the first occurrence's leading glyphs: for tabs this is the actual first tab, not the first tab remaining after clipping; other segments have one occurrence. Tabs default this override to `""`, suppressing the first tab's left fade. Unicode widths are measured in terminal cells. Edge strings must be single-line and contain no control characters. Unknown style keys, invalid templates, and wrong types reject configuration.
|
`padding` adds spaces inside the segment's styling, on both sides of its title, and accepts integers from `0` through `64` (default `1`). `leading_edge` and `trailing_edge` are separate styled glyph strings, not padding; `""` removes an edge. Tabs default to `"░▓"` / `"▓░"` edges; mode has only the trailing `"▓░"` edge, position and battery only the leading `"░▓"` edge, and other segments have none. `first_leading_edge` optionally overrides the first occurrence's leading glyphs: for tabs this is the actual first tab, not the first tab remaining after clipping; other segments have one occurrence. Tabs default this override to `""`, suppressing the first tab's left fade. Unicode widths are measured in terminal cells. Edge strings must be single-line and contain no control characters. Unknown style keys, invalid templates, and wrong types reject configuration.
|
||||||
|
|
||||||
Any other segment name is a custom named value, such as `:build_status`. Set initial strings with `config.labels`; an empty value hides the custom segment, including its title override, padding, and edges. Names match `[A-Za-z_][A-Za-z0-9_]*`. Labels are plain text: control characters are replaced rather than interpreted as terminal escapes. The same named value can appear in either bar.
|
Any other segment name is a custom named value, such as `:build_status`. Set initial strings with `config.labels`; an empty value hides the custom segment, including its title override, margins, padding, and edges. Names match `[A-Za-z_][A-Za-z0-9_]*`. Labels are plain text: control characters are replaced rather than interpreted as terminal escapes. The same named value can appear in either bar.
|
||||||
|
|
||||||
`:battery` displays `bat N%` from the OS, with an immediate background reading and refreshes every 30 seconds. macOS uses IOKit, Linux uses system battery sysfs entries, and Windows uses `GetSystemPowerStatus`; no shell commands run. Missing, unsupported, or unreadable batteries hide the segment. macOS/Linux currently report the first present internal/system battery; Windows uses the OS's system percentage.
|
`:battery` displays `bat N%` from the OS, with an immediate background reading and refreshes every 30 seconds. macOS uses IOKit, Linux uses system battery sysfs entries, and Windows uses `GetSystemPowerStatus`; no shell commands run. Missing, unsupported, or unreadable batteries hide the segment. macOS/Linux currently report the first present internal/system battery; Windows uses the OS's system percentage.
|
||||||
|
|
||||||
|
|||||||
+18
-23
@@ -106,6 +106,7 @@ pub struct ChromeLine {
|
|||||||
pub struct SegmentConfig {
|
pub struct SegmentConfig {
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub padding: usize,
|
pub padding: usize,
|
||||||
|
pub margin: usize,
|
||||||
pub leading_edge: String,
|
pub leading_edge: String,
|
||||||
pub trailing_edge: String,
|
pub trailing_edge: String,
|
||||||
pub first_leading_edge: Option<String>,
|
pub first_leading_edge: Option<String>,
|
||||||
@@ -116,6 +117,7 @@ impl Default for SegmentConfig {
|
|||||||
Self {
|
Self {
|
||||||
title: String::new(),
|
title: String::new(),
|
||||||
padding: 1,
|
padding: 1,
|
||||||
|
margin: 0,
|
||||||
leading_edge: String::new(),
|
leading_edge: String::new(),
|
||||||
trailing_edge: String::new(),
|
trailing_edge: String::new(),
|
||||||
first_leading_edge: None,
|
first_leading_edge: None,
|
||||||
@@ -167,11 +169,13 @@ impl ChromeLine {
|
|||||||
validate_name(name)?;
|
validate_name(name)?;
|
||||||
}
|
}
|
||||||
for (name, segment) in &self.segments {
|
for (name, segment) in &self.segments {
|
||||||
if segment.padding > 64 {
|
for (option, value) in [("padding", segment.padding), ("margin", segment.margin)] {
|
||||||
|
if value > 64 {
|
||||||
return Err(format!(
|
return Err(format!(
|
||||||
"Chrome segment {name:?} padding must be between 0 and 64"
|
"Chrome segment {name:?} {option} must be between 0 and 64"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for (option, text) in [
|
for (option, text) in [
|
||||||
("title", Some(&segment.title)),
|
("title", Some(&segment.title)),
|
||||||
("leading_edge", Some(&segment.leading_edge)),
|
("leading_edge", Some(&segment.leading_edge)),
|
||||||
@@ -198,6 +202,9 @@ impl ChromeLine {
|
|||||||
|
|
||||||
fn default_segment(name: &str) -> SegmentConfig {
|
fn default_segment(name: &str) -> SegmentConfig {
|
||||||
let mut segment = SegmentConfig::default();
|
let mut segment = SegmentConfig::default();
|
||||||
|
if name == "lsp" {
|
||||||
|
segment.margin = 1;
|
||||||
|
}
|
||||||
if matches!(name, "tabs" | "position" | "battery") {
|
if matches!(name, "tabs" | "position" | "battery") {
|
||||||
segment.leading_edge = "░▓".into();
|
segment.leading_edge = "░▓".into();
|
||||||
}
|
}
|
||||||
@@ -258,6 +265,7 @@ struct LineOptions {
|
|||||||
struct SegmentOptions {
|
struct SegmentOptions {
|
||||||
title: Option<String>,
|
title: Option<String>,
|
||||||
padding: Option<usize>,
|
padding: Option<usize>,
|
||||||
|
margin: Option<usize>,
|
||||||
leading_edge: Option<String>,
|
leading_edge: Option<String>,
|
||||||
trailing_edge: Option<String>,
|
trailing_edge: Option<String>,
|
||||||
first_leading_edge: Option<String>,
|
first_leading_edge: Option<String>,
|
||||||
@@ -304,6 +312,9 @@ fn deserialize_line<'de, D: Deserializer<'de>>(
|
|||||||
if let Some(padding) = options.padding {
|
if let Some(padding) = options.padding {
|
||||||
segment.padding = padding;
|
segment.padding = padding;
|
||||||
}
|
}
|
||||||
|
if let Some(margin) = options.margin {
|
||||||
|
segment.margin = margin;
|
||||||
|
}
|
||||||
if let Some(edge) = options.leading_edge {
|
if let Some(edge) = options.leading_edge {
|
||||||
segment.leading_edge = edge;
|
segment.leading_edge = edge;
|
||||||
}
|
}
|
||||||
@@ -402,27 +413,6 @@ mod tests {
|
|||||||
bottom: ChromeLine,
|
bottom: ChromeLine,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn bottom_keeps_metadata_on_the_right_without_filled_styles() {
|
|
||||||
let line = ChromeLine::bottom();
|
|
||||||
assert_eq!(
|
|
||||||
line.left,
|
|
||||||
[
|
|
||||||
"mode",
|
|
||||||
"pending",
|
|
||||||
"buffer",
|
|
||||||
"diagnostics",
|
|
||||||
"path",
|
|
||||||
"selections",
|
|
||||||
"count"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
assert_eq!(line.right, ["language", "lsp", "position"]);
|
|
||||||
for name in ["language", "lsp"] {
|
|
||||||
assert_eq!(line.segment(name), &SegmentConfig::default());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn omitted_options_inherit_and_explicit_groups_replace_defaults() {
|
fn omitted_options_inherit_and_explicit_groups_replace_defaults() {
|
||||||
let lines: Lines = serde_json::from_value(serde_json::json!({
|
let lines: Lines = serde_json::from_value(serde_json::json!({
|
||||||
@@ -521,6 +511,11 @@ mod tests {
|
|||||||
serde_json::json!({"left": null}),
|
serde_json::json!({"left": null}),
|
||||||
serde_json::json!({"tabs": {"padding": 65}}),
|
serde_json::json!({"tabs": {"padding": 65}}),
|
||||||
serde_json::json!({"tabs": {"padding": null}}),
|
serde_json::json!({"tabs": {"padding": null}}),
|
||||||
|
serde_json::json!({"tabs": {"margin": 65}}),
|
||||||
|
serde_json::json!({"tabs": {"margin": -1}}),
|
||||||
|
serde_json::json!({"tabs": {"margin": null}}),
|
||||||
|
serde_json::json!({"tabs": {"margin": "1"}}),
|
||||||
|
serde_json::json!({"tabs": {"margin": 1.5}}),
|
||||||
serde_json::json!({"tabs": {"leading_edge": "\n"}}),
|
serde_json::json!({"tabs": {"leading_edge": "\n"}}),
|
||||||
serde_json::json!({"tabs": {"title": "{unknown}"}}),
|
serde_json::json!({"tabs": {"title": "{unknown}"}}),
|
||||||
serde_json::json!({"tabs": {"title": "{name"}}),
|
serde_json::json!({"tabs": {"title": "{name"}}),
|
||||||
|
|||||||
@@ -1363,6 +1363,11 @@ end
|
|||||||
("bar.top", r#"{mode: {leading_edge: "\n"}}"#, "single-line"),
|
("bar.top", r#"{mode: {leading_edge: "\n"}}"#, "single-line"),
|
||||||
("bar.top", "{language: {padding: 65}}", "between 0 and 64"),
|
("bar.top", "{language: {padding: 65}}", "between 0 and 64"),
|
||||||
("bar.bottom", "{tabs: {padding: '1'}}", "must be an Integer"),
|
("bar.bottom", "{tabs: {padding: '1'}}", "must be an Integer"),
|
||||||
|
("bar.top", "{lsp: {margin: 65}}", "between 0 and 64"),
|
||||||
|
("bar.bottom", "{lsp: {margin: -1}}", "between 0 and 64"),
|
||||||
|
("bar.top", "{lsp: {margin: '1'}}", "must be an Integer"),
|
||||||
|
("bar.bottom", "{lsp: {margin: 1.5}}", "must be an Integer"),
|
||||||
|
("bar.top", "{lsp: {margin: nil}}", "must be an Integer"),
|
||||||
("bar.top", "{mode: {title: nil}}", "must be a String"),
|
("bar.top", "{mode: {title: nil}}", "must be a String"),
|
||||||
(
|
(
|
||||||
"bar.bottom",
|
"bar.bottom",
|
||||||
|
|||||||
+2
-2
@@ -35,9 +35,9 @@ module Vamp
|
|||||||
chrome_name!(name)
|
chrome_name!(name)
|
||||||
style = chrome_hash!(value).to_h do |option, item|
|
style = chrome_hash!(value).to_h do |option, item|
|
||||||
case option
|
case option
|
||||||
when "padding"
|
when "padding", "margin"
|
||||||
unless item.is_a?(Integer) && item.between?(0, 64)
|
unless item.is_a?(Integer) && item.between?(0, 64)
|
||||||
raise ArgumentError, "padding must be an Integer between 0 and 64"
|
raise ArgumentError, "#{option} must be an Integer between 0 and 64"
|
||||||
end
|
end
|
||||||
when "title", "leading_edge", "trailing_edge", "first_leading_edge"
|
when "title", "leading_edge", "trailing_edge", "first_leading_edge"
|
||||||
item = string!(item, option)
|
item = string!(item, option)
|
||||||
|
|||||||
+98
-1
@@ -1244,6 +1244,7 @@ fn chrome_items<'a>(
|
|||||||
for item in &mut items {
|
for item in &mut items {
|
||||||
item.width = item.text.width()
|
item.width = item.text.width()
|
||||||
+ item.config.padding * 2
|
+ item.config.padding * 2
|
||||||
|
+ item.config.margin * 2
|
||||||
+ if item.tab.is_none() || item.accent {
|
+ if item.tab.is_none() || item.accent {
|
||||||
item.leading_edge().width() + item.config.trailing_edge.width()
|
item.leading_edge().width() + item.config.trailing_edge.width()
|
||||||
} else {
|
} else {
|
||||||
@@ -1352,15 +1353,17 @@ fn draw_chrome(frame: &mut Frame, mut groups: [Vec<ChromeItem<'_>>; 3], area: Re
|
|||||||
};
|
};
|
||||||
let item_width = item.width;
|
let item_width = item.width;
|
||||||
let line = if item.compact || item_width > available {
|
let line = if item.compact || item_width > available {
|
||||||
// Content wins over all padding and fades on tiny terminals.
|
// Content wins over margins, padding, and fades on tiny terminals.
|
||||||
Line::from(Span::styled(visible_line(&item.text, 0, available), style))
|
Line::from(Span::styled(visible_line(&item.text, 0, available), style))
|
||||||
} else {
|
} else {
|
||||||
const PADDING: &str =
|
const PADDING: &str =
|
||||||
" ";
|
" ";
|
||||||
let padding = &PADDING[..item.config.padding];
|
let padding = &PADDING[..item.config.padding];
|
||||||
|
let margin = &PADDING[..item.config.margin];
|
||||||
let edges = item.tab.is_none() || item.accent;
|
let edges = item.tab.is_none() || item.accent;
|
||||||
let edge = Style::default().fg(Color::Cyan);
|
let edge = Style::default().fg(Color::Cyan);
|
||||||
Line::from(vec![
|
Line::from(vec![
|
||||||
|
Span::styled(margin, Style::reset()),
|
||||||
Span::styled(if edges { item.leading_edge() } else { "" }, edge),
|
Span::styled(if edges { item.leading_edge() } else { "" }, edge),
|
||||||
Span::styled(padding, style),
|
Span::styled(padding, style),
|
||||||
Span::styled(item.text.as_ref(), style),
|
Span::styled(item.text.as_ref(), style),
|
||||||
@@ -1373,6 +1376,7 @@ fn draw_chrome(frame: &mut Frame, mut groups: [Vec<ChromeItem<'_>>; 3], area: Re
|
|||||||
},
|
},
|
||||||
edge,
|
edge,
|
||||||
),
|
),
|
||||||
|
Span::styled(margin, Style::reset()),
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
let cells = item_width.min(available);
|
let cells = item_width.min(available);
|
||||||
@@ -5971,6 +5975,95 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn bar_margins_surround_styling_and_keep_anchors_and_narrow_content() {
|
||||||
|
let directory = Directory::new();
|
||||||
|
let config = directory.file(
|
||||||
|
"margins.rb",
|
||||||
|
r#"
|
||||||
|
Vamp.configure do |config|
|
||||||
|
options = {left: [:badge], center: [:lsp], right: [:badge],
|
||||||
|
badge: {padding: 0, margin: 2, leading_edge: "<", trailing_edge: ">"}, lsp: {padding: 0}}
|
||||||
|
config.bar.top = options
|
||||||
|
config.bar.bottom = options
|
||||||
|
end
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
let config = crate::ruby::load_config(&config).unwrap();
|
||||||
|
let mut editor = Editor::open(None, vec![]).unwrap();
|
||||||
|
editor
|
||||||
|
.set_chrome_config(config.top_bar, config.bottom_bar, config.labels)
|
||||||
|
.unwrap();
|
||||||
|
editor.set_label("badge".into(), "界".into()).unwrap();
|
||||||
|
editor.set_lsp_names(vec!["server".into()]);
|
||||||
|
let mut terminal = Terminal::new(ratatui::backend::TestBackend::new(41, 3)).unwrap();
|
||||||
|
terminal
|
||||||
|
.draw(|frame| {
|
||||||
|
for (line, y) in [
|
||||||
|
(editor.top_bar_config(), 0),
|
||||||
|
(editor.bottom_bar_config(), 2),
|
||||||
|
] {
|
||||||
|
draw_chrome(
|
||||||
|
frame,
|
||||||
|
chrome_groups(&editor, line, &SyntaxCache::new()),
|
||||||
|
Rect::new(0, y, 41, 1),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
let buffer = terminal.backend().buffer();
|
||||||
|
for y in [0, 2] {
|
||||||
|
for x in [0, 1, 6, 7, 16, 23, 33, 34, 39, 40] {
|
||||||
|
assert_eq!(buffer[(x, y)].symbol(), " ");
|
||||||
|
assert_eq!(buffer[(x, y)].bg, Color::Reset);
|
||||||
|
}
|
||||||
|
for x in [3, 36] {
|
||||||
|
assert_eq!(buffer[(x, y)].symbol(), "界");
|
||||||
|
assert_eq!(buffer[(x, y)].bg, Color::Cyan);
|
||||||
|
}
|
||||||
|
for (x, symbol) in [(2, "<"), (5, ">"), (35, "<"), (38, ">")] {
|
||||||
|
assert_eq!(buffer[(x, y)].symbol(), symbol);
|
||||||
|
assert_eq!(buffer[(x, y)].fg, Color::Cyan);
|
||||||
|
}
|
||||||
|
for (offset, ch) in "server".chars().enumerate() {
|
||||||
|
assert_eq!(buffer[(17 + offset as u16, y)].symbol(), ch.to_string());
|
||||||
|
assert_eq!(buffer[(17 + offset as u16, y)].bg, Color::Cyan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
configure_chrome(&mut editor, |top, bottom| {
|
||||||
|
for line in [top, bottom] {
|
||||||
|
line.left = vec!["lsp".into()];
|
||||||
|
line.center.clear();
|
||||||
|
line.right.clear();
|
||||||
|
let lsp = line.segments.get_mut("lsp").unwrap();
|
||||||
|
lsp.margin = 64;
|
||||||
|
lsp.padding = 64;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let mut narrow = Terminal::new(ratatui::backend::TestBackend::new(6, 2)).unwrap();
|
||||||
|
narrow
|
||||||
|
.draw(|frame| {
|
||||||
|
for (line, y) in [
|
||||||
|
(editor.top_bar_config(), 0),
|
||||||
|
(editor.bottom_bar_config(), 1),
|
||||||
|
] {
|
||||||
|
draw_chrome(
|
||||||
|
frame,
|
||||||
|
chrome_groups(&editor, line, &SyntaxCache::new()),
|
||||||
|
Rect::new(0, y, 6, 1),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
for y in [0, 1] {
|
||||||
|
assert_eq!(pane_screen(&narrow, Rect::new(0, y, 6, 1)), "server");
|
||||||
|
}
|
||||||
|
editor.set_lsp_names(Vec::new());
|
||||||
|
for line in [editor.top_bar_config(), editor.bottom_bar_config()] {
|
||||||
|
assert!(chrome_groups(&editor, line, &SyntaxCache::new())[0].is_empty());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn floating_fields_use_border_titles_and_inner_horizontal_padding() {
|
fn floating_fields_use_border_titles_and_inner_horizontal_padding() {
|
||||||
for (prefix, title) in [(':', "Command"), ('/', "Search")] {
|
for (prefix, title) in [(':', "Command"), ('/', "Search")] {
|
||||||
@@ -6656,6 +6749,7 @@ mod tests {
|
|||||||
SegmentConfig {
|
SegmentConfig {
|
||||||
title: String::new(),
|
title: String::new(),
|
||||||
padding: 0,
|
padding: 0,
|
||||||
|
margin: 0,
|
||||||
leading_edge: String::new(),
|
leading_edge: String::new(),
|
||||||
trailing_edge: String::new(),
|
trailing_edge: String::new(),
|
||||||
first_leading_edge: None,
|
first_leading_edge: None,
|
||||||
@@ -6819,6 +6913,7 @@ mod tests {
|
|||||||
SegmentConfig {
|
SegmentConfig {
|
||||||
title: "{index}".into(),
|
title: "{index}".into(),
|
||||||
padding: 2,
|
padding: 2,
|
||||||
|
margin: 0,
|
||||||
leading_edge: "界▌".into(),
|
leading_edge: "界▌".into(),
|
||||||
trailing_edge: "▐界".into(),
|
trailing_edge: "▐界".into(),
|
||||||
first_leading_edge: Some("<".into()),
|
first_leading_edge: Some("<".into()),
|
||||||
@@ -6829,6 +6924,7 @@ mod tests {
|
|||||||
SegmentConfig {
|
SegmentConfig {
|
||||||
title: String::new(),
|
title: String::new(),
|
||||||
padding: 2,
|
padding: 2,
|
||||||
|
margin: 0,
|
||||||
leading_edge: "界(".into(),
|
leading_edge: "界(".into(),
|
||||||
trailing_edge: ")界".into(),
|
trailing_edge: ")界".into(),
|
||||||
first_leading_edge: None,
|
first_leading_edge: None,
|
||||||
@@ -6925,6 +7021,7 @@ mod tests {
|
|||||||
SegmentConfig {
|
SegmentConfig {
|
||||||
title: "Not visible without a value".into(),
|
title: "Not visible without a value".into(),
|
||||||
padding: 64,
|
padding: 64,
|
||||||
|
margin: 0,
|
||||||
leading_edge: "░▒▓".into(),
|
leading_edge: "░▒▓".into(),
|
||||||
trailing_edge: "▓▒░".into(),
|
trailing_edge: "▓▒░".into(),
|
||||||
first_leading_edge: None,
|
first_leading_edge: None,
|
||||||
|
|||||||
Reference in New Issue
Block a user