Skip to content

Commit 1babb14

Browse files
committed
Fix search pos on file with leading whitespace
The extension property EditText.value trims leading/trailing whitespace, so using it to calculate the locations of the search matches produces incorrect indices if the file has leading whitespace. (This affects the cursor position when going to the next/prev match. It does not affect the highlighting of matches.)
1 parent d3c717d commit 1babb14

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class ReadTextActivity : SimpleActivity() {
316316
binding.readTextView.text?.clearBackgroundSpans()
317317

318318
if (text.isNotBlank() && text.length > 1) {
319-
searchMatches = binding.readTextView.value.searchMatches(text)
319+
searchMatches = binding.readTextView.text.toString().searchMatches(text)
320320
binding.readTextView.highlightText(text, getProperPrimaryColor())
321321
}
322322

0 commit comments

Comments
 (0)