Project: SWT
Bug 273919 getOffset(int,int,int[]) fails for empty lines ("\n")
Reported: 2009-04-27 13:48:01 | Status: resolved fixed

from the newsgroup: "Under Windows single '\n' works ok, but it has one disappointing feature: empty lines terminated with '\n' has zero width and cannot be detected by coordinate hit testing: offset = textLayout.getOffset(x, y, trailing); For such lines offset is returned as for start of next non-empty line. Empty lines terminated with '\r' can be detected, but I'm in doubt if this is cross-platform compatible. Empty lines terminated with "\r\n" also can be detected, but it is difficult when moving caret through text."

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java