Repository navigation
Fix: Preserve reading position after a small log-file shrink - #732
Pr0metheus2 wants to merge 1 commit into
Conversation
When a monitored log file shrinks, LogExpert reloads it as a new file. Even removing one trailing character could therefore move the view away from the line being read and turn Follow tail back on. This change saves the visible position before an automatic reload and restores it when the reloaded file has the same number of lines or one fewer. A substantial drop in line count keeps the existing reset behavior for rotation. Verification: 40 related tests passed; the full suite passed with 1,014 passed and 7 skipped. The five-step manual reproduction confirmed that the reading position is restored after removing the character
|
can you verify this with a unit test as well? |
|
|
If this proposed change would make things worse, it's better to close PR. |
no, but we need a unit test as prove, otherwise we just fix things left and right without knowing if it really fixes a problem, and we also need to keep in mind that we don't break other things while fixing bugs. |
|
The question is, if we really want to fix this issue (is it really issue?) - at least my replicated behavior by removing only one character at the end of the tested file. In real-world, log file should only increase, not decrease. If file shrinks, it must happen ONLY when a new rotating file is created. So either the ProfileX has different problem and he needs to replicate it to find a bug, or his log file shrinks by some bytes or lines - but in such case, this should not happen anyway and is not proper bahaviour of whatever application is creating his log. |
|
you are right, deleting characters in a log file normally does not happen, so this is in my opinion a out of scope use case. So I wouldn't fix it, if it only happens when a character is deleted |
|
Agreement |
This is a proposed fix for the issue Scrolling to the top of the file #639. I was able to replicate this behavior by removing only one character at the end of the tested file.
Current status:
When a monitored log file shrinks, LogExpert reloads it as a new file. Even removing one trailing character could therefore move the view away from the line being read and turn "Follow tail" back on.
Fix:
This change saves the visible position before an automatic reload and restores it when the reloaded file has the same number of lines or one fewer. A substantial drop in line count keeps the existing reset behavior for rotation.
Verification: The manual reproduction confirmed that the reading position is restored after removing the character.