/** * Returns whether the given offset is inside a multi byte line delimiter. * Example: * "Line1\r\n" isLineDelimiter(5) == false but isLineDelimiter(6) == true * * @return true if the given offset is inside a multi byte line delimiter. * false if the given offset is before or after a line delimiter. */ boolean isLineDelimiter(int offset) { int line = content.getLineAtOffset(offset); int lineOffset = content.getOffsetAtLine(line); int offsetInLine = offset - lineOffset; // offsetInLine will be greater than line length if the line // delimiter is longer than one character and the offset is set // in between parts of the line delimiter. return offsetInLine > content.getLine(line).length(); } /**
/** * Returns whether the given offset is inside a multi byte line delimiter. * Example: * "Line1\r\n" isLineDelimiter(5) == false but isLineDelimiter(6) == true * * @return true if the given offset is inside a multi byte line delimiter. * false if the given offset is before or after a line delimiter. */ boolean isLineDelimiter(int offset) { int line = content.getLineAtOffset(offset); int lineOffset = content.getOffsetAtLine(line); int offsetInLine = offset - lineOffset; // offsetInLine will be greater than line length if the line // delimiter is longer than one character and the offset is set // in between parts of the line delimiter. return offsetInLine > content.getLine(line).length(); } /**
/** * Returns whether the given offset is inside a multi byte line delimiter. * Example: * "Line1\r\n" isLineDelimiter(5) == false but isLineDelimiter(6) == true * * @return true if the given offset is inside a multi byte line delimiter. * false if the given offset is before or after a line delimiter. */ boolean isLineDelimiter(int offset) { int line = content.getLineAtOffset(offset); int lineOffset = content.getOffsetAtLine(line); int offsetInLine = offset - lineOffset; // offsetInLine will be greater than line length if the line // delimiter is longer than one character and the offset is set // in between parts of the line delimiter. return offsetInLine > content.getLine(line).length(); } /**
/** * Returns whether the given offset is inside a multi byte line delimiter. * Example: * "Line1\r\n" isLineDelimiter(5) == false but isLineDelimiter(6) == true * * @return true if the given offset is inside a multi byte line delimiter. * false if the given offset is before or after a line delimiter. */ boolean isLineDelimiter(int offset) { int line = content.getLineAtOffset(offset); int lineOffset = content.getOffsetAtLine(line); int offsetInLine = offset - lineOffset; // offsetInLine will be greater than line length if the line // delimiter is longer than one character and the offset is set // in between parts of the line delimiter. return offsetInLine > content.getLine(line).length(); } /**
/** * Returns whether the given offset is inside a multi byte line delimiter. * Example: * "Line1\r\n" isLineDelimiter(5) == false but isLineDelimiter(6) == true * * @return true if the given offset is inside a multi byte line delimiter. * false if the given offset is before or after a line delimiter. */ boolean isLineDelimiter(int offset) { int line = content.getLineAtOffset(offset); int lineOffset = content.getOffsetAtLine(line); int offsetInLine = offset - lineOffset; // offsetInLine will be greater than line length if the line // delimiter is longer than one character and the offset is set // in between parts of the line delimiter. return offsetInLine > content.getLine(line).length(); } /**
int getClusterPrevious(int offset, int lineIndex) { int lineOffset = content.getOffsetAtLine(lineIndex); TextLayout layout = renderer.getTextLayout(lineIndex); offset -= lineOffset; offset = layout.getPreviousOffset(offset, SWT.MOVEMENT_CLUSTER); offset += lineOffset; renderer.disposeTextLayout(layout); return offset; } /**
int getClusterNext(int offset, int lineIndex) { int lineOffset = content.getOffsetAtLine(lineIndex); TextLayout layout = renderer.getTextLayout(lineIndex); offset -= lineOffset; offset = layout.getNextOffset(offset, SWT.MOVEMENT_CLUSTER); offset += lineOffset; renderer.disposeTextLayout(layout); return offset; } int getClusterPrevious(int offset, int lineIndex) {
int getClusterPrevious(int offset, int lineIndex) { int lineOffset = content.getOffsetAtLine(lineIndex); TextLayout layout = renderer.getTextLayout(lineIndex); offset -= lineOffset; offset = layout.getPreviousOffset(offset, SWT.MOVEMENT_CLUSTER); offset += lineOffset; renderer.disposeTextLayout(layout); return offset; } /**
int getClusterNext(int offset, int lineIndex) { int lineOffset = content.getOffsetAtLine(lineIndex); TextLayout layout = renderer.getTextLayout(lineIndex); offset -= lineOffset; offset = layout.getNextOffset(offset, SWT.MOVEMENT_CLUSTER); offset += lineOffset; renderer.disposeTextLayout(layout); return offset; } int getClusterPrevious(int offset, int lineIndex) {
int getClusterPrevious(int offset, int lineIndex) { int lineOffset = content.getOffsetAtLine(lineIndex); TextLayout layout = renderer.getTextLayout(lineIndex); offset -= lineOffset; offset = layout.getPreviousOffset(offset, SWT.MOVEMENT_CLUSTER); offset += lineOffset; renderer.disposeTextLayout(layout); return offset; } /**
int getClusterPrevious(int offset, int lineIndex) { int lineOffset = content.getOffsetAtLine(lineIndex); TextLayout layout = renderer.getTextLayout(lineIndex); offset -= lineOffset; offset = layout.getPreviousOffset(offset, SWT.MOVEMENT_CLUSTER); offset += lineOffset; renderer.disposeTextLayout(layout); return offset; } /**
int getClusterNext(int offset, int lineIndex) { int lineOffset = content.getOffsetAtLine(lineIndex); TextLayout layout = renderer.getTextLayout(lineIndex); offset -= lineOffset; offset = layout.getNextOffset(offset, SWT.MOVEMENT_CLUSTER); offset += lineOffset; renderer.disposeTextLayout(layout); return offset; } int getClusterPrevious(int offset, int lineIndex) {
int getClusterNext(int offset, int lineIndex) { int lineOffset = content.getOffsetAtLine(lineIndex); TextLayout layout = renderer.getTextLayout(lineIndex); offset -= lineOffset; offset = layout.getNextOffset(offset, SWT.MOVEMENT_CLUSTER); offset += lineOffset; renderer.disposeTextLayout(layout); return offset; } int getClusterPrevious(int offset, int lineIndex) {
int getClusterPrevious(int offset, int lineIndex) { int lineOffset = content.getOffsetAtLine(lineIndex); TextLayout layout = renderer.getTextLayout(lineIndex); offset -= lineOffset; offset = layout.getPreviousOffset(offset, SWT.MOVEMENT_CLUSTER); offset += lineOffset; renderer.disposeTextLayout(layout); return offset; } /**
int getClusterNext(int offset, int lineIndex) { int lineOffset = content.getOffsetAtLine(lineIndex); TextLayout layout = renderer.getTextLayout(lineIndex); offset -= lineOffset; offset = layout.getNextOffset(offset, SWT.MOVEMENT_CLUSTER); offset += lineOffset; renderer.disposeTextLayout(layout); return offset; } int getClusterPrevious(int offset, int lineIndex) {
/** * Moves the caret to the beginning of the line. */ void doLineStart() { int caretLine = getCaretLine(); int lineOffset = content.getOffsetAtLine(caretLine); if (wordWrap || visualWrap) { TextLayout layout = renderer.getTextLayout(caretLine); int offsetInLine = caretOffset - lineOffset; int lineIndex = getVisualLineIndex(layout, offsetInLine); int[] offsets = layout.getLineOffsets(); lineOffset += offsets[lineIndex]; renderer.disposeTextLayout(layout); } setCaretOffset(lineOffset, OFFSET_LEADING); showCaret(); } /**
/** * Moves the caret to the beginning of the line. */ void doLineStart() { int caretLine = getCaretLine(); int lineOffset = content.getOffsetAtLine(caretLine); if (wordWrap || visualWrap) { TextLayout layout = renderer.getTextLayout(caretLine); int offsetInLine = caretOffset - lineOffset; int lineIndex = getVisualLineIndex(layout, offsetInLine); int[] offsets = layout.getLineOffsets(); lineOffset += offsets[lineIndex]; renderer.disposeTextLayout(layout); } setCaretOffset(lineOffset, OFFSET_LEADING); showCaret(); } /**
/** * Moves the caret to the beginning of the line. */ void doLineStart() { int caretLine = getCaretLine(); int lineOffset = content.getOffsetAtLine(caretLine); if (wordWrap || visualWrap) { TextLayout layout = renderer.getTextLayout(caretLine); int offsetInLine = caretOffset - lineOffset; int lineIndex = getVisualLineIndex(layout, offsetInLine); int[] offsets = layout.getLineOffsets(); lineOffset += offsets[lineIndex]; renderer.disposeTextLayout(layout); } setCaretOffset(lineOffset, OFFSET_LEADING); showCaret(); } /**
/** * Moves the caret to the beginning of the line. */ void doLineStart() { int caretLine = getCaretLine(); int lineOffset = content.getOffsetAtLine(caretLine); if (wordWrap || visualWrap) { TextLayout layout = renderer.getTextLayout(caretLine); int offsetInLine = caretOffset - lineOffset; int lineIndex = getVisualLineIndex(layout, offsetInLine); int[] offsets = layout.getLineOffsets(); lineOffset += offsets[lineIndex]; renderer.disposeTextLayout(layout); } setCaretOffset(lineOffset, OFFSET_LEADING); showCaret(); } /**
/** * Moves the caret to the beginning of the line. */ void doLineStart() { int caretLine = getCaretLine(); int lineOffset = content.getOffsetAtLine(caretLine); if (wordWrap) { TextLayout layout = renderer.getTextLayout(caretLine); int offsetInLine = caretOffset - lineOffset; int lineIndex = getVisualLineIndex(layout, offsetInLine); int[] offsets = layout.getLineOffsets(); lineOffset += offsets[lineIndex]; renderer.disposeTextLayout(layout); } setCaretOffset(lineOffset, OFFSET_LEADING); showCaret(); } /**