Fix macOS special character input in terminal (Issue #41)

- Add custom keyboard event handler for macOS Option key combinations
- Enable Option+7 to input pipe symbol (|) in Safari and Firefox
- Support additional special characters: @, €, [, ], commonly used on macOS
- Use both e.key and e.code for robust keyboard layout compatibility
- Only activate on macOS platform to avoid affecting other systems
- Maintain xterm.js native handling as primary with custom handler as fallback

Resolves GitHub Issue #41 where users couldn't type pipe symbol with Option+7 on Mac.
This commit is contained in:
ZacharyZcR
2025-09-16 10:58:02 +08:00
parent 0839cb4134
commit e8b6746278
2 changed files with 46 additions and 0 deletions

View File

@@ -175,6 +175,7 @@ export const Terminal = forwardRef<any, SSHTerminalProps>(function SSHTerminal(
allowTransparency: true,
convertEol: true,
windowsMode: false,
// Keep Option key for special characters on macOS (false = allows special chars, true = Meta key)
macOptionIsMeta: false,
macOptionClickForcesSelection: false,
rightClickSelectsWord: false,