Edit: this answer is written with respect to Windows Terminal, but I expect it's an issue for xterm more generally.
By default, running tmux in Windows Terminal doesn't show the scroll bar, and doesn't allow you to scroll with the mouse scroll wheel.
As a solution, people often suggest turning on tmux's mouse mode, e.g. by adding set -g mouse on to ~/.tmux.conf. This re-enables scrolling with the mouse scroll wheel but interferes with selecting text and disables right-click-to-paste, and still doesn't enable the right scroll bar.
Fortunately, you can enable native xterm scrolling in tmux by adding set -g terminal-overrides 'xterm*:smcup@:rmcup@' to ~/.tmux.conf, as suggested here and (with a slight variation) here. This restores the usual scrolling behavior. According to the second link, it works by "fooling [tmux] into thinking that the terminal has no 'alternate screen' mode", and xterm* should be replaced by the output of echo $TERM if you're not using xterm.
However, it's glitchy: when attaching to an existing tmux session (tmux a or tmux attach), scrolling up shows you the contents of the parent terminal session from before you attached, instead of the past contents of the tmux session. One of the comments to the first link complains that this solution "doesn't keep the scrollback buffer after a(n) (re)attach" - but that's not actually true, since if you zoom out a bunch (e.g. with Ctrl + mouse wheel) and then zoom in again, you can see the entire past contents of the tmux session, or at least as far back as the number of lines you were able to fit on the screen when you zoomed out. The farther you zoom out, the farther back you're able to scroll when you zoom in.
Is there a way to skip this zoom in/zoom out trick and get Windows Terminal to re-render the entire tmux scrollback buffer when attaching? Honestly, set -g terminal-overrides 'xterm*:smcup@:rmcup@' seems like a hack anyway, so maybe there's a more robust way to re-enable native xterm scrolling?
set-hooksolution gives me errors when I launch tmux:.tmux.conf:7: unknown command: topand.tmux.conf:8: unknown command: top. – 1'' Aug 22 '22 at 23:58tmuxreports its version as3.2a. What is the output oftmux -Vin your case? – Kamil Maciorowski Aug 23 '22 at 00:02-t {top}, and it does seem to enable some scrollback! But I'm realizing that the scrolling is still pretty messed up though, even in a new tmux session (regardless of whether your fix is enabled). For instance, I triedfor i in {1..100}; do echo $i; donein a new tmux session and the numbers get totally mangled when you scroll up (e.g. 27, 30, 36, 40, 44, 50, 51, 52, ...). Do you get that as well with the Linux terminal emulator you're using? – 1'' Aug 23 '22 at 03:21konsole. Yes, this happens. Some research: (1) This does not happen insidetmuxwhentmuxhandles the scrollback buffer. (2) This does not happen with/bin/echo. I have tested my answer withlsand withcating a text file with reasonably long lines, I may have missed what you discovered. (3) After this happens, Icapture-paneto a regular file and the content seems fine. (4)cating this file is not fine. (5) The whole problem (including (4)) does not happen outside oftmux. It looks like a bug (intmux?) rather than a part of "the misery". – Kamil Maciorowski Aug 23 '22 at 04:51termcapinfo xterm* ti@:te@to~/.screenrcas suggested here works perfectly when scrolling up afterfor i in {1..100}; do echo $i; done; it just needs a bit more tweaking so you can see the scrollback buffer after reattaching. – 1'' Aug 23 '22 at 07:51