hanli/web
hant 081903563a Fix line breaks in process output handling
Issues fixed:
- GameProcessServer.readProcessOutput() was using fgets() which could cause
  line breaks to be mishandled when reading multiple lines at once
- Changed to use fread() with 8KB buffer for non-blocking I/O
  - fread() is better for interactive programs
  - Properly handles newlines within chunks
  - Doesn't break lines unnecessarily

Frontend improvements:
- Changed sendInput() to use terminal.writeln() instead of write() + write('\n')
  - Ensures consistent line ending handling
  - Cleaner terminal output

Changes:
1. GameProcessServer.php (readProcessOutput):
   - Replaced fgets() loop with fread() loops
   - 8192-byte buffer size for optimal performance
   - Better handles non-blocking I/O streams

2. web/process.html (sendInput):
   - Use terminal.writeln() for user input display
   - More consistent with xterm.js behavior

Results:
- Line breaks now display correctly
- Output formatting preserved
- Better handling of rapid output
- No double line breaks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 13:35:36 +08:00
..
game-ws.html Fix web state management: handleInput now returns structured data 2025-12-07 13:14:48 +08:00
index.html Fix web state management: add state metadata to API responses 2025-12-07 11:19:28 +08:00
process.html Fix line breaks in process output handling 2025-12-07 13:35:36 +08:00
server.php Fix line breaks in process output handling 2025-12-07 13:35:36 +08:00