Skip to content

Commit

Permalink
Bug fix for tail mode
Browse files Browse the repository at this point in the history
The previous fix did not help, hopefully this one does...
  • Loading branch information
emilast committed Aug 17, 2024
1 parent 8b284cb commit ad0ea03
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/TailController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,21 @@ export class TailController {
}
private checkEndOfFileVisibilityInActiveEditor() {
const textEditor = vscode.window.activeTextEditor;
const visibleRanges = vscode.window.activeTextEditor.visibleRanges
if (textEditor) {
const visibleRanges = textEditor.visibleRanges

if (visibleRanges && textEditor?.document.languageId === Constants.LogLanguageId) {
const lastLine = textEditor.document.lineCount - 1;
const lastVisibleRange = visibleRanges[0].end.line;
if (visibleRanges && textEditor?.document.languageId === Constants.LogLanguageId) {
const lastLine = textEditor.document.lineCount - 1;
const lastVisibleRange = visibleRanges[0].end.line;

if (lastVisibleRange >= lastLine) {
// The end of the file is visible
this._tailModeActive = true;
this._statusBarItem.text = 'Log File Tail Mode';
this._statusBarItem.show();
if (lastVisibleRange >= lastLine) {
// The end of the file is visible
this._tailModeActive = true;
this._statusBarItem.text = 'Log File Tail Mode';
this._statusBarItem.show();

return;
return;
}
}
}

Expand Down

0 comments on commit ad0ea03

Please sign in to comment.