IKEYAMA Tomonori <tomonori(a)suiyokai.org> writes:
Mike Alexander <mta(a)arbortext.com> writes:
> I've noticed another minor redisplay problem in the native XEmacs on
> Windows as of the current contents of the CVS archive. If you have
> "truncate lines" turned off and the window is narrow enough that a
> line wraps, then when you type in the first screen line of the
> wrapped text line, the second screen line isn't updated. If you
> resize the window, or otherwise force a refresh, the line is
> displayed correctly. I presume this is not intentional, but I don't
> know the redisplay code well enough to know where to look and real
> work is intruding to the point where I don't have time to learn about
> it.
This is because of my text image glyph change. My change is for
putting a text image into text runes instead of glyph runes. And
continuation glyph is a text image under mswindows and tty, then
searching that among runes is failed.
This patch fix the above and makes add_margin_runes to call
add_glyph_rune.
2000-04-14 IKEYAMA Tomonori <tomonori(a)suiyokai.org>
* redisplay.h (struct display_line): Add a new variable,
line_continuation.
* redisplay.c (create_text_block): Set dl->line_continuation if
the line continues.
(create_string_text_block): Ditto.
(regenerate_window_incrementally): Use line_continuation instead
of searching continuation glyph.
(add_margin_runes): Call add_glyph_rune.
(add_glyph_rune): Handle margin glyph.
Index: src/redisplay.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/redisplay.c,v
retrieving revision 1.55.2.51
diff -u -r1.55.2.51 redisplay.c
--- redisplay.c 2000/04/10 16:32:17 1.55.2.51
+++ redisplay.c 2000/04/13 15:23:28
@@ -1540,7 +1540,8 @@
|| (pos_type == BEGIN_GLYPHS &&
extent_begin_glyph_layout (XEXTENT (gb->extent)) == GL_TEXT)
|| (pos_type == END_GLYPHS &&
- extent_end_glyph_layout (XEXTENT (gb->extent)) == GL_TEXT))
+ extent_end_glyph_layout (XEXTENT (gb->extent)) == GL_TEXT)
+ || pos_type == LEFT_GLYPHS || pos_type == RIGHT_GLYPHS)
{
struct rune rb;
int width;
@@ -1899,6 +1900,7 @@
dl->used_prop_data = 0;
dl->num_chars = 0;
+ dl->line_continuation = 0;
xzero (data);
data.ef = extent_fragment_new (w->buffer, f);
@@ -2489,6 +2491,7 @@
/* data.bi_bufpos is already at the start of the next line. */
+ dl->line_continuation = 1;
gb.glyph = Vcontinuation_glyph;
cachel = GLYPH_CACHEL (w, CONT_GLYPH_INDEX);
}
@@ -2741,12 +2744,27 @@
? dl->left_glyphs
: dl->right_glyphs);
int elt, end;
- int xpos = start;
int reverse;
struct window *w = XWINDOW (window);
struct frame *f = XFRAME (w->frame);
struct device *d = XDEVICE (f->device);
+ pos_data data;
+ xzero (data);
+ data.d = d;
+ data.window = window;
+ data.db = db;
+ data.dl = dl;
+ data.pixpos = start;
+ data.cursor_type = NO_CURSOR;
+ data.cursor_x = -1;
+ data.last_charset = Qunbound;
+ data.last_findex = DEFAULT_INDEX;
+ data.result_str = Qnil;
+ data.string = Qnil;
+ data.new_ascent = dl->ascent;
+ data.new_descent = dl->descent;
+
if ((layout == GL_WHITESPACE && side == LEFT_GLYPHS)
|| (layout == GL_INSIDE_MARGIN && side == RIGHT_GLYPHS))
{
@@ -2774,107 +2792,31 @@
|| (side == RIGHT_GLYPHS &&
extent_end_glyph_layout (XEXTENT (gb->extent)) == layout)))
{
- Lisp_Object instance =
- glyph_image_instance (gb->glyph, window, ERROR_ME_NOT, 1);
-
- if (TEXT_IMAGE_INSTANCEP (instance))
- {
- Lisp_Object string = XIMAGE_INSTANCE_TEXT_STRING (instance);
- pos_data data;
-
- xzero (data);
- data.d = d;
- data.window = window;
- data.db = db;
- data.dl = dl;
- data.pixpos = xpos;
- data.max_pixpos = xpos + gb->width;
- data.cursor_type = CURSOR_OFF;
- data.cursor_x = -1;
- data.findex = gb->findex;
- data.last_charset = Qunbound;
- data.last_findex = DEFAULT_INDEX;
- data.result_str = Qnil;
- data.string = Qnil;
- add_bufbyte_string_runes (&data, XSTRING_DATA (string),
- XSTRING_LENGTH (string), 0);
- }
- else
- {
- struct rune rb;
-
- rb.width = gb->width;
- rb.findex = gb->findex;
- rb.xpos = xpos;
- rb.bufpos = -1;
- rb.endpos = 0;
- rb.type = RUNE_DGLYPH;
- rb.object.dglyph.glyph = gb->glyph;
- rb.object.dglyph.extent = gb->extent;
- rb.object.dglyph.xoffset = 0;
- rb.cursor_type = CURSOR_OFF;
- Dynarr_add (db->runes, rb);
- }
-
- xpos += gb->width;
+ data.findex = gb->findex;
+ data.max_pixpos = data.pixpos + gb->width;
+ add_glyph_rune (&data, gb, side, 0, NULL);
count--;
gb->active = 0;
-
- if (glyph_contrib_p (gb->glyph, window))
- {
- unsigned short ascent, descent;
- Lisp_Object baseline = glyph_baseline (gb->glyph, window);
-
- ascent = glyph_ascent (gb->glyph, window);
- descent = glyph_descent (gb->glyph, window);
-
- /* A pixmap that has not had a baseline explicitly set.
- We use the existing ascent / descent ratio of the
- line. */
- if (NILP (baseline))
- {
- int gheight = ascent + descent;
- int line_height = dl->ascent + dl->descent;
- int pix_ascent, pix_descent;
-
- pix_descent = (int) (gheight * dl->descent) / line_height;
- pix_ascent = gheight - pix_descent;
-
- dl->ascent = max ((int) dl->ascent, pix_ascent);
- dl->descent = max ((int) dl->descent, pix_descent);
- }
-
- /* A string so determine contribution normally. */
- else if (EQ (baseline, Qt))
- {
- dl->ascent = max (dl->ascent, ascent);
- dl->descent = max (dl->descent, descent);
- }
-
- /* A pixmap with an explicitly set baseline. We determine the
- contribution here. */
- else if (INTP (baseline))
- {
- int height = ascent + descent;
- int pix_ascent, pix_descent;
-
- pix_ascent = height * XINT (baseline) / 100;
- pix_descent = height - pix_ascent;
-
- dl->ascent = max ((int) dl->ascent, pix_ascent);
- dl->descent = max ((int) dl->descent, pix_descent);
- }
-
- /* Otherwise something is screwed up. */
- else
- abort ();
- }
}
(reverse ? elt-- : elt++);
}
+
+ if (data.max_pixmap_height)
+ {
+ int height = data.new_ascent + data.new_descent;
+ int pix_ascent, pix_descent;
+
+ pix_descent = data.max_pixmap_height * data.new_descent / height;
+ pix_ascent = data.max_pixmap_height - pix_descent;
+ data.new_ascent = max (data.new_ascent, pix_ascent);
+ data.new_descent = max (data.new_descent, pix_descent);
+ }
+
+ dl->ascent = data.new_ascent;
+ dl->descent = data.new_descent;
- return xpos;
+ return data.pixpos;
}
/* Add a blank to a margin display block. */
@@ -4413,6 +4355,7 @@
dl->used_prop_data = 0;
dl->num_chars = 0;
+ dl->line_continuation = 0;
/* set up faces to use for clearing areas, used by
output_display_line */
@@ -4805,6 +4748,7 @@
/* data.bi_bufpos is already at the start of the next line. */
+ dl->line_continuation = 1;
gb.glyph = Vcontinuation_glyph;
cachel = GLYPH_CACHEL (w, CONT_GLYPH_INDEX);
}
@@ -5643,20 +5587,9 @@
assert (cdl->end_bufpos == ddl->end_bufpos);
assert (cdl->offset == ddl->offset);
- /* If the last rune is already a continuation glyph, fail.
- #### We should be able to handle this better. */
- {
- struct display_block *db = get_display_block_from_line (ddl, TEXT);
- if (Dynarr_length (db->runes))
- {
- struct rune *rb =
- Dynarr_atp (db->runes, Dynarr_length (db->runes) - 1);
-
- if (rb->type == RUNE_DGLYPH
- && EQ (rb->object.dglyph.glyph, Vcontinuation_glyph))
- return 0;
- }
- }
+ /* If the line continues to next display line, fail. */
+ if (ddl->line_continuation)
+ return 0;
/* If the line was generated using propagation data, fail. */
if (ddl->used_prop_data)
@@ -5673,20 +5606,10 @@
Dynarr_free (prop);
return 0;
}
-
- /* If the last rune is now a continuation glyph, fail. */
- {
- struct display_block *db = get_display_block_from_line (ddl, TEXT);
- if (Dynarr_length (db->runes))
- {
- struct rune *rb =
- Dynarr_atp (db->runes, Dynarr_length (db->runes) - 1);
- if (rb->type == RUNE_DGLYPH
- && EQ (rb->object.dglyph.glyph, Vcontinuation_glyph))
- return 0;
- }
- }
+ /* If the line continues to next display line, fail. */
+ if (ddl->line_continuation)
+ return 0;
/* If any line position parameters have changed or a
cursor has disappeared or disappeared, fail. */
Index: src/redisplay.h
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/redisplay.h,v
retrieving revision 1.7.2.25
diff -u -r1.7.2.25 redisplay.h
--- redisplay.h 2000/03/11 18:09:25 1.7.2.25
+++ redisplay.h 2000/04/13 15:23:30
@@ -308,6 +308,9 @@
char modeline; /* t if this line is a modeline */
+ char line_continuation; /* t if this line continues to
+ next display line. */
+
/* Dynamic array of display blocks */
display_block_dynarr *display_blocks;