Optimize frontend terminal rendering and remove unnecessary screen clears
- Removed terminal.clear() calls that were clearing screen on every output
update, letting the game process control the display
- Added letterSpacing: 0 to xterm.js config to disable automatic spacing
adjustments that were creating unwanted span tags
- Improved font family to 'Source Code Pro' for better handling of CJK
characters and monospace alignment
- Added lineHeight adjustment (1.2) for better vertical spacing
- Enabled allowProposedApi for access to additional xterm.js features
- Game process output is now properly displayed without formatting artifacts
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
52e465177c
commit
7c103d7209
|
|
@ -175,7 +175,9 @@
|
||||||
terminal = new Terminal({
|
terminal = new Terminal({
|
||||||
cursorBlink: true,
|
cursorBlink: true,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontFamily: 'Consolas, Monaco, monospace',
|
fontFamily: '"Source Code Pro", "Courier New", monospace',
|
||||||
|
letterSpacing: 0, // 禁用自动间距调整
|
||||||
|
lineHeight: 1.2, // 调整行高
|
||||||
theme: {
|
theme: {
|
||||||
background: '#1a1a2e',
|
background: '#1a1a2e',
|
||||||
foreground: '#eee',
|
foreground: '#eee',
|
||||||
|
|
@ -200,7 +202,8 @@
|
||||||
brightWhite: '#fff'
|
brightWhite: '#fff'
|
||||||
},
|
},
|
||||||
rows: 30,
|
rows: 30,
|
||||||
cols: 100
|
cols: 100,
|
||||||
|
allowProposedApi: true
|
||||||
});
|
});
|
||||||
|
|
||||||
fitAddon = new FitAddon.FitAddon();
|
fitAddon = new FitAddon.FitAddon();
|
||||||
|
|
@ -274,10 +277,9 @@
|
||||||
if (!terminal) {
|
if (!terminal) {
|
||||||
initTerminal();
|
initTerminal();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case 'output':
|
case 'output':
|
||||||
// 进程输出
|
// 进程输出 - 直接写入,游戏进程负责清屏
|
||||||
terminal.write(data.text);
|
terminal.write(data.text);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user