From fd02d1bf8966754624c733790c20bb8431e1eb54 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Fri, 4 Mar 2022 11:01:33 +0900 Subject: Fix tab rendering to use dynamic tab width Each tab is just wide enough to round to the nearest tab stop. Refs #1243 --- helix-core/src/position.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'helix-core') diff --git a/helix-core/src/position.rs b/helix-core/src/position.rs index 17908d7a..ce37300a 100644 --- a/helix-core/src/position.rs +++ b/helix-core/src/position.rs @@ -83,7 +83,7 @@ pub fn visual_coords_at_pos(text: RopeSlice, pos: usize, tab_width: usize) -> Po for grapheme in RopeGraphemes::new(text.slice(line_start..pos)) { if grapheme == "\t" { - col += tab_width; + col += tab_width - (col % tab_width); } else { let grapheme = Cow::from(grapheme); col += grapheme_width(&grapheme); -- cgit v1.2.3-70-g09d2