@gajae-code/tui 0.5.4 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.6.0] - 2026-06-18
6
+
7
+ ### Fixed
8
+
9
+ - Normalized canonically decomposed Hangul jamo at the terminal emission boundary so Korean text remains precomposed/stable in VS Code Remote and other terminal renderers that mishandle jamo clusters during repaint (#837).
10
+
5
11
  ## [0.5.3] - 2026-06-16
6
12
 
7
13
  ### Fixed
@@ -26,9 +26,9 @@ export declare function visibleWidthRaw(str: string): number;
26
26
  export declare function visibleWidth(str: string): number;
27
27
  /**
28
28
  * Normalize text for terminal output without changing logical editor content.
29
- * Some terminals render precomposed Thai/Lao AM vowels inconsistently during
30
- * differential repaint. Their compatibility decompositions have the same cell
31
- * width but avoid stale-cell artifacts in terminal renderers.
29
+ * Some terminals render canonically decomposed Hangul jamo or precomposed
30
+ * Thai/Lao AM vowels inconsistently during differential repaint. Emit a stable
31
+ * terminal form while keeping the component/source strings unchanged.
32
32
  */
33
33
  export declare function normalizeTerminalOutput(str: string): string;
34
34
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/tui",
4
- "version": "0.5.4",
4
+ "version": "0.6.1",
5
5
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
6
6
  "homepage": "https://gaebal-gajae.dev",
7
7
  "author": "Yeachan-Heo",
@@ -38,8 +38,8 @@
38
38
  "fmt": "biome format --write ."
39
39
  },
40
40
  "dependencies": {
41
- "@gajae-code/natives": "0.5.4",
42
- "@gajae-code/utils": "0.5.4",
41
+ "@gajae-code/natives": "0.6.1",
42
+ "@gajae-code/utils": "0.6.1",
43
43
  "lru-cache": "11.3.6",
44
44
  "marked": "^18.0.3"
45
45
  },
package/src/utils.ts CHANGED
@@ -152,16 +152,21 @@ export function visibleWidth(str: string): number {
152
152
 
153
153
  const THAI_LAO_AM_REGEX = /[\u0e33\u0eb3]/;
154
154
  const THAI_LAO_AM_GLOBAL_REGEX = /[\u0e33\u0eb3]/g;
155
+ const HANGUL_JAMO_REGEX = /[\u1100-\u11ff\ua960-\ua97f\ud7b0-\ud7ff]/;
155
156
 
156
157
  /**
157
158
  * Normalize text for terminal output without changing logical editor content.
158
- * Some terminals render precomposed Thai/Lao AM vowels inconsistently during
159
- * differential repaint. Their compatibility decompositions have the same cell
160
- * width but avoid stale-cell artifacts in terminal renderers.
159
+ * Some terminals render canonically decomposed Hangul jamo or precomposed
160
+ * Thai/Lao AM vowels inconsistently during differential repaint. Emit a stable
161
+ * terminal form while keeping the component/source strings unchanged.
161
162
  */
162
163
  export function normalizeTerminalOutput(str: string): string {
163
- if (!THAI_LAO_AM_REGEX.test(str)) return str;
164
- return str.replace(THAI_LAO_AM_GLOBAL_REGEX, char => (char === "\u0e33" ? "\u0e4d\u0e32" : "\u0ecd\u0eb2"));
164
+ let normalized = str;
165
+ if (HANGUL_JAMO_REGEX.test(normalized)) normalized = normalized.normalize("NFC");
166
+ if (!THAI_LAO_AM_REGEX.test(normalized)) return normalized;
167
+ return normalized.replaceAll(THAI_LAO_AM_GLOBAL_REGEX, char =>
168
+ char === "\u0e33" ? "\u0e4d\u0e32" : "\u0ecd\u0eb2",
169
+ );
165
170
  }
166
171
 
167
172
  const makeBoolArray = (chars: string): Uint8Array => {