/* Terminal control module for terminals described by TERMCAP
Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1998, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GNU Emacs.
if (src->u.cmp.automatic)
{
gstring = composition_gstring_from_id (src->u.cmp.id);
- required = src->u.cmp.to - src->u.cmp.from;
+ required = src->u.cmp.to + 1 - src->u.cmp.from;
}
else
{
}
if (src->u.cmp.automatic)
- for (i = src->u.cmp.from; i < src->u.cmp.to; i++)
+ for (i = src->u.cmp.from; i <= src->u.cmp.to; i++)
{
Lisp_Object g = LGSTRING_GLYPH (gstring, i);
int c = LGLYPH_CHAR (g);
if (! char_charset (c, charset_list, NULL))
- break;
+ c = '?';
buf += CHAR_STRING (c, buf);
nchars++;
}
{
int c = COMPOSITION_GLYPH (cmp, i);
- if (! char_charset (c, charset_list, NULL))
- break;
+ if (c == '\t')
+ continue;
+ if (char_charset (c, charset_list, NULL))
+ {
+ if (CHAR_WIDTH (c) == 0
+ && i > 0 && COMPOSITION_GLYPH (cmp, i - 1) == '\t')
+ /* Should be left-padded */
+ {
+ buf += CHAR_STRING (' ', buf);
+ nchars++;
+ }
+ }
+ else
+ c = '?';
buf += CHAR_STRING (c, buf);
nchars++;
}
- if (i == 0)
- {
- /* The first character of the composition is not encodable. */
- *buf++ = '?';
- nchars++;
- }
}
/* We must skip glyphs to be padded for a wide character. */
else if (! CHAR_GLYPH_PADDING_P (*src))
if (width <= 0 && (width < 0 || !zero_width_ok_p))
width = 1;
+ if (width > 0 && it->line_wrap != TRUNCATE
+ && it->current_x + width > it->last_visible_x)
+ width = it->last_visible_x - it->current_x - 1;
+
if (width > 0 && it->glyph_row)
{
Lisp_Object o_object = it->object;
glyph->u.cmp.automatic = 1;
glyph->u.cmp.id = it->cmp_it.id;
glyph->u.cmp.from = it->cmp_it.from;
- glyph->u.cmp.to = it->cmp_it.to;
+ glyph->u.cmp.to = it->cmp_it.to - 1;
}
glyph->face_id = it->face_id;
{
struct composition *cmp = composition_table[it->cmp_it.id];
- c = COMPOSITION_GLYPH (cmp, 0);
- it->pixel_width = CHAR_WIDTH (it->c);
+ it->pixel_width = cmp->width;
}
else
{
0, 1, 0,
doc: /* Return non-nil if the tty device TERMINAL can display colors.
-TERMINAL can be a terminal id, a frame or nil (meaning the selected
-frame's terminal). This function always returns nil if TERMINAL
-is not on a tty device. */)
+TERMINAL can be a terminal object, a frame, or nil (meaning the
+selected frame's terminal). This function always returns nil if
+TERMINAL does not refer to a text-only terminal. */)
(terminal)
Lisp_Object terminal;
{
Stty_display_color_cells, 0, 1, 0,
doc: /* Return the number of colors supported by the tty device TERMINAL.
-TERMINAL can be a terminal id, a frame or nil (meaning the selected
-frame's terminal). This function always returns 0 if TERMINAL
-is not on a tty device. */)
+TERMINAL can be a terminal object, a frame, or nil (meaning the
+selected frame's terminal). This function always returns 0 if
+TERMINAL does not refer to a text-only terminal. */)
(terminal)
Lisp_Object terminal;
{
doc: /* Return the type of the tty device that TERMINAL uses.
Returns nil if TERMINAL is not on a tty device.
-TERMINAL can be a terminal id, a frame or nil (meaning the selected
-frame's terminal). */)
+TERMINAL can be a terminal object, a frame, or nil (meaning the
+selected frame's terminal). */)
(terminal)
Lisp_Object terminal;
{
DEFUN ("controlling-tty-p", Fcontrolling_tty_p, Scontrolling_tty_p, 0, 1, 0,
doc: /* Return non-nil if TERMINAL is the controlling tty of the Emacs process.
-TERMINAL can be a terminal id, a frame or nil (meaning the selected
-frame's terminal). This function always returns nil if TERMINAL
-is not on a tty device. */)
+TERMINAL can be a terminal object, a frame, or nil (meaning the
+selected frame's terminal). This function always returns nil if
+TERMINAL is not on a tty device. */)
(terminal)
Lisp_Object terminal;
{
do not really do underlining, but say that they do. This function has
no effect if used on a non-tty terminal.
-TERMINAL can be a terminal id, a frame or nil (meaning the selected
-frame's terminal). This function always returns nil if TERMINAL
-is not on a tty device. */)
+TERMINAL can be a terminal object, a frame or nil (meaning the
+selected frame's terminal). This function always returns nil if
+TERMINAL does not refer to a text-only terminal. */)
(terminal)
Lisp_Object terminal;
{
but input is not read from them and if they change, their display is
not updated.
-TTY may be a terminal id, a frame, or nil for the terminal device of
-the currently selected frame.
+TTY may be a terminal object, a frame, or nil for the terminal device
+of the currently selected frame.
This function runs `suspend-tty-functions' after suspending the
device. The functions are run with one arg, the id of the suspended
`resume-tty' does nothing if it is called on a device that is not
suspended.
-TTY may be a terminal id, a frame, or nil for the terminal device of
-the currently selected frame. */)
+TTY may be a terminal object, a frame, or nil (meaning the selected
+frame's terminal). */)
(tty)
Lisp_Object tty;
{
#endif
if (FRAMEP (t->display_info.tty->top_frame))
- FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1);
+ {
+ struct frame *f = XFRAME (t->display_info.tty->top_frame);
+ int width, height;
+ int old_height = FRAME_COLS (f);
+ int old_width = FRAME_LINES (f);
+
+ /* Check if terminal/window size has changed while the frame
+ was suspended. */
+ get_tty_size (fileno (t->display_info.tty->input), &width, &height);
+ if (width != old_width || height != old_height)
+ change_frame_size (f, height, width, 0, 0, 0);
+ FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1);
+ }
init_sys_modes (t->display_info.tty);
mouse_face_face_id
= face_at_buffer_position (w, pos, 0, 0,
- &ignore, pos + 1, 1);
+ &ignore, pos + 1, 1, -1);
/* Display it as active. */
term_show_mouse_face (DRAW_MOUSE_FACE);
mouse_face_face_id
= face_at_buffer_position (w, pos, 0, 0,
- &ignore, pos + 1, 1);
+ &ignore, pos + 1, 1, -1);
/* Display it as active. */
term_show_mouse_face (DRAW_MOUSE_FACE);
}
void
-close_gpm ()
+close_gpm (int fd)
{
- if (gpm_fd >= 0)
- delete_gpm_wait_descriptor (gpm_fd);
+ if (fd >= 0)
+ delete_gpm_wait_descriptor (fd);
while (Gpm_Close()); /* close all the stack */
gpm_tty = NULL;
}
if (!tty || gpm_tty != tty)
return Qnil; /* Not activated on this terminal, nothing to do. */
- close_gpm ();
+ close_gpm (gpm_fd);
return Qnil;
}
#endif /* HAVE_GPM */
DEFVAR_LISP ("suspend-tty-functions", &Vsuspend_tty_functions,
doc: /* Functions to be run after suspending a tty.
-The functions are run with one argument, the terminal id to be suspended.
+The functions are run with one argument, the terminal object to be suspended.
See `suspend-tty'. */);
Vsuspend_tty_functions = Qnil;
DEFVAR_LISP ("resume-tty-functions", &Vresume_tty_functions,
doc: /* Functions to be run after resuming a tty.
-The functions are run with one argument, the terminal id that was revived.
+The functions are run with one argument, the terminal object that was revived.
See `resume-tty'. */);
Vresume_tty_functions = Qnil;