variar / klogg

Really fast log explorer based on glogg project
https://klogg.filimonov.dev
GNU General Public License v3.0
2.12k stars 186 forks source link

Marks lost on refresh #179

Open mpela81 opened 4 years ago

mpela81 commented 4 years ago

All marks are lost when you refresh a file, using the reload button or when a file is modified externally. This does not happen on the original glogg.

variar commented 4 years ago

Looks like some bug after marks and matches cache refactoring. Thank for pointing this out. I don't use file refreshing so this area lacks testing.

variar commented 4 years ago

After some thought this is not simple issue. After reloading a file from disk we do not know if previously marked lines have same line numbers in new file, so klogg drops them because keeping marks on wrong line numbers is in my opinion much more confusing.

I can try to check if file checksum stays the same after reloading and keep marks in that case, but that will require considerably more work.

mpela81 commented 4 years ago

I think one of the most common usages of these tools is examining logs in real time. When the log file keeps growing as new lines are appended at the end, while existing lines do not change. Keeping marks in their place makes perfectly sense in this case.

variar commented 4 years ago

Thanks, this case looks valid. I don't use file refreshing in daily job and thus don't encounter many such issues.

There is already detection of changes at the end/in the middle of file, that can be used to keep marks.

wizzard0 commented 3 years ago

relatively resilient suggestion: cache offsets+data, keep marks w\original text but flag\highlight them if the file data at that offset does not match cache anymore

variar commented 3 years ago

After fixing detection of file updates vs file truncates in latest builds, marks should not be lost on auto-refresh. They are still lost on manual refresh though.