diff options
author | Po Lu <luangruo@yahoo.com> | 2022-07-21 16:26:34 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-07-21 16:26:50 +0800 |
commit | a29a3ad55d650af6230e2cfe8ef1ef45b5feb133 (patch) | |
tree | e7e41121f33c6e592c406f81f4f8cb5c094f33e2 /src/xfns.c | |
parent | 5f1023a2ffe7c96027c3eaf23c1cf93cd5c78dfa (diff) | |
download | emacs-a29a3ad55d650af6230e2cfe8ef1ef45b5feb133.tar.gz |
Apply tooltip assertions to all instances of x-show-tip
* src/haikufns.c (Fx_show_tip):
(syms_of_haikufns):
* src/nsfns.m (Fx_show_tip):
(syms_of_nsfns):
* src/pgtkfns.c (Fx_show_tip):
(syms_of_pgtkfns):
* src/xfns.c (Fx_show_tip):
(syms_of_xfns): Add assertion and adjust default values.
Diffstat (limited to 'src/xfns.c')
-rw-r--r-- | src/xfns.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/xfns.c b/src/xfns.c index 44208ffd515..ce867c1619c 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -8623,6 +8623,10 @@ Text larger than the specified size is clipped. */) Window child; XWindowAttributes child_attrs; int dest_x_return, dest_y_return; + bool displayed; +#ifdef ENABLE_CHECKING + struct glyph_row *row, *end; +#endif AUTO_STRING (tip, " *tip*"); specbind (Qinhibit_redisplay, Qt); @@ -8835,7 +8839,26 @@ Text larger than the specified size is clipped. */) 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); + displayed = try_window (window, pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); + + if (!displayed && NILP (Vx_max_tooltip_size)) + { +#ifdef ENABLE_CHECKING + row = w->desired_matrix->rows; + 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, @@ -9949,7 +9972,7 @@ or when you set the mouse color. */); DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size, doc: /* Maximum size for tooltips. Value is a pair (COLUMNS . ROWS). Text larger than this is clipped. */); - 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: /* Non-nil if no X window manager is in use. |