From 3c17265acbb5c039bbb7fc980c43053f2cc0f6a0 Mon Sep 17 00:00:00 2001 From: Matthew Toohey Date: Tue, 7 Jun 2022 08:30:30 -0400 Subject: [PATCH] style: include comment to explain `pos_at_visual_coords` breaking condition --- helix-core/src/position.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helix-core/src/position.rs b/helix-core/src/position.rs index 01aeb9d24dd2..f456eb988186 100644 --- a/helix-core/src/position.rs +++ b/helix-core/src/position.rs @@ -156,6 +156,8 @@ pub fn pos_at_visual_coords(text: RopeSlice, coords: Position, tab_width: usize) grapheme_width(&grapheme) }; + // If pos is in the middle of a wider grapheme (tab for example) + // return the starting offset. if grapheme_width > cols_remaining { break; }