Skip to content

Commit

Permalink
fix: render rulers before the cursor
Browse files Browse the repository at this point in the history
Render rulers before the cursor to ensure that the cursor, when over
a ruler, is not hidden from view. Without this, you typically end up
with 1) foreground text that is the same as the background if the
ruler doesn't already have a foreground and 2) no visible cursor,
because the ruler's background color took precedence. By moving the
rulers before the cursor, this ensures that the theme is still rendered
more or less the way one would visually expect things to turn out.

Related to helix-editor#7371. Not submitting this as a patch
because it doesn't seem like this is the desired solution, but it
thankfully works perfectly for me.
  • Loading branch information
nilium committed Aug 16, 2024
1 parent 079f544 commit d7fe603
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ impl EditorView {
);
}

Self::render_rulers(editor, doc, view, inner, surface, theme);
if is_focused {
let cursor = doc
.selection(view.id)
Expand All @@ -204,7 +205,6 @@ impl EditorView {
&mut line_decorations,
&mut translated_positions,
);
Self::render_rulers(editor, doc, view, inner, surface, theme);

// if we're not at the edge of the screen, draw a right border
if viewport.right() != view.area.right() {
Expand Down

0 comments on commit d7fe603

Please sign in to comment.