Skip to content

fix(render): detect terminal width method#592

Merged
idursun merged 1 commit intomainfrom
fix/glyph-widths
Mar 14, 2026
Merged

fix(render): detect terminal width method#592
idursun merged 1 commit intomainfrom
fix/glyph-widths

Conversation

@idursun
Copy link
Copy Markdown
Owner

@idursun idursun commented Mar 13, 2026

This fixes misaligned lines in terminals that use grapheme clustering by default, such as Ghostty, while preserving correct rendering in terminals like Kitty that do not.

We detect terminal support for Unicode core width mode by listening for tea.ModeReportMsg, then we store the detected width method into the render package. I moved Width methods to the render package so that it is consistent across the codebase (by using the detected width method).

I tested it on both terminals and seems to be rendering correctly.

Copy link
Copy Markdown
Collaborator

@baggiiiie baggiiiie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! didnt expect this will require such big change

@idursun idursun merged commit e6f8860 into main Mar 14, 2026
4 checks passed
@idursun idursun deleted the fix/glyph-widths branch March 14, 2026 07:42
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Mar 17, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [idursun/jjui](https://github.com/idursun/jjui) | patch | `v0.10.1` → `v0.10.2` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>idursun/jjui (idursun/jjui)</summary>

### [`v0.10.2`](https://github.com/idursun/jjui/releases/tag/v0.10.2)

[Compare Source](idursun/jjui@v0.10.1...v0.10.2)

Quick release to continue the release early, release often streak.

##### Features

- **Custom diff and preview content** — You can now use `diff.show()` and `ui.preview.show()` in your Lua actions to display custom command output in the diff and preview panels. ([#&#8203;593](idursun/jjui#593))

##### Bug Fixes

- **Rebase source + insert between** — Rebase now correctly uses `-s` (source) instead of `-r` when combining source mode with insert-between. ([#&#8203;598](idursun/jjui#598))
- **Missing actions in status bar** — Actions with the same name in different scopes (e.g. `revset.edit` and `revisions.edit`) are no longer hidden from the status bar. ([#&#8203;595](idursun/jjui#595))
- **Misaligned lines across terminals** — Terminals handle Unicode width calculation differently — Ghostty enables grapheme clustering by default while Kitty does not. We now detect the terminal's width mode and calculate widths accordingly, fixing rendering in both. ([#&#8203;592](idursun/jjui#592))
- **Operation action overrides** — Some built-in actions during operations couldn't be overridden in `config.lua`. For example, `revisions.details.diff`, `revisions.evolog.diff`, and `revisions.rebase.*` actions can now be properly overridden. ([#&#8203;586](idursun/jjui#586), [#&#8203;598](idursun/jjui#598))

#### What's Changed

- fix(render): detect terminal width method by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;592](idursun/jjui#592)
- feat: add diff and preview show intents by [@&#8203;idursun](https://github.com/idursun) in [#&#8203;593](idursun/jjui#593)

**Full Changelog**: <idursun/jjui@v0.10.1...v0.10.2>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My43Ny4wIiwidXBkYXRlZEluVmVyIjoiNDMuNzcuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6OnBhdGNoIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants