Skip to content
gpdoc
Playground

Gap cursor

Place the caret between closed blocks in a GPUI editor.

Click halfway between the two horizontal rules. A short blue line marks the gap. Press Right Arrow to select the second rule.

Terminal window
cargo add gpdoc-plugin-gap-cursor
use gpdoc_plugin_gap_cursor::{gap_cursor, paint_gap_cursor};
use gpdoc_plugin_paragraph::paragraph;
let config = gpdoc::EditorConfig::builder()
.plugin(paragraph())
.plugin(gap_cursor().with_view(paint_gap_cursor))
.build()
.expect("configure editor");

To draw a different marker, pass a painter to .with_view(...) taking Bounds<Pixels>, &mut Window, and &mut App. The plugin locates the boundary and handles keyboard and pointer navigation.

Open a document with two adjacent closed blocks, such as horizontal rules. Click their shared boundary to select the gap. In a focused editor, a short horizontal line marks the insertion point.

From a selected node, the arrow keys move to an adjacent gap. From a gap, they select the neighboring node in that direction.

gap-cursor/src/lib.rs