Changeset 275:9c5ba1f00519 for dwt/custom
- Timestamp:
- 08/04/08 18:51:33 (4 months ago)
- Files:
-
- dwt/custom/StyledText.d (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/custom/StyledText.d
r274 r275 2241 2241 int lineOffset = content.getOffsetAtLine(lineIndex); 2242 2242 if (caretOffset is lineOffset) { 2243 // DWT: on line start, delete line break 2243 2244 lineOffset = content.getOffsetAtLine(lineIndex - 1); 2244 2245 event.start = lineOffset + content.getLine(lineIndex - 1).length; … … 2246 2247 } else { 2247 2248 TextLayout layout = renderer.getTextLayout(lineIndex); 2248 int start = layout.getPreviousOffset(caretOffset - lineOffset, DWT.MOVEMENT_C HAR);2249 int start = layout.getPreviousOffset(caretOffset - lineOffset, DWT.MOVEMENT_CLUSTER); 2249 2250 renderer.disposeTextLayout(layout); 2250 2251 event.start = start + lineOffset; … … 3988 3989 TextLayout layout = renderer.getTextLayout(lineIndex); 3989 3990 x += horizontalScrollOffset - leftMargin; 3990 int[ ] trailing = new int[1];3991 int[1] trailing; 3991 3992 int offsetInLine = layout.getOffset(x, y, trailing); 3992 3993 caretAlignment = OFFSET_LEADING; … … 4910 4911 if (lineLength !is 0 && offsetInLine <= lineLength) { 4911 4912 if (offsetInLine is lineLength) { 4912 point = layout.getLocation(offsetInLine - 1, true); 4913 // DWT: Instead of go back one byte, go back one codepoint 4914 int offsetInLine_m1 = layout.getPreviousOffset(offsetInLine, DWT.MOVEMENT_CLUSTER); 4915 point = layout.getLocation(offsetInLine_m1, true); 4913 4916 } else { 4914 4917 switch (caretAlignment) { … … 4921 4924 point = layout.getLocation(offsetInLine, false); 4922 4925 } else { 4923 point = layout.getLocation(offsetInLine - 1, true); 4926 // DWT: Instead of go back one byte, go back one codepoint 4927 int offsetInLine_m1 = layout.getPreviousOffset(offsetInLine, DWT.MOVEMENT_CLUSTER); 4928 point = layout.getLocation(offsetInLine_m1, true); 4924 4929 } 4925 4930 break; … … 8324 8329 super.redraw(); 8325 8330 } 8331 // DWT: If necessary, scroll to show the location 8326 8332 bool showLocation(Rectangle rect, bool scrollPage) { 8327 8333 int clientAreaWidth = this.clientAreaWidth - leftMargin - rightMargin;
