fix(terminal): contain IME composition layout

This commit is contained in:
mesalogo
2026-10-10 12:55:18 +08:00
parent 3ebb4f0b79
commit 12a0291279
2 changed files with 25 additions and 0 deletions
+12
View File
@@ -221,6 +221,18 @@ describe('TerminalPanel', () => {
) )
}) })
it('contains IME composition layout inside the terminal', () => {
expect(terminalStylesheet).toMatch(
/\.terminal-panel__emulator\s*\{[^}]*contain:\s*size layout paint;[^}]*overflow-anchor:\s*none;/u
)
expect(terminalStylesheet).toMatch(
/\.terminal-panel__emulator \.xterm\s*\{[^}]*width:\s*100%;[^}]*max-width:\s*100%;[^}]*overflow:\s*hidden;/u
)
expect(terminalStylesheet).toMatch(
/\.terminal-panel__emulator \.xterm-helpers\s*\{[^}]*max-width:\s*0;[^}]*overflow:\s*visible;/u
)
})
it('creates only after the first valid fitted size and forwards input', async () => { it('creates only after the first valid fitted size and forwards input', async () => {
const backend = adapterHarness() const backend = adapterHarness()
const emulator = emulatorHarness() const emulator = emulatorHarness()
+13
View File
@@ -116,11 +116,24 @@
flex: 1; flex: 1;
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;
contain: size layout paint;
overflow-anchor: none;
background: var(--surface-canvas); background: var(--surface-canvas);
} }
.terminal-panel__emulator .xterm { .terminal-panel__emulator .xterm {
position: relative;
width: 100%;
min-width: 0;
max-width: 100%;
height: 100%; height: 100%;
overflow: hidden;
}
/* IME composition must stay inside the terminal's own scroll boundary. */
.terminal-panel__emulator .xterm-helpers {
max-width: 0;
overflow: visible;
} }
.terminal-panel__status { .terminal-panel__status {