[PR #585] [MERGED] fix: properly handle utf-8 in diff highlighting #9658

Closed
opened 2026-02-16 18:13:56 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/585
Author: @levabala
Created: 7/1/2025
Status: Merged
Merged: 7/3/2025
Merged by: @adamdotdevin

Base: devHead: tui-diff-highlighting-fix-utf8


📝 Commits (1)

  • 6c13727 fix: properly handle utf-8 in diff highlighting

📊 Changes

1 file changed (+9 additions, -4 deletions)

View changed files

📝 packages/tui/internal/components/diff/diff.go (+9 -4)

📄 Description

fixes https://github.com/sst/opencode/issues/379

seems like the problem was in applyHighlighting in diff.go
https://github.com/sst/opencode/blob/e99bdcefac44db9251ac08b515a6b1f5af42610c/packages/tui/internal/components/diff/diff.go#L607

the incrementing didn't honor multi-byte UTF-8 characters

i don't quite understand the code, but the solution seems to be working


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/585 **Author:** [@levabala](https://github.com/levabala) **Created:** 7/1/2025 **Status:** ✅ Merged **Merged:** 7/3/2025 **Merged by:** [@adamdotdevin](https://github.com/adamdotdevin) **Base:** `dev` ← **Head:** `tui-diff-highlighting-fix-utf8` --- ### 📝 Commits (1) - [`6c13727`](https://github.com/anomalyco/opencode/commit/6c13727a49d5023c9e7b6a94639da3d5b536ae8b) fix: properly handle utf-8 in diff highlighting ### 📊 Changes **1 file changed** (+9 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/tui/internal/components/diff/diff.go` (+9 -4) </details> ### 📄 Description fixes https://github.com/sst/opencode/issues/379 seems like the problem was in `applyHighlighting` in `diff.go` https://github.com/sst/opencode/blob/e99bdcefac44db9251ac08b515a6b1f5af42610c/packages/tui/internal/components/diff/diff.go#L607 the incrementing didn't honor multi-byte UTF-8 characters i don't quite understand the code, but the solution seems to be working --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:13:56 -05:00
yindo closed this issue 2026-02-16 18:13:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9658