fix: keep long conversation content scrollable

Large messages containing reasoning, tool lists, or long replies could use an estimated off-screen height that left later content outside the reachable scroll range. Conversation messages now participate in layout with their actual height while the existing 80-message render window keeps long histories bounded.

Release note: 修复偶发的长会话滚动条提前到底问题;包含较长推理、工具记录或正文时,现在可以直接滚动查看全部已加载内容,无需切换会话刷新。
This commit is contained in:
mesalogo
2026-09-05 14:51:21 +08:00
parent 6eb73657e0
commit d5fa0ec67c
3 changed files with 17 additions and 2 deletions
+14
View File
@@ -5,6 +5,8 @@ import {
screen,
within
} from '@testing-library/react'
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import { afterEach, describe, expect, it, vi } from 'vitest'
import {
ChatTimeline,
@@ -13,6 +15,10 @@ import {
const markdownRenderProbe = vi.hoisted(() => vi.fn())
const htmlRenderProbe = vi.hoisted(() => vi.fn())
const stylesheet = readFileSync(
join(process.cwd(), 'src', 'renderer', 'src', 'styles.css'),
'utf8'
).replaceAll('\r\n', '\n')
vi.mock('./MarkdownRenderer', () => ({
MarkdownRenderer: ({
@@ -60,6 +66,14 @@ describe('ChatTimeline', () => {
vi.clearAllMocks()
})
it('uses actual message heights for the conversation scroll range', () => {
const rule = stylesheet.match(/\.message\s*\{([^}]*)\}/u)?.[1]
expect(rule).toBeDefined()
expect(rule).not.toContain('content-visibility')
expect(rule).not.toContain('contain-intrinsic')
})
it('enables HTML rendering only for completed Agent output', () => {
const messages: Message[] = [
{
-2
View File
@@ -5281,8 +5281,6 @@ button > svg {
}
.message {
content-visibility: auto;
contain-intrinsic-block-size: auto 160px;
display: grid;
min-width: 0;
padding: 17px 8px;