Sandip Ghimire eb1611f9e2 fix(console): improve terminal layout, resize reliability, and rendering performance (#7300)
## Description

This PR resolves several visual artifacts, resize desync issues, and
edge-case rendering glitches with the Ghostty-web terminal integration
in the server console:

### 1. Reliable Terminal Resizing & Layout Transitions
- **Bypass `FitAddon` throttle lock (`unlockFitResize`)**: Ghostty's
`FitAddon` sets a 50ms `_isResizing` lock via `setTimeout`, which
silently dropped subsequent `fit()` calls triggered immediately after
layout/route transitions. Unlocking this ensures post-layout re-fits are
never lost.
- **WASM Line Bounds & Viewport Clamping (`patchWasmTerminal`)**:
- Guards against potential null/undefined line reads from the WASM
terminal (`getLine` and `getScrollbackLine` fallback to empty arrays).
- Synchronizes and clamps viewport coordinates during `term.resize` to
prevent scroll desync and jumps when resizing windows or toggling
devtools.

### 2. Precise Font Metrics & Clean Canvas Redraws
- **Canvas-based Font Measurement (`measureTerminalFont`)**: Accurately
computes font cell width, baseline, ascent, and descent using a 2D
canvas context instead of relying on rough estimates.
- **Artifact Prevention in `adjustRendering`**: Automatically flushes
and repaints the canvas background with the theme background color when
viewport offsets change or full redraws occur, eliminating ghosting/text
smearing.

### 3. Clear & Output Lifecycle Improvements
- **Terminal Clear Handling**: Extends `preserveScrollPositionOnWrite`
to intercept `term.clear()`, issuing ANSI reset escapes
(`\x1b[2J\x1b[3J\x1b[H`) and resetting viewport positions.
- **Prefix Newlines**: Normalizes `term.writeln` to ensure initial logs
and scrollback buffer transitions don't overwrite the first line.

### 4. Layout & Styling Polish
- Replaced negative margin gutter compensation hacks (`-ml-4
w-[calc(100%+2rem)]`) in `Terminal.tsx` with clean `w-full` and
`overflow-hidden`.
- Ensured consistent container and input rounding across mobile and
desktop breakpoints.

---

## Changes Overview

- `resources/scripts/components/server/console/useTerminal.ts`: Added
`unlockFitResize`, `measureTerminalFont`, `patchWasmTerminal`, viewport
clamping, canvas clear on redraw, and clear handling.
- `resources/scripts/themes/classic/views/server/console/Terminal.tsx`:
Cleaned container classes and removed mobile negative-margin overrides.
2026-10-19 15:06:01 -04:00
2026-10-13 21:07:43 -04:00
2026-10-12 08:15:15 -04:00
2026-10-13 02:37:22 -04:00
2026-10-12 05:18:59 -04:00
2026-10-12 08:15:15 -04:00
2026-10-12 21:24:43 -04:00
2026-10-12 23:40:08 -04:00
2026-10-14 04:01:26 -04:00
2026-10-12 08:14:53 -04:00
2026-10-12 08:15:15 -04:00
2022-10-24 09:48:30 -06:00
2026-10-09 17:34:17 -04:00
2026-10-12 21:20:14 -04:00
2026-10-05 18:10:18 -04:00
2026-10-05 18:10:18 -04:00
2026-10-12 08:14:53 -04:00
2026-10-05 18:10:18 -04:00
2026-10-14 03:54:50 -04:00
2026-10-12 05:18:59 -04:00
2026-10-12 05:18:58 -04:00
2026-10-05 18:10:18 -04:00
2026-10-06 13:17:53 -04:00
2026-10-05 18:10:18 -04:00
2025-02-14 13:21:00 -07:00
2026-10-05 18:10:18 -04:00
2026-10-05 18:10:18 -04:00
2026-10-13 15:01:03 -04:00
2026-10-09 17:34:17 -04:00
2026-10-08 19:17:30 -04:00
2026-10-05 18:10:18 -04:00
2026-10-12 05:18:58 -04:00
2026-01-04 11:08:17 -08:00
2026-10-05 18:10:18 -04:00
2026-10-05 18:10:18 -04:00
2026-10-12 21:30:12 -04:00
2026-10-12 17:59:43 -04:00

Pterodactyl

GitHub Workflow Status Discord GitHub Releases GitHub contributors

Pterodactyl Panel

Pterodactyl® is a free, open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.

Stop settling for less. Make game servers a first class citizen on your platform.

Watch: Introducing Pterodactyl v2

What's new in v2

This branch (2.0-develop) is where Pterodactyl v2 is being built. It is under active development; the current stable release line lives on 1.0-develop.

  • Extension SDK — extend the panel through a versioned API instead of editing core files, so your changes survive updates. Example extensions live in pterodactyl/extensions.
  • Fully modernized tech stack — Vite, React 19, TanStack Router and Query, Tailwind 4 and Laravel 13.
  • Brand new admin area — the admin and client areas are now a single React application with one design.
  • One-click egg importer — browse the egg catalog and import directly from the panel.
  • Theming with design tokens — restyle the panel without rebuilding it.
  • Still 100% free and open source — MIT licensed, as always.

Documentation

Sponsors

I would like to extend my sincere thanks to the following sponsors for helping fund Pterodactyl's development. Interested in becoming a sponsor?

Company About
Buildurly Buildurly is a hardware procurement company. They deliver tailored, enterprise-grade hardware solutions designed around your unique needs. From sourcing to delivery, Buildurly's white-glove service ensures a seamless, worry-free, professional experience.
Hosturly Hosturly is an enterprise hosting provider. They provide cost-effective, high-performance, and reliable services, including VPS, Web, Dedicated, and Colocation.
indifferent broccoli indifferent broccoli is a game server hosting and rental company. With them, you get top-notch computer power for your gaming sessions. They destroy lag, latency, and complexity--letting you focus on the fun stuff.
Infraly, LLC Infraly is an infrastructure company powering the next generation of online services. Through their brands, Infraly delivers cutting-edge solutions across multiple markets. Their vertically integrated approach provides unmatched performance, scalability, and reliability, giving our customers full control.
MineStrator MineStrator is a game server hosting provider. Looking for the most high-end French hosting company for your Minecraft server? More than 24,000 members on our Discord trust us. Give us a try!
Physgun Physgun is a game server hosting provider. Most providers rent rack space and rebrand a panel. At Physgun, they engineer the performance, write the features, and staff the support. Physgun truly is game hosting perfected!
WISP WISP is an industry-leading SaaS platform for game server management, designed for hosting companies, gaming organizations, and enthusiasts. WISP combines modern, intuitive interfaces with powerful tools, making server deployment and administration seamless, scalable, and efficient.

Supported Games

Pterodactyl supports a wide variety of games by utilizing Docker containers to isolate each instance. This gives you the power to run game servers without bloating machines with a host of additional dependencies.

Some of our core supported games include:

  • Minecraft — including Paper, Sponge, Bungeecord, Waterfall, and more
  • Rust
  • Terraria
  • Teamspeak
  • Mumble
  • Team Fortress 2
  • Counter Strike: Global Offensive
  • Garry's Mod
  • ARK: Survival Evolved

In addition to our standard nest of supported games, our community is constantly pushing the limits of this software and there are plenty more games available provided by the community. Some of these games include:

  • Factorio
  • San Andreas: MP
  • Pocketmine MP
  • Squad
  • Xonotic
  • Starmade
  • Discord ATLBot, and most other Node.js/Python discord bots
  • and many more...

License

Pterodactyl® Copyright © 2015 - 2022 Dane Everitt and contributors.

Code released under the MIT License.

Languages
PHP 65%
TypeScript 20.8%
Blade 11.6%
CSS 1.3%
JavaScript 1%
Other 0.2%