aboutsummaryrefslogtreecommitdiffstats
path: root/src/msdos.c
diff options
context:
space:
mode:
authorPo Lu2023-08-07 21:14:53 +0800
committerPo Lu2023-08-07 21:14:53 +0800
commit72a606bb275b91845febd84c52897be8b8b0d877 (patch)
treea39f8804cf3f678cf94a3d899b3ceb2941cc08b5 /src/msdos.c
parent6990af4ca9057ef203c316f2d18510a07025be6c (diff)
downloademacs-72a606bb275b91845febd84c52897be8b8b0d877.tar.gz
emacs-72a606bb275b91845febd84c52897be8b8b0d877.zip
Fix mouse face display bug on MS-DOS
* src/msdos.c (tty_draw_row_with_mouse_face): Tweak coordinates to reflect the number of glyphs used within the margin area.
Diffstat (limited to 'src/msdos.c')
-rw-r--r--src/msdos.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/msdos.c b/src/msdos.c
index 75a39045cee..1b7f2d4ae21 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -979,11 +979,15 @@ tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row,
979 if (hl == DRAW_MOUSE_FACE) 979 if (hl == DRAW_MOUSE_FACE)
980 { 980 {
981 int vpos = row->y + WINDOW_TOP_EDGE_Y (w); 981 int vpos = row->y + WINDOW_TOP_EDGE_Y (w);
982 int kstart = start_hpos + WINDOW_LEFT_EDGE_X (w); 982 int kstart = (start_hpos + WINDOW_LEFT_EDGE_X (w)
983 + row->used[LEFT_MARGIN_AREA]);
983 int nglyphs = end_hpos - start_hpos; 984 int nglyphs = end_hpos - start_hpos;
984 int offset = ScreenPrimary + 2*(vpos*screen_size_X + kstart) + 1; 985 int offset = ScreenPrimary + 2*(vpos*screen_size_X + kstart) + 1;
985 int start_offset = offset; 986 int start_offset = offset;
986 987
988 if (end_hpos >= row->used[TEXT_AREA])
989 nglyphs = row->used[TEXT_AREA] - start_hpos;
990
987 if (tty->termscript) 991 if (tty->termscript)
988 fprintf (tty->termscript, "\n<MH+ %d-%d:%d>", 992 fprintf (tty->termscript, "\n<MH+ %d-%d:%d>",
989 kstart, kstart + nglyphs - 1, vpos); 993 kstart, kstart + nglyphs - 1, vpos);
@@ -1021,6 +1025,9 @@ tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row,
1021 temporarily move cursor coordinates to the beginning of 1025 temporarily move cursor coordinates to the beginning of
1022 the highlight region. */ 1026 the highlight region. */
1023 new_pos_X = start_hpos + WINDOW_LEFT_EDGE_X (w); 1027 new_pos_X = start_hpos + WINDOW_LEFT_EDGE_X (w);
1028 /* The coordinates supplied by the caller are relative to the
1029 text area, not the window itself. */
1030 new_pos_X += row->used[LEFT_MARGIN_AREA];
1024 new_pos_Y = row->y + WINDOW_TOP_EDGE_Y (w); 1031 new_pos_Y = row->y + WINDOW_TOP_EDGE_Y (w);
1025 1032
1026 if (tty->termscript) 1033 if (tty->termscript)