Skip to content

editor: Add minimap #26893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 121 commits into from
May 7, 2025
Merged
Changes from 1 commit
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
4ae4208
First attempt at minimap, currently getting stack overflow
esimkowitz Mar 17, 2025
ca33b7b
save work
esimkowitz Mar 17, 2025
13f1355
okay I've got the minimap displaying without a stack overflow, but now I
esimkowitz Mar 17, 2025
d477cc0
scrollbar is now visible, fixed sizing
esimkowitz Mar 17, 2025
f5365dd
Fix clippy error
esimkowitz Mar 17, 2025
141e767
Fix minimap offset
esimkowitz Mar 17, 2025
56cc5ce
don't scroll horizontally, increase font weight
esimkowitz Mar 17, 2025
67e0276
fix upper margin
esimkowitz Mar 17, 2025
8dcbfed
Disable diagnostics for minimap
esimkowitz Mar 17, 2025
c606295
Fix visibility of scrollbar
esimkowitz Mar 17, 2025
99e6971
fix horizontal scrollbar track width when minimap is shown
esimkowitz Mar 17, 2025
8d2062a
Disable autoscroll, indent guides, and a few other features for minimap
esimkowitz Mar 17, 2025
921594c
save work, adding logic for computing slider position and scroll
esimkowitz Mar 18, 2025
dbfe093
Got slider thumb displaying, now I just need to hook it up to the mouse
esimkowitz Mar 18, 2025
4caa83a
improve positioning logic
esimkowitz Mar 18, 2025
ffe1d7c
remove commented code
esimkowitz Mar 18, 2025
5bb7c57
Add user settings, disable mouse listeners for minimap, add mouse hover
esimkowitz Mar 24, 2025
42226c4
fix too much overscrolling if minimap contents is less than height
esimkowitz Mar 24, 2025
e56731e
clicking on the minimap navigates to the intended section
esimkowitz Mar 25, 2025
6b625a1
dragging now works too
esimkowitz Mar 25, 2025
b638eb1
remove conflicting delay in hiding slider
esimkowitz Mar 25, 2025
0aa9ea1
fix regression in hide_minimap_slider
esimkowitz Mar 25, 2025
8211776
update default.json to indicate default slider value
esimkowitz Mar 25, 2025
01209d7
Merge branch 'main' into evan/minimap
esimkowitz Mar 25, 2025
561ffef
address comments
esimkowitz Mar 25, 2025
e763ca8
fix improper percent completion calculation when dragging slider thumb
esimkowitz Mar 25, 2025
a475858
hook up font_size setting
esimkowitz Mar 25, 2025
002ca4c
clean up variable naming
esimkowitz Mar 25, 2025
81856e3
fix minimap height calculation
esimkowitz Mar 25, 2025
d03ae42
Apply latest changes from main
MrSubidubi Mar 25, 2025
c200fec
Merge pull request #1 from MrSubidubi/apply-merge-changes
esimkowitz Mar 26, 2025
902670f
rename slider to thumb
esimkowitz Mar 26, 2025
ba71562
set thumb visibility default to always
esimkowitz Mar 26, 2025
ab49a2a
fix bad replace all typo
esimkowitz Mar 26, 2025
7db7b0f
Merge branch 'main' into evan/minimap
esimkowitz Mar 26, 2025
8c783c0
Attempt to fix vim conflict
esimkowitz Mar 26, 2025
490c0f5
fix editor width bug when minimap is not visible
esimkowitz Mar 26, 2025
5d8253e
Merge branch 'main' into evan/minimap
esimkowitz Mar 26, 2025
fb06d23
Fix minimap auto visibility
esimkowitz Mar 29, 2025
8f4be66
Merge branch 'main' into evan/minimap
esimkowitz Mar 29, 2025
016f0e6
fix set_cursor_style regression from merge
esimkowitz Mar 29, 2025
6f3bcd8
fix soft wrapping behavior in minimap
esimkowitz Mar 31, 2025
fff93b0
Merge branch 'main' into minimap-tests
MrSubidubi Apr 1, 2025
7e310d1
Idea for minimap scroll
MrSubidubi Apr 2, 2025
9663025
Some cleanup, fix scroll for this method
MrSubidubi Apr 2, 2025
4513c08
save
esimkowitz Apr 3, 2025
6ae7d2f
Merge branch 'main' into evan/minimap
esimkowitz Apr 3, 2025
4de58be
Merge branch 'evan/minimap' into minimap-scroll
esimkowitz Apr 3, 2025
4a1261b
Merge branch 'main' into evan/minimap
esimkowitz Apr 3, 2025
8d1a198
make scrollbarlayoutinformation a ref
esimkowitz Apr 3, 2025
95d3cd7
Cache display map
MrSubidubi Apr 3, 2025
e5628ca
Disable gutter in minimap
MrSubidubi Apr 3, 2025
8cf2ec3
Merge pull request #4 from MrSubidubi/disable-line-gutter
esimkowitz Apr 4, 2025
0427841
fix unsigned subtract panic
esimkowitz Apr 4, 2025
973c159
add back minimap width calculation
esimkowitz Apr 4, 2025
ded03cc
Merge branch 'evan/minimap' into display-map-clone
esimkowitz Apr 4, 2025
baffaad
clean up var names
esimkowitz Apr 4, 2025
4d6baba
Reuse some more
MrSubidubi Apr 4, 2025
23ac3f4
Merge branch 'main' into evan/minimap
esimkowitz Apr 14, 2025
dcd4f63
missed fixes
esimkowitz Apr 14, 2025
2a1c041
clean up rem_size
esimkowitz Apr 14, 2025
b60fcfd
Merge branch 'evan/minimap' into display-map-clone
esimkowitz Apr 14, 2025
3eae29f
Merge branch 'display-map-clone' of github.com:MrSubidubi/zed into di…
esimkowitz Apr 14, 2025
b559d24
Wrapping works - rework approach
MrSubidubi Apr 17, 2025
67af4aa
Add `is_minimap`, some cleanup
MrSubidubi Apr 17, 2025
c06731e
Hm, Clippy....
MrSubidubi Apr 17, 2025
7525231
Use font-size instead of em-advance
MrSubidubi Apr 17, 2025
9465dbc
Remove mode change
MrSubidubi Apr 17, 2025
e5a0cdf
Merge pull request #3 from MrSubidubi/display-map-clone
esimkowitz Apr 17, 2025
f55d411
Merge branch 'main' into evan/minimap
esimkowitz Apr 17, 2025
9962ad0
Some cleanups
MrSubidubi Apr 17, 2025
ff438e3
Disable diagnostic underlines in minimap
MrSubidubi Apr 17, 2025
4aa6c06
Revert accidental change
MrSubidubi Apr 17, 2025
b75ffbb
Clippy
MrSubidubi Apr 17, 2025
745cb7a
Remove minimap check
MrSubidubi Apr 17, 2025
b750ee7
Minimize Changes to `rem_size`
MrSubidubi Apr 17, 2025
2ed7f86
Consider minimap width for editor soft wrap
MrSubidubi Apr 17, 2025
a39a288
Clean up some more
MrSubidubi Apr 17, 2025
abb4d7f
Also consider forcefully disabled scrollbar
MrSubidubi Apr 17, 2025
d4752da
Fix Vim-test
MrSubidubi Apr 17, 2025
7f02733
Fix various scrolling issues
MrSubidubi Apr 18, 2025
512ca9a
Only consider minimap for editor width when editor has a minimap
MrSubidubi Apr 18, 2025
932a968
Disable editor serialization for minimap
MrSubidubi Apr 18, 2025
dbeef58
Clone `display_map` of associated editor
MrSubidubi Apr 19, 2025
920b19c
Small fixes
SomeoneToIgnore Apr 24, 2025
9374267
Merge branch 'main' into kb/mimimap
SomeoneToIgnore Apr 24, 2025
1e161d1
Show selections and other background highlights inside the minimap
SomeoneToIgnore Apr 24, 2025
a231c25
Merge pull request #5 from zed-industries/kb/mimimap
MrSubidubi Apr 25, 2025
e43e2d6
Resolve conflicts
MrSubidubi Apr 26, 2025
fa4c67b
Add a way to programmatically disable the minimap
MrSubidubi Apr 26, 2025
40644c4
Fix an issue where space for the scrollbar was reserved even when scr…
MrSubidubi Apr 26, 2025
a199290
Stop hover events from propagating
MrSubidubi Apr 26, 2025
ac52140
Fade out minimap background color
MrSubidubi Apr 26, 2025
c240e06
Add small drop shadow
MrSubidubi Apr 26, 2025
a7a9023
Naively enable scrolling on minimap even if clicking outside of the t…
MrSubidubi Apr 26, 2025
b122cad
Add `thumb_border` setting to specify how a thumb should be rendered.
MrSubidubi Apr 26, 2025
eb1c371
Fix scroll flickering whilst typing on the longest line
MrSubidubi Apr 27, 2025
2fac6df
Swap scrollbar <-> minimap paint order
MrSubidubi Apr 27, 2025
e422f4e
Another batch of scrolling fixes
MrSubidubi Apr 27, 2025
865c5d1
Cleanup some methods
MrSubidubi Apr 27, 2025
7362afd
Improve placement of some controls
MrSubidubi Apr 29, 2025
ec9b54d
Consider minimap width for edit prediction popovers as well
MrSubidubi Apr 30, 2025
e648c11
Paint git row line highlights in the minimap
MrSubidubi Apr 30, 2025
1329d6d
Make minimap editor read-only
MrSubidubi Apr 30, 2025
e8ee3b2
Disable rendering of blocks in the minimap for now
MrSubidubi Apr 30, 2025
4bfa409
Merge branch 'main' into evan/minimap
MrSubidubi Apr 30, 2025
b4aa1f1
Prevent any buttuns from being layouted and rendered behind the minimap
MrSubidubi May 1, 2025
1898646
Re-enable rendering of blocks in the minimap, add more granular control
MrSubidubi May 2, 2025
33233b0
Add setting for highlighting the current line in the minimap
MrSubidubi May 2, 2025
54503f2
Remove minimap font size setting
MrSubidubi May 2, 2025
1813bc8
Remove minimap width setting
MrSubidubi May 2, 2025
d32eb7b
Fix various soft break issues
MrSubidubi May 3, 2025
57685a6
Merge branch 'main' into evan/minimap
MrSubidubi May 3, 2025
2bbb2ed
Resolve conflicts
MrSubidubi May 4, 2025
13893f7
Do not render the minimap if it would take up most of the available e…
MrSubidubi May 4, 2025
f7a3f69
Do not pass scroll position a reference
MrSubidubi May 6, 2025
fa423dc
Ensure layouting stays the same as before
MrSubidubi May 6, 2025
fe537d2
Make current line highlight inherit editor line highlight by default
MrSubidubi May 6, 2025
b574129
Disable addon registering for the minimap
MrSubidubi May 6, 2025
83c6dca
Update `current_line_highlight` setting, stop storing minimap setting…
MrSubidubi May 7, 2025
49cd65b
Merge branch 'main' into evan/minimap
MrSubidubi May 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
save work
  • Loading branch information
