You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pix_grid.rs
+11-9Lines changed: 11 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -148,17 +148,19 @@ pub fn cursor_x(
148
148
return(space_width, x,0.0);
149
149
};
150
150
151
-
// FIXME (#3): cursor on multibyte char isn't visible. (e.g. on 2nd byte of "é")
152
-
// the issue comes from "cursor_width", which is set to `0`.
153
151
if col + n > cursor_col {
154
-
let m = cursor_col - col;
155
-
let text = line.to_string(col, col + n);
156
152
let analysis = item.analysis();
157
-
let(start, end) = (
158
-
unscale!(glyph_string.index_to_x(&text, analysis, m asi32,false)),
159
-
unscale!(glyph_string.index_to_x(&text, analysis, m asi32,true)),
160
-
);
161
-
cursor_width = end - start;
153
+
154
+
// We can't use the same technique as in PixLine::update, because items are typically grouped in words and here we need to analyse position and width inside a word.
155
+
// TODO: optimize
156
+
letmut s = String::new();
157
+
for cell in line.line[col..cursor_col].iter(){
158
+
s.push_str(&cell.ch);
159
+
}
160
+
let start = unscale!(glyph_string.index_to_x(&s, analysis, s.len()asi32,false));
0 commit comments