Kittyfisto / Tailviewer

Open source log file viewer
https://kittyfisto.github.io/Tailviewer/
MIT License
200 stars 37 forks source link

Fixed bug involving searches on log files with tabs #244 #246

Closed Kittyfisto closed 3 years ago

Kittyfisto commented 3 years ago

The central log viewer would misalign the search-term highlights incorrectly for every line containing tabs. This was caused by the search itself operating on the lines as is and reference sections of the line with respect to the number of characters from the start, e.g. a typical search result would be "index 12, 5 characters long". However the text display itself would modify the message prior to rendering and effectively expand tab characters by the number of spaces the user has specified. When applying the search result, it would not take this expansion into account and re-use the indices reported by the search on the expanded message. This means that as soon as the user specified a tab width > 1, the search results were misaligned by the number of tabs left of the search term, multiplied by the number spaces per tab.

The fix involved simply subdividing the message into its search result constituents first and only then expanding the individual substrings, replacing tabs with spaces.

Fixes #244

Any expected problems concerning backwards compatibility of existing plugins?
No

Any expected problems concerning backwards compatibility of existing user settings?
No

Does this break existing user workflows?
No