MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / utf16_cols

Function utf16_cols

codegraph-kernel/src/textutil.rs:261–269  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

259
260 #[test]
261 fn utf16_cols() {
262 let src = "aé😀b";
263 // 'a'=1, 'é'=1, '😀'=2 utf16 units; bytes: a=1, é=2, 😀=4
264 assert_eq!(utf16_len(src), 5);
265 let starts = line_starts(src);
266 assert_eq!(col16(src, &starts, 0, 1), 1); // after 'a'
267 assert_eq!(col16(src, &starts, 0, 3), 2); // after 'é'
268 assert_eq!(col16(src, &starts, 0, 7), 4); // after '😀'
269 }
270
271 /// The table gives, at every character of every line, the column that
272 /// counting the line's characters gives.

Callers

nothing calls this directly

Calls 1

line_startsFunction · 0.70

Tested by

no test coverage detected