@@ -126,6 +126,7 @@ impl EditorView {
127 Self::render_text_highlights(doc, view.offset, inner, surface, theme, highlights);
127 Self::render_text_highlights(doc, view.offset, inner, surface, theme, highlights);
128 Self::render_gutter(editor, doc, view, view.area, surface, theme, is_focused);
128 Self::render_gutter(editor, doc, view, view.area, surface, theme, is_focused);
129+ Self::render_rulers(editor, doc, view, inner, surface, theme);
130 if is_focused {
131 if is_focused {
131 Self::render_focused_view_elements(view, doc, inner, theme, surface);
132 Self::render_focused_view_elements(view, doc, inner, theme, surface);
@@ -152,6 +153,32 @@ impl EditorView {
152 self.render_statusline(doc, view, statusline_area, surface, theme, is_focused);
153 self.render_statusline(doc, view, statusline_area, surface, theme, is_focused);
156+ pub fn render_rulers(
161+ surface: &mut Surface,
164+ let editor_rulers = &editor.config().rulers;
165+ let ruler_theme = theme.get("ui.virtual.ruler");
169+ .and_then(|config| config.rulers.as_ref())
170+ .unwrap_or(editor_rulers);
174+ // View might be horizontally scrolled, convert from absolute distance
175+ // from the 1st column to relative distance from left of viewport
176+ .filter_map(|ruler| ruler.checked_sub(1 + view.offset.col as u16))
177+ .filter(|ruler| ruler < &viewport.width)
178+ .map(|ruler| viewport.clip_left(ruler).with_width(1))
179+ .for_each(|area| surface.set_style(area, ruler_theme))
155 /// Get syntax highlights for a document in a view represented by the first line
182 /// Get syntax highlights for a document in a view represented by the first line
156 /// and column (`offset`) and the last line. This is done instead of using a view
183 /// and column (`offset`) and the last line. This is done instead of using a view
157 /// directly to enable rendering syntax highlighted docs anywhere (eg. picker preview)
184 /// directly to enable rendering syntax highlighted docs anywhere (eg. picker preview)