void () { // We want to exclude unnecessary indents from the pasted results. String text = """ package org; public class TestClass { int field; public int getField() { return field; } }"""; init(text); int selectionStart = text.indexOf("public int"); int selectionEnd = text.indexOf('}