From 755c51fb6de68e80a77f9414b9e375b17554ce4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Daron?= Date: Mon, 16 Sep 2024 13:21:56 +0200 Subject: [PATCH] fixing cursor colunm --- helix-view/src/editor/variable_expansion.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/helix-view/src/editor/variable_expansion.rs b/helix-view/src/editor/variable_expansion.rs index 85985a177..e50bb0ffb 100644 --- a/helix-view/src/editor/variable_expansion.rs +++ b/helix-view/src/editor/variable_expansion.rs @@ -1,3 +1,5 @@ +use helix_core::coords_at_pos; + use crate::Editor; use std::borrow::Cow; @@ -93,12 +95,14 @@ impl Editor { .cursor_line(doc.text().slice(..)) + 1) .to_string(), - "cursorcolumn" => (doc - .selection(view.id) - .primary() - .cursor(doc.text().slice(..)) - + 1) - .to_string(), + "cursorcolumn" => (coords_at_pos( + doc.text().slice(..), + doc.selection(view.id) + .primary() + .cursor(doc.text().slice(..)), + ) + .col + 1) + .to_string(), "lang" => doc.language_name().unwrap_or("text").to_string(), "ext" => doc .relative_path()