summaryrefslogtreecommitdiff
path: root/src/w32fns.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-07-21 10:12:03 +0300
committerEli Zaretskii <eliz@gnu.org>2022-07-21 10:12:03 +0300
commit46052d1dcbf5beb24cc68195006f958b2d0dbe27 (patch)
tree0fb5dbae39e1c69a5028a1dea7e6214cf32adcef /src/w32fns.c
parent50ff15bb8aee1bffbd4a69f8bb7c17c7d11b0bcc (diff)
downloademacs-46052d1dcbf5beb24cc68195006f958b2d0dbe27.tar.gz
Make sure we don't unknowingly truncate tooltip text
* src/w32fns.c (Fx_show_tip): Add assertion when the default tooltip dimension limits are insufficient. (Bug#56561)
Diffstat (limited to 'src/w32fns.c')
-rw-r--r--src/w32fns.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/w32fns.c b/src/w32fns.c
index 51540e1880c..5e42a1df6ff 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -7568,7 +7568,23 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
clear_glyph_matrix (w->desired_matrix);
clear_glyph_matrix (w->current_matrix);
SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
- try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
+ bool displayed = try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
+ if (!displayed && NILP (Vx_max_tooltip_size))
+ {
+#ifdef ENABLE_CHECKING
+ struct glyph_row *row = w->desired_matrix->rows;
+ struct glyph_row *end =
+ w->desired_matrix->rows + w->desired_matrix->nrows;
+ while (row < end)
+ {
+ if (!row->displays_text_p
+ || row->ends_at_zv_p)
+ break;
+ ++row;
+ }
+ eassert (row < end && row->ends_at_zv_p);
+#endif
+ }
/* Calculate size of tooltip window. */
size = Fwindow_text_pixel_size (window, Qnil, Qnil, Qnil,
make_fixnum (w->pixel_height), Qnil,
@@ -10770,7 +10786,7 @@ bass-down, bass-boost, bass-up, treble-down, treble-up */);
DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size,
doc: /* SKIP: real doc in xfns.c. */);
- Vx_max_tooltip_size = Fcons (make_fixnum (80), make_fixnum (40));
+ Vx_max_tooltip_size = Qnil;
DEFVAR_LISP ("x-no-window-manager", Vx_no_window_manager,
doc: /* SKIP: real doc in xfns.c. */);