Error column is off by one for each emoji (non-BMP character) earlier on the line
Error is highlighted one character too far to the right after each character outside the Basic Multilingual Plane (emoji etc.) on the line
Version: SublimeLinter-javac 3.2.x from Package Control, SublimeLinter 4, Sublime Text 4215, JDK 25 (javac 25.0.3). Reproduced in a clean install.
Main.java (tab-indented, saved as UTF-8):
import java.util.*;
public class Main {
static String s = "é😀";
public static void main(String[] a) {
int x = "str";
String t = "é😀" + undefinedVar;
}
}
The error on the String t = ... line is highlighted as ndefinedVar instead of undefinedVar: the start is one column too far to the right. Errors on lines without such a character (line 5) are placed correctly, and so is é (a single UTF-16 unit).
Raw javac output for that error:
Main.java:6: error: cannot find symbol
String t = "é😀" + undefinedVar;
^
symbol: variable undefinedVar
The caret sits at column 21 (counting the two tabs), but undefinedVar starts at character 20 of the line as Sublime counts it. javac counts UTF-16 code units, so a character such as 😀 (U+1F600) takes two positions in the caret line, while Sublime counts code points and takes one. The col group of the regex is passed on as it is, so every such character earlier on the line moves the highlight one column further to the right (two emoji, two columns, and so on).
The same happens with other tools that report UTF-16 columns.
Suggested fix: override reposition_match (or convert in split_match), take the source line via vv.select_line(line), and turn the UTF-16 offset into a code point offset by walking the line and counting characters above U+FFFF twice. I can prepare a PR for this if you would like one.
ack, a PR is welcome.
Claude reports: no PR needed, 1.4.0 already fixes this. Thank you for the fix.
Sublime Text build 4215 (Windows), SublimeLinter 4.30.1, javac 25.0.3. I installed SublimeLinter-javac 1.4.0 from Package Control (its linter.py has column_unit = 'utf16') and opened the Main.java from the report, saved as UTF-8 with tabs. On line 6 the whole of undefinedVar is now outlined (before, it started one character late), and the error on line 5 sits on the right character. The status bar shows javac(e:2).
I did not run 1.3.0 here for comparison; the earlier behaviour is from the original report. This issue can be closed.