diff --git a/src/dispextern.h b/src/dispextern.h index 3a4d6095f73..e8f984e1a71 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2801,6 +2801,12 @@ #define OVERLAY_STRING_CHUNK_SIZE 16 is in effect, and only in hscrolled windows. */ int stretch_adjust; + /* Left fringe caption (Qnil or a stringp) */ + Lisp_Object left_user_fringe_caption; + + /* Right fringe caption (Qnil or a stringp)*/ + Lisp_Object right_user_fringe_caption; + /* Left fringe bitmap number (enum fringe_bitmap_type). */ unsigned left_user_fringe_bitmap : FRINGE_ID_BITS; diff --git a/src/xdisp.c b/src/xdisp.c index 75d769600c4..5c5d39acde1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -3265,6 +3265,10 @@ init_iterator (struct it *it, struct window *w, /* Clear IT, and set it->object and other IT's Lisp objects to Qnil. Other parts of redisplay rely on that. */ memclear (it, sizeof *it); + + it->left_user_fringe_caption = Qnil; + it->right_user_fringe_caption = Qnil; + it->current.overlay_string_index = -1; it->current.dpvec_index = -1; it->base_face_id = remapped_base_face_id; @@ -6127,6 +6131,13 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, face_id = face_id2; } + Lisp_Object caption = Qnil; + if (CONSP (XCDR (XCDR (XCDR (spec))))) + { + caption = XCAR (XCDR (XCDR (XCDR (spec)))); + } + + /* Save current settings of IT so that we can restore them when we are finished with the glyph property value. */ push_it (it, position); @@ -6150,11 +6161,13 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, { it->left_user_fringe_bitmap = fringe_bitmap; it->left_user_fringe_face_id = face_id; + it->left_user_fringe_caption = caption; } else { it->right_user_fringe_bitmap = fringe_bitmap; it->right_user_fringe_face_id = face_id; + it->right_user_fringe_caption = caption; } } #endif /* HAVE_WINDOW_SYSTEM */ @@ -35720,10 +35733,50 @@ note_mouse_highlight (struct frame *f, int x, int y) } else cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; - else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE - || part == ON_VERTICAL_SCROLL_BAR + else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE) { + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; + + if (NILP (help_echo_string)) { + /* Translate windows coordinates into vertical window + position. */ + int hpos, vpos, area; + x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, 0, 0, &area); + + /* Figure out where the window starts - will need to get to + the fringe line */ + struct text_pos start_pos; + SET_TEXT_POS_FROM_MARKER (start_pos, w->start); + + /* Need an iterator to walk through all the properties on + the line. Find the line first, reset text from previous + lines and then collect the properties on it. */ + struct it it; + init_iterator (&it, w, CHARPOS(start_pos), BYTEPOS (start_pos), + NULL, DEFAULT_FACE_ID); + + /* Walk to the fringe line and reset captions found on the + way*/ + move_it_by_lines(&it, vpos); + it.left_user_fringe_caption = Qnil; + it.right_user_fringe_caption = Qnil; + + /* Reset and go through the line. */ + move_it_by_lines (&it, 1); + + /* Output through whatever the user prefers, most likely a + tooltip */ + if (part == ON_LEFT_FRINGE + && !NILP(it.left_user_fringe_caption)) + help_echo_string = it.left_user_fringe_caption; + else if (part == ON_RIGHT_FRINGE + && !NILP(it.right_user_fringe_caption)) + help_echo_string = it.right_user_fringe_caption; + } + + } + else if (part == ON_VERTICAL_SCROLL_BAR || part == ON_HORIZONTAL_SCROLL_BAR) - cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; + cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; else cursor = FRAME_OUTPUT_DATA (f)->text_cursor; #endif