3 ms·
The problem is they are using the Ink library which clears and redraws for each update. https://github.com/anthropics/claude-code/issues/769 https://github.com
by EMM_386 9mo ago
The problem is they are using the Ink library which clears and redraws for each update.
https://github.com/anthropics/claude-code/issues/769 https://github.com/anthropics/claude-code/issues/769
I locally patched the closed-source CLI npm package but it's not perfect. They would have to switch how their TUI is rendered on their side.
Apparently OpenAI Codex is rust+ratatui which does not have this issue.
- behnamoh 9mo agothen maybe they should've bought and fixed Ink instead of bun, just saying!
- reissbaker 9mo agoFWIW, Ink is working on an incremental rendering system: they have a flag to enable it. It's currently pretty buggy though unfortunately. Definitely wish Anthropic would commit some resources back to the project they're built on to help fix it...
- thomasahle 9mo agoI'm always surprised that Python doesn't have as good TUI libraries as Javascript or Rust. With the amount of CLI tooling written in Python, you'd think it had better libraries than any other language.
- behnamoh 9mo agoit has, but python being single threaded (until recently) didn't make it an attractive choice for CLI tools. example: `ranger` is written in python and it's freaking slow. in comparison, `yazi` (Rust) has been a breeze. Edit: Sorry, I meant GIL, not single thread.
- ashirviskas 9mo ago> it has, but python being single threaded (until recently) didn't make it an attractive choice for CLI tools. You probably mean GIL, as python has supported multi threading for like 20 years. Idk if ranger is slow because it is written in python. Probably it is the specific implementation.
- behnamoh 9mo agoEven my CC status line script enjoyed a 20x speed improvement when I rewrote it from python to rust.
- foltik 9mo agoIt’s surprising how quickly the bottleneck starts to become python itself in any nontrivial application, unless you’re very careful to write a thin layer that mostly shells out to C modules.
- embedding-shape 9mo ago> You probably mean GIL They also probably mean TUIs, as CLIs don't do the whole "Draw every X" thing (and usually aren't interactive), that's basically what sets them apart from CLIs.
- acdha 9mo agoTextual looks really nice, but I usually make web apps so I haven’t tried it for anything serious: https://textual.textualize.io/ https://textual.textualize.io/
- sibeliuss 9mo agoTextual is A++. Feels a bit less snappy than Ink, but it makes up in all things with its immense feature-set. Seriously fun building apps of all kinds with this lib.
- thomasahle 9mo agoTextual is cook, but it's maintained by a single guy, and the roadmap hasn't been updated since 2023, https://textual.textualize.io/roadmap/ https://textual.textualize.io/roadmap/
- wonger_ 9mo agoBlessed was a decent one iirc: https://github.com/jquast/blessed https://github.com/jquast/blessed One reason for the lack of python might be the timing of the TUI renaissance, which I think happened (is happening?) alongside the rise of languages like Go and Rust.
- blks 9mo agoI’m using Textual for my TUI needs, it’s very decent.
- jschlatter 9mo agoThey started with Ink but have since switched to their own renderer: > We originally built Claude Code on Ink, a React renderer for the terminal. [...] Over the past few months, we've rewritten our rendering system from scratch (while still using React). https://github.com/anthropics/claude-code/issues/769#issuecomment-3667315590 https://github.com/anthropics/claude-code/issues/769#issueco...
- cududa 9mo agoThanks for sharing. Very … interesting. Just trying to understand why the heck would React be the best tool here?
- anematode 9mo agoI genuinely thought this was satire until I looked it up. I guess it's just to make us webdevs feel at home in the Terminal (ooh, spooky!)
- rvz 9mo agoThats the problem. Some developers want to avoid learning another programming language and use one for everything (including their technologies.) Using TS, React here doesn’t make sense for stability in the long term. As you can see, even when they replaced Ink and built their own, the problem still exists. There are other alternatives that are better than whatever Anthropic did such as Bubbletea (Go) or Ratatui (Rust) which both are better suited for this. Maybe they were thinking more about job security with TypeScript over technical correctness and a robust implementation architecture and this shows the lack of it.
- catlifeonmars 9mo agoI’m a fan of Bubbletea, but it is significantly less ergonomic than React. Although I’d argue that if that starts to matter significantly, your TUI is probably too cluttered anyway and you should pare it down.
- zlumer 9mo ago