From 1babb14ab067a8455892b5b5457cb109e2978462 Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Fri, 26 Jan 2024 15:50:20 +0000 Subject: [PATCH] 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.) --- .../org/fossify/filemanager/activities/ReadTextActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt b/app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt index dbe9affe..819e4c7a 100644 --- a/app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt +++ b/app/src/main/kotlin/org/fossify/filemanager/activities/ReadTextActivity.kt @@ -316,7 +316,7 @@ class ReadTextActivity : SimpleActivity() { binding.readTextView.text?.clearBackgroundSpans() if (text.isNotBlank() && text.length > 1) { - searchMatches = binding.readTextView.value.searchMatches(text) + searchMatches = binding.readTextView.text.toString().searchMatches(text) binding.readTextView.highlightText(text, getProperPrimaryColor()) }