fix: make bookmark diff selection a name-first list

Bookmarks shared revision-graph rendering, allowing ancestry lanes and revision metadata to crowd out reference names. Restrict graph projection to Revisions and reuse flat bookmark rows with commit summaries.
This commit is contained in:
Valdemar Lorenzen
2026-11-05 14:42:04 +01:00
parent e3d44f24c0
commit 1afc896cab
6 changed files with 93 additions and 32 deletions
+4
View File
@@ -1605,6 +1605,10 @@ impl DiffState {
}
fn rebuild_picker_graph(&mut self) {
if self.categories().get(self.category) != Some(&Category::Revisions) {
self.picker_graph.clear();
return;
}
let mut result = BTreeMap::new();
let Some(catalog) = &self.catalog else {
self.picker_graph = result;
+1 -1
View File
@@ -85,7 +85,7 @@ Restart: :restart closes clean buffers; unsaved buffers remain open and block re
Tabs: :tab.new, :tab.previous, :tab.next, :tab.close, :tab.force_close
Tabs retain pane layouts and independent views; close protects exclusively displayed unsaved edits
Markdown links: :follow_link (primary caret; local files only)
Diff: :diff (Normal); floating jj log graph; choose Before then After; selected Before is marked inline
Diff: :diff (Normal); floating jj revision graph / bookmark list; choose Before then After; Before marked inline
Before and historical/remote After stay read-only; Tab/Shift+Tab categories/Normal focus
All text panes use native motions, selections and copy; read-only panes reject edits/saves
Switching Before/After preserves the aligned cursor row and display column
+10 -10
View File
@@ -3905,20 +3905,15 @@ fn draw_diff(
let width = usize::from(results.width);
let change = metadata.change_id.as_str();
let change = change.get(..12).unwrap_or(change);
let bookmark = if revision.category == crate::diff::Category::Bookmarks {
format!("[{}] ", display_text(&revision.label))
} else {
String::new()
};
let label = format!(
"{} {}{bookmark}{}{} {} {} {} {}",
"{} {}{}{} {} {} {} {}",
if index == diff.selected { ">" } else { " " },
prefix[0],
display_text(change),
before_badge,
display_text(&metadata.author),
display_text(&metadata.timestamp),
if metadata.bookmarks.is_empty() || !bookmark.is_empty() {
if metadata.bookmarks.is_empty() {
String::new()
} else {
format!("[{}]", display_text(&metadata.bookmarks))
@@ -3939,7 +3934,7 @@ fn draw_diff(
lines.push(Line::styled(
visible_line(
&format!(
"{} {}{}{}{bookmark}{} · {}",
"{} {}{}{}{} · {}",
if index == diff.selected { ">" } else { " " },
prefix[0],
if prefix[1].contains('~') { "~ " } else { "" },
@@ -3975,6 +3970,11 @@ fn draw_diff(
display_text(&revision.label),
padding = decoration_width.saturating_sub(symbol.width()),
);
let description = diff
.graph_revision(revision)
.map_or(revision.description.as_str(), |(_, metadata)| {
metadata.description.as_str()
});
let width = usize::from(results.width);
if row_height == 2 {
lines.push(Line::styled(visible_line(&label, 0, width), style));
@@ -3983,7 +3983,7 @@ fn draw_diff(
&format!(
"{:indent$}{}",
"",
display_text(&revision.description),
display_text(description),
indent = 2 + decoration_width,
),
0,
@@ -3994,7 +3994,7 @@ fn draw_diff(
} else {
lines.push(Line::styled(
visible_line(
&format!("{label} · {}", display_text(&revision.description)),
&format!("{label} · {}", display_text(description)),
0,
width,
),