See the variable
comint-scroll-show-maximum-output, which may be somewhat at fault here for the behavior the O.P. experiences -- the default value is
Controls how to scroll due to interpreter output.
This variable applies when point is at the end of the buffer
(either because it was originally there, or because
‘comint-move-point-for-output’ said to move it there)
and output from the subprocess is inserted.
Non-nil means scroll so that the window is full of text
and point is on the last line. A value of nil
means don’t do anything special--scroll normally.
See also the variable ‘comint-move-point-for-output’ and the function
This variable is buffer-local in all Comint buffers.
The flickering appears to be adjustment / scrolling based upon the default behavior of
scroll-margin (and some additional re-adjusting by
comint-scroll-whow-maximum-output); however, I have not done any real digging into
comint and how it may recenter or adjust window-point after output is generated. I personally like
(setq scroll-conservatively 101), which seems to fix the issue the O.P. has observed. Feel free to play with
scroll-margin and related settings, but they are not necessary if using the aforementioned one-liner. [There is no need to set
scroll-conservatively to a number beyond 101 as anything over 100 will have the same effect.]
It is possible to set
scroll-conservatively locally with things like
setq-local if the O.P. wishes for this to be buffer-local as to only this