esimkowitz committed Mar 17, 2025
commit ca33b7be73e49f72028881a5dc8e7bc4782135f9
42 changes: 22 additions & 20 deletions crates/editor/src/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1486,32 +1486,32 @@ impl EditorElement {
&self,
window: &mut Window,
cx: &mut App,
snapshot: &EditorSnapshot,
bounds: Bounds<Pixels>,
editor_width: Pixels,
) -> Option<AnyElement> {
let minimap_elem = self.editor.update(cx, |editor, cx| {
let mut editor_clone = editor.clone(window, cx);
if editor_clone.mode() != EditorMode::Full {
return None;
}
editor_clone.mode = EditorMode::Minimap;
editor_clone.set_text_style_refinement(TextStyleRefinement {
font_size: Some(px(1.).into()),
..Default::default()
});
Some(editor_clone.render(window, cx).into_any_element())
});
match snapshot.mode {
EditorMode::Full => {
let mut minimap_elem = self.editor.update(cx, |editor, cx| {
let mut editor_clone = editor.clone(window, cx);
editor_clone.mode = EditorMode::Minimap;
editor_clone.set_text_style_refinement(TextStyleRefinement {
font_size: Some(px(1.).into()),
..Default::default()
});
editor_clone.render(window, cx).into_any_element()
});

match minimap_elem {
Some(mut element) => {
let mut minimap_bounds = bounds.clone();
minimap_bounds.size.width = editor_width * 0.3;
minimap_bounds.origin.x = editor_width * 0.7;
let size = element.layout_as_root(minimap_bounds.size.into(), window, cx);
element.prepaint_as_root(minimap_bounds.origin.into(), size.into(), window, cx);
Some(element)
_ = minimap_elem.layout_as_root(minimap_bounds.size.into(), window, cx);
window.with_absolute_element_offset(minimap_bounds.origin, |window| {
minimap_elem.prepaint(window, cx)
});
Some(minimap_elem)
}
None => None,
_ => None,
}
}

Expand Down Expand Up @@ -7373,8 +7373,6 @@ impl Element for EditorElement {
}
}

let minimap = self.layout_minimap(window, cx, bounds, editor_width);

self.layout_gutter_menu(
line_height,
&text_hitbox,
Expand Down Expand Up @@ -7456,6 +7454,10 @@ impl Element for EditorElement {
self.prepaint_expand_toggles(&mut expand_toggles, window, cx)
});

let minimap = window.with_element_namespace("minimap", |window| {
self.layout_minimap(window, cx, &snapshot, bounds, editor_width)
});

let invisible_symbol_font_size = font_size / 2.;
let tab_invisible = window
.text_system()
Expand Down