which seems promising. However, point movement over the stretch glyph is very wonky -- Emacs basically refuses to put point after that stretch glyph. Anybody got any tips on what I need to do to get point movement working here? diff --git a/src/dispextern.h b/src/dispextern.h index a698f6546b..a78be900db 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2185,6 +2185,8 @@ #define MAX_FRINGE_BITMAPS (1<ellipsis_p = true; } + +/*********************************************************************** + `min-width' property + ***********************************************************************/ + +/* Set up iterator IT from `min-width' property at its current position. + Called from handle_stop. */ + +static enum prop_handled +handle_min_width_prop (struct it *it) +{ + if (STRINGP (it->string) || !it->glyph_row) + return HANDLED_NORMALLY; + + Lisp_Object buffer = it->w->contents; + struct text_pos *position = &it->current.pos; + ptrdiff_t bufpos = CHARPOS (*position); + + Lisp_Object propval = Fget_text_property (make_fixnum (bufpos), + Qmin_width, buffer); + /* We're being called at the end of the `min-width' sequence, + probably. */ + if (NILP (propval)) + { + /* Check that we're really right after the sequence of + characters covered by this `min-width'. */ + if (!NILP (it->min_width_property) + && bufpos > BEGV + && EQ (it->min_width_property, + Fget_text_property (make_fixnum (bufpos - 1), + Qmin_width, buffer))) + { + struct font *font = NULL; + double width; + if (FRAME_WINDOW_P (it->f)) + { +#ifdef HAVE_WINDOW_SYSTEM + struct face *face = FACE_FROM_ID (it->f, it->face_id); + font = face->font ? face->font : FRAME_FONT (it->f); + const int stretch_ascent = + (((it->ascent + it->descent) + * FONT_BASE (font)) / FONT_HEIGHT (font)); + prepare_face_for_display (it->f, face); +#else + struct face *face = NULL; +#endif + calc_pixel_width_or_height (&width, it, + XCAR (it->min_width_property), + font, true, NULL); + width -= it->current_x - it->min_width_start; + append_stretch_glyph (it, Qnil, + (int)width, + it->ascent + it->descent, + stretch_ascent); + it->min_width_property = Qnil; + } + } + } + /* We're at the start of a `min-width' sequence -- record the + position and the property, so that we can later see if we're at + the end. */ + else if (CONSP (propval) && NUMBERP (XCAR (propval))) + { + if (bufpos == BEGV + || (bufpos > BEGV + && !EQ (propval, Fget_text_property (make_fixnum (bufpos - 1), + Qmin_width, buffer)))) + { + it->min_width_property = propval; + it->min_width_start = it->current_x; + } + } + return HANDLED_NORMALLY; +} + /*********************************************************************** @@ -7186,6 +7267,7 @@ reseat_1 (struct it *it, struct text_pos pos, bool set_stop_p) } /* This make the information stored in it->cmp_it invalidate. */ it->cmp_it.id = -1; + it->min_width_property = Qnil; } -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no