Commit 992504e
authored
Fix NO-BREAK SPACE (U+00A0) column width calculation (#448)
* Fix NO-BREAK SPACE (U+00A0) column width calculation
The condition `irune <= 0xA0` incorrectly treated U+00A0 (NO-BREAK SPACE)
as non-printable, returning width -1. This caused cursor positioning
issues in applications that use NBSP in their output.
Changed to `irune < 0xA0` so that NO-BREAK SPACE correctly returns
width 1 (handled by the default case at end of function), matching
the behavior of regular space (U+0020).
* Add test for NO-BREAK SPACE (U+00A0) width
Verifies that NBSP has width 1 and cursor positioning works correctly
when NBSP is used (e.g., after prompt characters like in Claude Code).1 parent a48c5da commit 992504e
2 files changed
Lines changed: 28 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
335 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
336 | 337 | | |
337 | 338 | | |
338 | 339 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
277 | 302 | | |
278 | 303 | | |
0 commit comments