返回资讯中心
外部精选
软件工程
#开发者实时流

I can't type Hindustani into my terminal emulator, and that makes me sad

ecs in all the ways in which terminals’ text rendering is bad (archive link):

Hacker News 最新GeneralMaximus2026/12/3 · 今天22 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

ecs in all the ways in which terminals’ text rendering is bad (archive link):

terminals really want text to be a 2d grid of characters which can be rendered by just mapping each character onto a box on the screen. now, if your language uses a latin script, this can probably be made to work good enough. unfortunately, it turns out that language is complex, orthography is complex, and if you try to generalize this approach to text rendering to handle unicode properly, you’re gonna end up with Problems

As a software developer, I’m forced to use the terminal for a large portion of my daily work. As a result, I’ve become frighteningly good at typing arcane commands into a black box on my screen. But despite my comfort with the terminal, I’ve always found command line apps to be inferior to their GUI counterparts on every axis besides composability. In fact, I take every opportunity to replace my workhorse command line apps with GUI apps, even if I have to pay good money for the privilege.

There is much to complain about when it comes to the modern command line, but this post is about my biggest beef with the ecosystem: in the year 2026, when you can rent superhuman intelligence for $20/month, terminal emulators still don’t support complex scripts.

Complex text layout (CTL) or complex text rendering is the typesetting of writing systems in which the shape or positioning of a grapheme depends on its relation to other graphemes. The term is used in the field of software internationalization, where each grapheme is a character.

Scripts which require CTL for proper display may be known as complex scripts. Examples include the Arabic script and scripts of the Brahmic family, such as Devanagari, Khmer script or the Thai script.

That means you can’t type Hindustani, Nepali, Persian, or Thai into your terminal. Urdu? Also no. Bengali? Kannada? Tamil? Nope, nope, and nope. In fact, you can’t type any Indic or RTL script into your terminal without potentially breaking your whole session. Forget typing, sometimes you can’t even view complex scripts in the terminal without breaking your whole session.

This might not seem like a big deal if you only interact with computers in English, but some of us feel Very Big Feelings when the limitations of technology force us to abandon our languages and, as a result, our identities and cultures.

In most cases, trying to display complex scripts in your terminal emulator will result in incorrectly rendered, unreadable text. Trying to type them will usually result in the emulator getting confused, losing track of the cursor position, printing broken Unicode characters that you can’t erase, getting into an unusable state, or simply crashing. Sometimes you can get out of trouble by resetting your session with a Ctrl-L, other times you have to give up and start afresh with a new session.

Here’s one of my favorite Hindustani verses, rendered in Devanagari:

क्या बूद-ओ-बाश पूछो हो पूरब के साकिनो हम को ग़रीब जान के हँस हँस पुकार के

दिल्ली जो एक शहर था ’आलम में इंतिख़ाब रहते थे मुंतख़ब ही जहाँ रोज़गार के

उस को फ़लक ने लूट के वीरान कर दिया हम रहने वाले हैं उसी उजड़े दयार के

Any modern browser or GUI toolkit will render this correctly. If yours does not, here’s a screenshot of what it should look like:

Here’s how the macOS Terminal.app renders this:

Here's iTerm, my terminal emulator of choice on my work computer:

Here’s Ptyxis, the default terminal on GNOME:

(Notice how the text editor component renders the verse correctly, but the terminal garbles it beyond comprehension.)

In my testing, the only terminal emulator that makes a fair attempt at rendering Devanagari is ConEmu on Windows. I’m grateful to the author for at least attempting to support complex scripts, even if it doesn't always work perfectly.

(I had to create a whole new Windows 11 VM for this one screenshot. Please appreciate my dedication to this blog post. Also, apologies for the weird fuzzy screenshot. Windows VMs on ARM Macs are fiddly.)

Of course, I understand the complex technical and social reasons why terminal emulators can’t (and probably won’t) support complex scripts like Devanagari anytime soon. Here’s Mitchell Hashimoto writing about his attempts to support grapheme clustering in Ghostty (archive link):

Most terminals today do not support grapheme clustering. A major reason is because advanced terminal applications such as shells and text editors often need to constantly know exactly where the cursor is and remain in sync with the terminal grid state.

Because historically terminals used wcwidth, shells, editors, and other TUI apps also use wcwidth, and continue to do so today. Even though it produces the wrong values for multi-codepoint graphemes, at least the wrong values are often consistently wrong across terminal emulators.

When I first implemented text processing for my terminal, I implemented full grapheme cluster support because I assumed that would be a good thing. However, I was immediately disappointed to find that when I did proper grapheme clustering, fish shell would redraw my prompt in the wrong place when I moved my cursor. 😞 My shell assumed my terminal used wcwidth, and my terminal assumed programs didn't care. We both were wrong, so I disabled grapheme clustering...

There’s a solution to this problem: mode 2027. Hashimoto again:

Mode 2027 is a proposal for grapheme support in terminals. This proposal is from the author of the Contour terminal. The idea is that a program running in a terminal can notify the terminal that it wishes to operate with full support for grapheme clustering, and this feature can be turned on and off. The running program can also query the terminal to see if it supports this feature.

However, only three terminals appear to support this protocol: Ghostty, Contour, and Foot. Further, from what I understand, it’s not enough for terminals to support mode 2027, individual programs running inside those terminals must opt into the feature too. Additionally, enabling mode 2027 in Ghostty by setting grapheme-width-method to unicode does nothing to change how it handles Devanagari. Perhaps grapheme clustering is not the only feature terminal emulators must add in order to support complex scripts?

I’m sympathetic to the hurdles developers face when trying to support more languages and scripts in their terminal emulators, but that doesn’t make me any less upset about the state of things. And it most certainly doesn’t make it easier for me to grep for a Hindustani word in my notes directory.

In contrast to command line apps, GUI apps on all modern operating systems allow me to use the three scripts I read and write—Latin, Devanagari, and Gurmukhi—across the OS. I can use them in filenames, app names, input fields, even passwords and settings. Cross-platform GUI apps such as Obsidian allow me to take notes using whatever combinations of scripts my heart desires. Telegram, Signal, and WhatsApp let me text people using whichever language I care to throw at them. My browser allows me to read and write any language on the planet, including a few dead ones.

Sure, command line apps are useful. Often they can be more powerful than GUI apps, especially when you use them in scripts or compose multiple CLI utilities together in a shell. They’re certainly easier and faster to build, for both humans and LLMs. In some cases, for some specific tasks, they’re the only game in town. But for me, whatever upsides they might have don’t quite make up for their inability to speak the languages that are dear to my heart.

For this reason, among many others, my terminal emulator will continue to remain a tool for doing basic work-related tasks that cannot be accomplished via the GUI.

I want to emphasize that my rejection of the command line is not a rejection of software that uses text as its primary interface. It’s not a rejection of keyboard-driven applications or UNIX-style composability, either. My rejection of command line software stems from the fact that the modern command line is still stuck emulating hardware from the 70s, even though we already have modern approaches to building powerful, composable text-driven user interfaces that support every language under the sun.

Emacs is perhaps the best example of a text-based user interface done right (though it’s not exactly “modern”). It’s extensible, composable, self-documenting, and far more discoverable than your standard ZSH prompt inside Terminal.app. You can use Emacs to do everything you do in your terminal, but better. In fact, one way to think of Emacs is that it’s a 2D CLI.

And, in case you were wondering, Emacs renders my favorite verse perfectly:

Yes, even inside the built-in terminal emulator:

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →