fix: restore tab and diff context through jump history
This commit is contained in:
+38
-3
@@ -205,7 +205,7 @@ fn default_segment(name: &str) -> SegmentConfig {
|
||||
segment.trailing_edge = "▓▒░".into();
|
||||
}
|
||||
if name == "tabs" {
|
||||
segment.title = "{index} {name}{modified}".into();
|
||||
segment.title = "{index} {view}{name}{modified}".into();
|
||||
segment.first_leading_edge = Some(String::new());
|
||||
}
|
||||
segment
|
||||
@@ -234,9 +234,9 @@ fn validate_title(title: &str) -> Result<(), String> {
|
||||
}
|
||||
let end = rest.find('}').ok_or("title contains an unmatched '{'")?;
|
||||
let placeholder = &rest[1..end];
|
||||
if !matches!(placeholder, "index" | "name" | "path" | "modified") {
|
||||
if !matches!(placeholder, "index" | "view" | "name" | "path" | "modified") {
|
||||
return Err(format!(
|
||||
"unknown title placeholder {{{placeholder}}}; expected index, name, path, or modified"
|
||||
"unknown title placeholder {{{placeholder}}}; expected index, view, name, path, or modified"
|
||||
));
|
||||
}
|
||||
rest = &rest[end + 1..];
|
||||
@@ -480,6 +480,41 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn view_placeholder_is_valid_in_every_segment_and_bar() {
|
||||
for name in [
|
||||
"tabs",
|
||||
"mode",
|
||||
"pending",
|
||||
"buffer",
|
||||
"diagnostics",
|
||||
"path",
|
||||
"selections",
|
||||
"count",
|
||||
"language",
|
||||
"lsp",
|
||||
"position",
|
||||
"battery",
|
||||
"workspace",
|
||||
] {
|
||||
let options = serde_json::json!({
|
||||
"left": [name],
|
||||
(name): {"title": "{index}:{view}{name}:{path}{modified}"}
|
||||
});
|
||||
let lines: Lines = serde_json::from_value(serde_json::json!({
|
||||
"top": options,
|
||||
"bottom": options,
|
||||
}))
|
||||
.unwrap();
|
||||
for line in [&lines.top, &lines.bottom] {
|
||||
assert_eq!(
|
||||
line.segment(name).title,
|
||||
"{index}:{view}{name}:{path}{modified}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn malformed_chrome_is_rejected_at_the_boundary() {
|
||||
for options in [
|
||||
|
||||
Reference in New Issue
Block a user