fix: restore compact border preview
This commit is contained in:
1 parent
773e57dd76
commit
31d56f80fa
1 file changed
+25
@@ -1070,6 +1070,12 @@ fn global_field_line(state: &State, index: usize, label: &str) -> Line<'static>
|
|||||||
Span::styled(
|
Span::styled(
|
||||||
if editing || matches!(index, 3 | 4 | 8 | 9 | 10) {
|
if editing || matches!(index, 3 | 4 | 8 | 9 | 10) {
|
||||||
String::new()
|
String::new()
|
||||||
|
} else if index == 1 {
|
||||||
|
format!(
|
||||||
|
"{} {}",
|
||||||
|
border_preview(&state.theme.border_style),
|
||||||
|
state.display_value(index)
|
||||||
|
)
|
||||||
} else if index == 2 && state.config.ui.image_protocol == ImageProtocol::Auto {
|
} else if index == 2 && state.config.ui.image_protocol == ImageProtocol::Auto {
|
||||||
state.detected_image_protocol.to_owned()
|
state.detected_image_protocol.to_owned()
|
||||||
} else {
|
} else {
|
||||||
@@ -1114,6 +1120,15 @@ fn global_field_line(state: &State, index: usize, label: &str) -> Line<'static>
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn border_preview(style: &BorderStyle) -> &'static str {
|
||||||
|
match style {
|
||||||
|
BorderStyle::Plain => "┌─",
|
||||||
|
BorderStyle::Rounded => "╭─",
|
||||||
|
BorderStyle::Double => "╔═",
|
||||||
|
BorderStyle::Thick => "┏━",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn restart_required_for(state: &State, index: usize) -> bool {
|
fn restart_required_for(state: &State, index: usize) -> bool {
|
||||||
let current = crate::config::SETTINGS.read();
|
let current = crate::config::SETTINGS.read();
|
||||||
match index {
|
match index {
|
||||||
@@ -1307,6 +1322,11 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn appearance_rows_use_inline_controls() {
|
fn appearance_rows_use_inline_controls() {
|
||||||
let mut state = State::new();
|
let mut state = State::new();
|
||||||
|
assert!(matches!(
|
||||||
|
border_preview(&state.theme.border_style),
|
||||||
|
"┌─" | "╭─" | "╔═" | "┏━"
|
||||||
|
));
|
||||||
|
|
||||||
state.selected = 0;
|
state.selected = 0;
|
||||||
state.handle_key(&KeyEvent::from(KeyCode::Enter));
|
state.handle_key(&KeyEvent::from(KeyCode::Enter));
|
||||||
assert!(state.theme_picker);
|
assert!(state.theme_picker);
|
||||||
@@ -1343,6 +1363,11 @@ mod tests {
|
|||||||
assert!(screen.contains("Auto"));
|
assert!(screen.contains("Auto"));
|
||||||
assert!(screen.contains("Clear caches"));
|
assert!(screen.contains("Clear caches"));
|
||||||
assert!(screen.contains("Rebuild provider and Java metadata"));
|
assert!(screen.contains("Rebuild provider and Java metadata"));
|
||||||
|
assert!(
|
||||||
|
["┌─", "╭─", "╔═", "┏━"]
|
||||||
|
.iter()
|
||||||
|
.any(|preview| screen.contains(preview))
|
||||||
|
);
|
||||||
assert_eq!(screen.matches("-Xfoo").count(), 1);
|
assert_eq!(screen.matches("-Xfoo").count(), 1);
|
||||||
assert_eq!(screen.matches("FOO=bar").count(), 1);
|
assert_eq!(screen.matches("FOO=bar").count(), 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user