Skip to content

Preserve client console scroll position when trimming history#5030

Open
HeresHavi wants to merge 1 commit into
multitheftauto:masterfrom
HeresHavi:console-scroll-preservation
Open

Preserve client console scroll position when trimming history#5030
HeresHavi wants to merge 1 commit into
multitheftauto:masterfrom
HeresHavi:console-scroll-preservation

Conversation

@HeresHavi

@HeresHavi HeresHavi commented Jul 11, 2026

Copy link
Copy Markdown

Summary

Preserved the visible F8 console position when new output causes older history to be removed.

The console still follows new output while viewing the bottom, and trimming now handles wrapped and multibyte text correctly.

Motivation

The console keeps a limited amount of history. When that limit was reached, older lines were removed from the top while the previous scrollbar position was restored unchanged. This made the visible content jump forward even though the user had scrolled back to read earlier output.

For example, a developer may scroll up to inspect an earlier error while a busy resource continues printing messages. Once the history starts trimming, the console could move away from the lines they were reading.

Test plan

Runtime

  • Before Fix: Filled the console with numbered lines, scrolled to a known position, and added timed output. The visible content moved when history trimming started.
  • After Fix: Repeated the same test and confirmed the same retained text stayed visible.
  • Valid Case: The console continued following new output normally while scrolled to the bottom.
  • Wrapped Text: Repeated the test with heavily wrapped 300-character lines.
  • Unicode: Tested buffer rollover with é and . The text stayed intact and the viewport did not move.
  • Oldest Lines: Confirmed that when the currently viewed lines had to be removed, the console stayed at the top and showed the earliest retained complete line.

Builds and Tests

  • Debug | Win32: Client tests built, 304 tests passed.
  • Release | Win32: Full solution build passed, 304 client tests passed.
  • Release | x64: Server build passed.
  • Ran clang-format.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant