mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
EA-28828 - IOOBE: CharArray.charAt
Corrected pasting at the document start
This commit is contained in:
+17
@@ -156,6 +156,23 @@ class Test {
|
||||
}
|
||||
}
|
||||
}\
|
||||
'''
|
||||
doTest(before, toPaste, expected)
|
||||
}
|
||||
|
||||
void testPasteAtDocumentStartColumn() {
|
||||
def before = '<caret>'
|
||||
|
||||
def toPaste =
|
||||
'''\
|
||||
class Test {
|
||||
}\
|
||||
'''
|
||||
|
||||
|
||||
def expected = '''\
|
||||
class Test {
|
||||
}\
|
||||
'''
|
||||
doTest(before, toPaste, expected)
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ public class PasteHandler extends EditorActionHandler {
|
||||
final int i = CharArrayUtil.shiftBackward(chars, startOffset - 1, " \t");
|
||||
|
||||
// Handle situation when pasted block doesn't start new line.
|
||||
if (chars.charAt(i) != '\n') {
|
||||
if (i > 0 && chars.charAt(i) != '\n') {
|
||||
int firstNonWsOffset = CharArrayUtil.shiftForward(chars, firstLineStart, " \t");
|
||||
if (firstNonWsOffset > firstLineStart) {
|
||||
CharSequence toInsert = chars.subSequence(firstLineStart, firstNonWsOffset);
|
||||
|
||||
Reference in New Issue
Block a user