Commit f099d6e
committed
builtin/repo: fix table alignment for UTF-8 characters
The previous implementation used simple width formatting which didn't
properly handle multi-byte UTF-8 characters, causing misaligned table
columns when displaying repository structure information.
This change modifies the stats_table_print_structure function to use
strbuf_utf8_align() instead of basic printf width specifiers. This
ensures proper column alignment regardless of the character encoding of
the content being displayed.
Specifically:
- Replace printf width formatting with strbuf_utf8_align() calls for
both header and data rows
- Initialize a strbuf to handle UTF-8 aware alignment
- Reset the buffer between operations to avoid content contamination
- Release the buffer when finished to prevent memory leaks
Change-Id: I7a1bc60eaa97ce3e359f2a5e729042a3417c93f1
Co-developed-by: Gemini <noreply@developers.google.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>1 parent 625c781 commit f099d6e
1 file changed
+18
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
295 | 296 | | |
296 | 297 | | |
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
300 | 301 | | |
301 | | - | |
302 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
303 | 310 | | |
304 | 311 | | |
305 | 312 | | |
| |||
317 | 324 | | |
318 | 325 | | |
319 | 326 | | |
320 | | - | |
321 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
322 | 334 | | |
| 335 | + | |
| 336 | + | |
323 | 337 | | |
324 | 338 | | |
325 | 339 | | |
| |||
0 commit comments