aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2025-10-09 15:21:38 +0300
committerEli Zaretskii2025-10-09 15:21:38 +0300
commit854690a9e3e1dfe5053535520aa8ab1ff7dbfb87 (patch)
treeb293db4334daa68cda5543b8a0eac3ef0c19d8f5 /src
parentd8448facd9169b17f0e78774865381f544f350c2 (diff)
downloademacs-854690a9e3e1dfe5053535520aa8ab1ff7dbfb87.tar.gz
emacs-854690a9e3e1dfe5053535520aa8ab1ff7dbfb87.zip
* src/w32console.c: Fix last change (bug#79298).
Diffstat (limited to 'src')
-rw-r--r--src/w32console.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/src/w32console.c b/src/w32console.c
index 30f511d93f9..a92ed788e00 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -351,22 +351,12 @@ w32con_write_glyphs (struct frame *f, register struct glyph *string,
351 conversion_buffer = (LPCSTR) encode_terminal_code (string, n, coding); 351 conversion_buffer = (LPCSTR) encode_terminal_code (string, n, coding);
352 if (coding->produced > 0) 352 if (coding->produced > 0)
353 { 353 {
354 /* By default, assume single-byte encoding and single-column 354 /* Compute the string's width on display by accounting for
355 characters... */ 355 character's width. FIXME: this doesn't handle character
356 ptrdiff_t nchars = coding->produced; 356 compositions. */
357 ptrdiff_t ncols = nchars; 357 ptrdiff_t ncols = strwidth (coding->source, coding->src_bytes);
358 /* ...but if we are using UTF-8, correct that by computing
359 characters. Note: multibyte_chars_in_text and strwidth
360 handle the internal encoding of characters, which is a
361 superset of UTF-8.
362 FIXME: this doesn't handle character compositions. */
363 if (coding->encoder == encode_coding_utf_8)
364 {
365 ncols = strwidth (conversion_buffer, nchars);
366 nchars = multibyte_chars_in_text (conversion_buffer, nchars);
367 }
368 /* Set the attribute for these characters. */ 358 /* Set the attribute for these characters. */
369 if (!FillConsoleOutputAttribute (cur_screen, char_attr, nchars, 359 if (!FillConsoleOutputAttribute (cur_screen, char_attr, ncols,
370 cursor_coords, &r)) 360 cursor_coords, &r))
371 { 361 {
372 printf ("Failed writing console attributes: %lu\n", 362 printf ("Failed writing console attributes: %lu\n",
@@ -420,20 +410,15 @@ w32con_write_glyphs_with_face (struct frame *f, register int x, register int y,
420 /* Compute the character attributes corresponding to the face. */ 410 /* Compute the character attributes corresponding to the face. */
421 DWORD char_attr = w32_face_attributes (f, face_id); 411 DWORD char_attr = w32_face_attributes (f, face_id);
422 COORD start_coords; 412 COORD start_coords;
423 /* By default, assume single-byte encoding... */ 413 /* Compute the string's width on display by accounting for
424 ptrdiff_t nchars = coding->produced; 414 character's width. FIXME: this doesn't handle character
425 /* ...but if we are using UTF-8, correct that by counting 415 compositions. */
426 characters. Note: multibyte_chars_in_text handles the 416 ptrdiff_t ncols = strwidth (coding->source, coding->src_bytes);
427 internal encoding of characters, which is a superset of
428 UTF-8.
429 FIXME: this doesn't handle character compositions. */
430 if (coding->encoder == encode_coding_utf_8)
431 nchars = multibyte_chars_in_text (conversion_buffer, nchars);
432 417
433 start_coords.X = x; 418 start_coords.X = x;
434 start_coords.Y = y; 419 start_coords.Y = y;
435 /* Set the attribute for these characters. */ 420 /* Set the attribute for these characters. */
436 if (!FillConsoleOutputAttribute (cur_screen, char_attr, nchars, 421 if (!FillConsoleOutputAttribute (cur_screen, char_attr, ncols,
437 start_coords, &filled)) 422 start_coords, &filled))
438 DebPrint (("Failed writing console attributes: %d\n", GetLastError ())); 423 DebPrint (("Failed writing console attributes: %d\n", GetLastError ()));
439 else 424 else