Changeset 275:9c5ba1f00519
- Timestamp:
- 08/04/08 18:51:33
(5 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
Fix: delete the whole codepoint for backspace.
Fix: getPointAtPosition handle whole codepoints correctly.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| 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_CHAR); |
|---|
| | 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; |
|---|