-
-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Search functionality in the body tab #1335
Conversation
This commit fixes the search functionality in the body tab by: - Including all items in the search instead of filtering only body line items. - Correcting the index used for search and highlighting. - Clearing spans when the query string is not found. - Resetting highlight on all items. These changes ensure that the search works correctly and highlights the correct lines in the body tab.
@@ -320,6 +320,7 @@ internal class TransactionPayloadFragment : | |||
backgroundSpanColor, | |||
foregroundSpanColor, | |||
) | |||
println("listOfSearchQuery: $listOfSearchQuery") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamarjun, please remove println
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
This commit removes a print statement that was used for debugging purposes. The print statement was located in the `TransactionPayloadFragment` class and was used to print the value of the `listOfSearchQuery` variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sending this over
@@ -90,16 +90,16 @@ internal class TransactionBodyAdapter(private val onCopyBodyListener: () -> Unit | |||
foregroundColor: Int, | |||
): List<SearchItemBodyLine> { | |||
val listOfSearchItems = arrayListOf<SearchItemBodyLine>() | |||
items.filterIsInstance<TransactionPayloadItem.BodyLineItem>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have you removed this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since TransactionPayloadItem
have mutliple types, filtering the BodyLineItem
subtype and then indexing them does't really give us the actual index of the item in the whole list. As a result wrong line with wrong search query gets highlighted, also the primary reason for the crash as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh I understand. Thanks for clarifying 👍
@@ -90,16 +90,16 @@ internal class TransactionBodyAdapter(private val onCopyBodyListener: () -> Unit | |||
foregroundColor: Int, | |||
): List<SearchItemBodyLine> { | |||
val listOfSearchItems = arrayListOf<SearchItemBodyLine>() | |||
items.filterIsInstance<TransactionPayloadItem.BodyLineItem>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh I understand. Thanks for clarifying 👍
This commit addresses and fixes the search functionality in the body (issue reference) tab by:
These changes ensure that the search works correctly and highlights the correct lines in the body tab.
📷 Screenshots
output.mp4
📄 Context
📝 Changes
📎 Related PR
🚫 Breaking
🛠️ How to test
⏱️ Next steps