then we can't just move the cursor. */
else if (! (!NILP (Vtransient_mark_mode)
&& !NILP (current_buffer->mark_active))
- && w == XWINDOW (current_buffer->last_selected_window)
+ && (w == XWINDOW (current_buffer->last_selected_window)
+ || highlight_nonselected_windows)
&& NILP (w->region_showing)
&& !cursor_in_echo_area)
{
w->last_had_star
= (BUF_MODIFF (XBUFFER (w->buffer)) > BUF_SAVE_MODIFF (XBUFFER (w->buffer))
? Qt : Qnil);
+
+ /* Record if we are showing a region, so can make sure to
+ update it fully at next redisplay. */
+ w->region_showing = (!NILP (Vtransient_mark_mode)
+ && (w == XWINDOW (current_buffer->last_selected_window)
+ || highlight_nonselected_windows)
+ && !NILP (XBUFFER (w->buffer)->mark_active)
+ ? Fmarker_position (XBUFFER (w->buffer)->mark)
+ : Qnil);
+
w->window_end_valid = w->buffer;
last_arrow_position = Voverlay_arrow_position;
last_arrow_string = Voverlay_arrow_string;
/* Record if we are showing a region, so can make sure to
update it fully at next redisplay. */
w->region_showing = (!NILP (Vtransient_mark_mode)
- && w == XWINDOW (current_buffer->last_selected_window)
+ && (w == XWINDOW (current_buffer->last_selected_window)
+ || highlight_nonselected_windows)
&& !NILP (XBUFFER (w->buffer)->mark_active)
? Fmarker_position (XBUFFER (w->buffer)->mark)
: Qnil);
redisplay_window (window, 0, preserve_echo_area);
}
+/* Return value in display table DP (Lisp_Char_Table *) for character
+ C. Since a display table doesn't have any parent, we don't have to
+ follow parent. Do not call this function directly but use the
+ macro DISP_CHAR_VECTOR. */
+Lisp_Object
+disp_char_vector (dp, c)
+ struct Lisp_Char_Table *dp;
+ int c;
+{
+ int code[4], i;
+ Lisp_Object val;
+
+ if (SINGLE_BYTE_CHAR_P (c)) return (dp->contents[c]);
+
+ SPLIT_NON_ASCII_CHAR (c, code[0], code[1], code[2]);
+ if (code[0] != CHARSET_COMPOSITION)
+ {
+ if (code[1] < 32) code[1] = -1;
+ else if (code[2] < 32) code[2] = -1;
+ }
+ /* Here, the possible range of CODE[0] (== charset ID) is
+ 128..MAX_CHARSET. Since the top level char table contains data
+ for multibyte characters after 256th element, we must increment
+ CODE[0] by 128 to get a correct index. */
+ code[0] += 128;
+ code[3] = -1; /* anchor */
+
+ for (i = 0; code[i] >= 0; i++, dp = XCHAR_TABLE (val))
+ {
+ val = dp->contents[code[i]];
+ if (!SUB_CHAR_TABLE_P (val))
+ return (NILP (val) ? dp->defalt : val);
+ }
+ /* Here, VAL is a sub char table. We return the default value of it. */
+ return (dp->defalt);
+}
+
/* Redisplay window WINDOW and its subwindows. */
static void
XFASTINT (w->window_end_vpos) + scroll_amount);
/* Before doing any scrolling, verify that point will be on frame. */
- if (PT > ep.bufpos && !(PT <= xp.bufpos && xp.bufpos < height))
+ if (PT > ep.bufpos && !(PT <= xp.bufpos && xp.vpos < height))
{
if (PT <= xp.bufpos)
{
val.hpos = xp.hpos;
val.tab_offset = xp.tab_offset;
if (pos == ZV)
- vpos = height + scroll_amount;
+ { /* Display from next line */
+ vpos = height + scroll_amount;
+ val.hpos = lmargin;
+ val.tab_offset = 0;
+ }
else if (xp.contin && xp.hpos != lmargin)
{
val.hpos = xp.prevhpos - width + lmargin;
if (! FRAME_TERMCAP_P (f))
while (n--)
{
- int glyph = (INTEGERP (*fp) ? XFASTINT (*fp) : 0);
+ GLYPH glyph = (INTEGERP (*fp) ? XFASTINT (*fp) : 0);
int facecode;
+ unsigned int c = FAST_GLYPH_CHAR (glyph);
+
+ if (c > MAX_CHAR)
+ /* For an invalid character code, use space. */
+ c = ' ';
if (FAST_GLYPH_FACE (glyph) == 0)
/* If GLYPH has no face code, use FACE. */
}
if (to >= s)
- *to = FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (glyph), facecode);
+ *to = FAST_MAKE_GLYPH (c, facecode);
++to;
++fp;
}
/* 1 if we should highlight the region. */
int highlight_region
= (!NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active)
- && XWINDOW (current_buffer->last_selected_window) == w);
+ && (XWINDOW (current_buffer->last_selected_window) == w
+ || highlight_nonselected_windows));
int region_beg, region_end;
int selective = (INTEGERP (current_buffer->selective_display)
: default_invis_vector);
GLYPH truncator = (dp == 0 || !INTEGERP (DISP_TRUNC_GLYPH (dp))
+ || !GLYPH_CHAR_VALID_P (XINT (DISP_TRUNC_GLYPH (dp)))
? '$' : XINT (DISP_TRUNC_GLYPH (dp)));
GLYPH continuer = (dp == 0 || !INTEGERP (DISP_CONTINUE_GLYPH (dp))
+ || !GLYPH_CHAR_VALID_P (XINT (DISP_CONTINUE_GLYPH (dp)))
? '\\' : XINT (DISP_CONTINUE_GLYPH (dp)));
/* If 1, we must handle multibyte characters. */
w->region_showing = Qt;
}
else
- region_beg = region_end = -1;
+ {
+ region_beg = region_end = -1;
+ w->region_showing = Qnil;
+ }
if (MINI_WINDOW_P (w)
&& start == BEG
/* Truncate the prompt a little before the
margin, so user input can at least start
on the first line. */
- w->width > 10 ? w->width - 4 : -1)
+ (XFASTINT (w->width) > 10
+ ? XFASTINT (w->width) - 4 : -1))
- hpos);
hpos += minibuf_prompt_width;
taboffset -= minibuf_prompt_width;
|| left_edge->hpos > 0)
{
pos = left_edge->bufpos;
- DEC_POS (pos); /* MULE: It may be a multi-byte character */
+ /* Since this should not be a valid multibyte character, we
+ can decrease POS by 1. */
+ pos--;
hpos = left_edge->prevhpos;
}
else
else if (c < 0200 && ctl_arrow)
{
if (p1 >= leftmargin)
- *p1 = (fix_glyph (f, (dp && INTEGERP (DISP_CTRL_GLYPH (dp))
- ? XINT (DISP_CTRL_GLYPH (dp)) : '^'),
- current_face)
+ *p1 = (fix_glyph
+ (f, (dp && INTEGERP (DISP_CTRL_GLYPH (dp))
+ && GLYPH_CHAR_VALID_P (XINT (DISP_CTRL_GLYPH (dp)))
+ ? XINT (DISP_CTRL_GLYPH (dp)) : '^'),
+ current_face)
| rev_dir_bit);
p1++;
if (p1 >= leftmargin && p1 < endp)
{
/* C is not a multibyte character. */
if (p1 >= leftmargin)
- *p1 = (fix_glyph (f, (dp && INTEGERP (DISP_ESCAPE_GLYPH (dp))
- ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'),
- current_face)
+ *p1 = (fix_glyph
+ (f, (dp && INTEGERP (DISP_ESCAPE_GLYPH (dp))
+ && GLYPH_CHAR_VALID_P (XINT (DISP_ESCAPE_GLYPH (dp)))
+ ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'),
+ current_face)
| rev_dir_bit);
p1++;
if (p1 >= leftmargin && p1 < endp)
}
else if (!FRAME_HAS_VERTICAL_SCROLL_BARS (f))
*p1++ = (dp && INTEGERP (DISP_BORDER_GLYPH (dp))
- ? DISP_BORDER_GLYPH (dp)
+ ? XINT (DISP_BORDER_GLYPH (dp))
: '|');
}
desired_glyphs->used[vpos] = max (desired_glyphs->used[vpos],
ptr[i] = FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (ptr[i]), 1) | padding;
}
}
+ else
#endif
/* Make the mode line inverse video if the entire line
or if it is the child of a full width window
(which implies that that window is split side-by-side
and the rest of this line is mode lines of the sibling windows). */
- else if (WINDOW_FULL_WIDTH_P (w)
- || WINDOW_FULL_WIDTH_P (XWINDOW (w->parent)))
+ if (WINDOW_FULL_WIDTH_P (w)
+ || WINDOW_FULL_WIDTH_P (XWINDOW (w->parent)))
FRAME_DESIRED_GLYPHS (f)->highlight[vpos] = mode_line_inverse_video;
}
else if (c < 0200 && ! NILP (buffer_defaults.ctl_arrow))
{
if (p1 >= start)
- *p1 = fix_glyph (f, (dp && INTEGERP (DISP_CTRL_GLYPH (dp))
- ? XINT (DISP_CTRL_GLYPH (dp)) : '^'),
- 0);
+ *p1 = (fix_glyph
+ (f, (dp && INTEGERP (DISP_CTRL_GLYPH (dp))
+ && GLYPH_CHAR_VALID_P (XINT (DISP_CTRL_GLYPH (dp)))
+ ? XINT (DISP_CTRL_GLYPH (dp)) : '^'),
+ 0));
p1++;
if (p1 >= start && p1 < end)
*p1 = c ^ 0100;
{
/* C is a control character or a binary byte data. */
if (p1 >= start)
- *p1 = fix_glyph (f, (dp && INTEGERP (DISP_ESCAPE_GLYPH (dp))
- ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'),
- 0);
+ *p1 = (fix_glyph
+ (f, (dp && INTEGERP (DISP_ESCAPE_GLYPH (dp))
+ && GLYPH_CHAR_VALID_P (XINT (DISP_ESCAPE_GLYPH (dp)))
+ ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'),
+ 0));
p1++;
if (p1 >= start && p1 < end)
*p1 = (c >> 6) + '0';
DEFVAR_BOOL ("highlight-nonselected-windows", &highlight_nonselected_windows,
"*Non-nil means highlight region even in nonselected windows.");
- highlight_nonselected_windows = 1;
+ highlight_nonselected_windows = 0;
DEFVAR_BOOL ("multiple-frames", &multiple_frames,
"Non-nil if more than one frame is visible on this display.\n\