X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fredisplay-tty.c;h=6dc7d63972a6763c1bf603de00f13602266f3512;hb=0d83c23c319751850760298ca61808af61b24105;hp=6794bdbe1766794c0ecd93ecff3a42d3ad1ea9b9;hpb=76759ab036458c54499a454399e19602b8ae6ce3;p=chise%2Fxemacs-chise.git.1 diff --git a/src/redisplay-tty.c b/src/redisplay-tty.c index 6794bdb..6dc7d63 100644 --- a/src/redisplay-tty.c +++ b/src/redisplay-tty.c @@ -53,17 +53,12 @@ Boston, MA 02111-1307, USA. */ invoking them correctly. */ /* # include */ /* # include */ -#ifdef __cplusplus -extern "C" { -#endif -extern int tgetent (const char *, const char *); -extern int tgetflag (const char *); -extern int tgetnum (const char *); -extern char *tgetstr (const char *, char **); -extern void tputs (const char *, int, void (*)(int)); -#ifdef __cplusplus -} -#endif +EXTERN_C int tgetent (const char *, const char *); +EXTERN_C int tgetflag (const char *); +EXTERN_C int tgetnum (const char *); +EXTERN_C char *tgetstr (const char *, char **); +EXTERN_C void tputs (const char *, int, void (*)(int)); + #define FORCE_CURSOR_UPDATE(c) send_string_to_tty_console (c, 0, 0) #define OUTPUTN(c, a, n) \ do { \ @@ -81,11 +76,11 @@ extern void tputs (const char *, int, void (*)(int)); } while (0) #define OUTPUT1_IF(c, a) OUTPUTN_IF (c, a, 1) -static void tty_output_emchar_dynarr (struct window *w, - struct display_line *dl, - Emchar_dynarr *buf, int xpos, - face_index findex, - int cursor); +static void tty_output_charc_dynarr (struct window *w, + struct display_line *dl, + Charc_dynarr *buf, int xpos, + face_index findex, + int cursor); static void tty_output_bufbyte_string (struct window *w, struct display_line *dl, Bufbyte *str, Bytecount len, @@ -104,13 +99,13 @@ static void term_get_fkeys (Lisp_Object keymap, char **address); Non-Mule tty's don't have fonts (that we use at least), so everything is considered to be fixed width -- in other words, we return LEN. Under Mule, however, a character can still cover more than one - column, so we use emchar_string_displayed_columns(). + column, so we use charc_string_displayed_columns(). ****************************************************************************/ static int -tty_text_width (struct frame *f, struct face_cachel *cachel, const Emchar *str, - Charcount len) +tty_text_width (struct frame *f, struct face_cachel *cachel, + const Charc *str, Charcount len) { - return emchar_string_displayed_columns (str, len); + return charc_string_displayed_columns (str, len); } /***************************************************************************** @@ -171,8 +166,7 @@ static void #endif tty_frame_output_end (struct frame *f) { - struct device *d = XDEVICE (FRAME_DEVICE (f)); - struct console *c = XCONSOLE (DEVICE_CONSOLE (d)); + struct console *c = XCONSOLE (FRAME_CONSOLE (f)); CONSOLE_TTY_CURSOR_X (c) = CONSOLE_TTY_FINAL_CURSOR_X (c); CONSOLE_TTY_CURSOR_Y (c) = CONSOLE_TTY_FINAL_CURSOR_Y (c); @@ -202,7 +196,7 @@ tty_output_display_block (struct window *w, struct display_line *dl, int block, int cursor_height) { struct frame *f = XFRAME (w->frame); - Emchar_dynarr *buf = Dynarr_new (Emchar); + Charc_dynarr *buf; struct display_block *db = Dynarr_atp (dl->display_blocks, block); rune_dynarr *rba = db->runes; @@ -228,7 +222,7 @@ tty_output_display_block (struct window *w, struct display_line *dl, int block, if (end < 0) end = Dynarr_length (rba); - Dynarr_reset (buf); + buf = Dynarr_new (Charc); while (elt < end && Dynarr_atp (rba, elt)->xpos < start_pixpos) { @@ -242,18 +236,18 @@ tty_output_display_block (struct window *w, struct display_line *dl, int block, rb = Dynarr_atp (rba, elt); if (rb->findex == findex && rb->type == RUNE_CHAR - && rb->object.chr.ch != '\n' + && (!CHARC_ASCII_EQ (rb->object.cglyph, '\n')) && (rb->cursor_type != CURSOR_ON || NILP (w->text_cursor_visible_p))) { - Dynarr_add (buf, rb->object.chr.ch); + Dynarr_add (buf, rb->object.cglyph); elt++; } else { if (Dynarr_length (buf)) { - tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0); + tty_output_charc_dynarr (w, dl, buf, xpos, findex, 0); xpos = rb->xpos; } Dynarr_reset (buf); @@ -263,13 +257,12 @@ tty_output_display_block (struct window *w, struct display_line *dl, int block, findex = rb->findex; xpos = rb->xpos; - if (rb->object.chr.ch == '\n') + if (CHARC_ASCII_EQ (rb->object.cglyph, '\n')) { /* Clear in case a cursor was formerly here. */ - - Dynarr_add (buf, ' '); - tty_output_emchar_dynarr (w, dl, buf, rb->xpos, - DEFAULT_INDEX, 0); + Dynarr_add (buf, ASCII_TO_CHARC (' ')); + tty_output_charc_dynarr (w, dl, buf, rb->xpos, + DEFAULT_INDEX, 0); Dynarr_reset (buf); cmgoto (f, dl->ypos - 1, rb->xpos); @@ -280,8 +273,8 @@ tty_output_display_block (struct window *w, struct display_line *dl, int block, { /* There is not a distinct eol cursor on tty's. */ - Dynarr_add (buf, rb->object.chr.ch); - tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0); + Dynarr_add (buf, rb->object.cglyph); + tty_output_charc_dynarr (w, dl, buf, xpos, findex, 0); Dynarr_reset (buf); cmgoto (f, dl->ypos - 1, xpos); @@ -295,17 +288,17 @@ tty_output_display_block (struct window *w, struct display_line *dl, int block, modeline and this will suffice for that. */ else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE) { - Emchar ch_to_add; + Charc ec_to_add; int size = rb->width; if (rb->type == RUNE_BLANK) - ch_to_add = ' '; + ec_to_add = ASCII_TO_CHARC (' '); else - ch_to_add = '-'; + ec_to_add = ASCII_TO_CHARC ('-'); while (size--) - Dynarr_add (buf, ch_to_add); - tty_output_emchar_dynarr (w, dl, buf, rb->xpos, findex, 0); + Dynarr_add (buf, ec_to_add); + tty_output_charc_dynarr (w, dl, buf, rb->xpos, findex, 0); if (xpos >= cursor_start && cursor_start < xpos + Dynarr_length (buf)) @@ -351,7 +344,7 @@ tty_output_display_block (struct window *w, struct display_line *dl, int block, case IMAGE_TEXT: case IMAGE_POINTER: default: - abort (); + ABORT (); } IMAGE_INSTANCE_OPTIMIZE_OUTPUT (XIMAGE_INSTANCE (instance)) = 0; @@ -361,12 +354,12 @@ tty_output_display_block (struct window *w, struct display_line *dl, int block, elt++; } else - abort (); + ABORT (); } } if (Dynarr_length (buf)) - tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0); + tty_output_charc_dynarr (w, dl, buf, xpos, findex, 0); Dynarr_free (buf); } @@ -543,31 +536,31 @@ tty_output_bufbyte_string (struct window *w, struct display_line *dl, tty_turn_off_face (w, findex); } -static Bufbyte_dynarr *tty_output_emchar_dynarr_dynarr; +static Bufbyte_dynarr *tty_output_charc_dynarr_dynarr; /***************************************************************************** - tty_output_emchar_dynarr + tty_output_charc_dynarr Given a string and a starting position, output that string in the given face. If cursor is true, draw a cursor around the string. ****************************************************************************/ static void -tty_output_emchar_dynarr (struct window *w, struct display_line *dl, - Emchar_dynarr *buf, int xpos, face_index findex, - int cursor) +tty_output_charc_dynarr (struct window *w, struct display_line *dl, + Charc_dynarr *buf, int xpos, face_index findex, + int cursor) { - if (!tty_output_emchar_dynarr_dynarr) - tty_output_emchar_dynarr_dynarr = Dynarr_new (Bufbyte); + if (!tty_output_charc_dynarr_dynarr) + tty_output_charc_dynarr_dynarr = Dynarr_new (Bufbyte); else - Dynarr_reset (tty_output_emchar_dynarr_dynarr); + Dynarr_reset (tty_output_charc_dynarr_dynarr); - convert_emchar_string_into_bufbyte_dynarr (Dynarr_atp (buf, 0), + convert_charc_string_into_bufbyte_dynarr (Dynarr_atp (buf, 0), Dynarr_length (buf), - tty_output_emchar_dynarr_dynarr); + tty_output_charc_dynarr_dynarr); tty_output_bufbyte_string (w, dl, - Dynarr_atp (tty_output_emchar_dynarr_dynarr, 0), - Dynarr_length (tty_output_emchar_dynarr_dynarr), + Dynarr_atp (tty_output_charc_dynarr_dynarr, 0), + Dynarr_length (tty_output_charc_dynarr_dynarr), xpos, findex, cursor); } @@ -870,6 +863,9 @@ set_tty_modes (struct console *c) OUTPUT1_IF (c, TTY_SD (c).init_motion); OUTPUT1_IF (c, TTY_SD (c).cursor_visible); OUTPUT1_IF (c, TTY_SD (c).keypad_on); + + if (TTY_FLAGS (c).auto_margins) + OUTPUT1_IF (c, TTY_SD (c).disable_auto_margins); } /***************************************************************************** @@ -887,7 +883,16 @@ reset_tty_modes (struct console *c) OUTPUT1_IF (c, TTY_SD (c).keypad_off); OUTPUT1_IF (c, TTY_SD (c).cursor_normal); OUTPUT1_IF (c, TTY_SD (c).end_motion); - tty_frame_output_end (XFRAME (CONSOLE_SELECTED_FRAME (c))); + + if (TTY_FLAGS (c).auto_margins) + OUTPUT1_IF (c, TTY_SD (c).enable_auto_margins); + + { + Lisp_Object frm = CONSOLE_SELECTED_FRAME (c); + + if (!NILP (frm)) + tty_frame_output_end (XFRAME (frm)); + } } /***************************************************************************** @@ -924,6 +929,7 @@ tty_redisplay_shutdown (struct console *c) up or removed. */ +#ifdef NOT_YET /* FLAGS - these don't need to be console local since only one console can be being updated at a time. */ static int insert_mode_on; /* nonzero if in insert mode */ @@ -932,7 +938,6 @@ static int underline_mode_on; /* nonzero if in underline mode */ static int alternate_mode_on; /* nonzero if in alternate char set */ static int attributes_on; /* nonzero if any attributes on */ -#ifdef NOT_YET static void turn_on_insert (struct frame *f) { @@ -1059,12 +1064,12 @@ init_tty_for_redisplay (struct device *d, char *terminal_type) CONSOLE_TTY_DATA (c)->term_entry_buffer = (char *) xmalloc (2044); bufptr = CONSOLE_TTY_DATA (c)->term_entry_buffer; -#if !defined(WIN32) +#ifdef SIGTTOU /* SIGTT* don't exist under win32 */ EMACS_BLOCK_SIGNAL (SIGTTOU); #endif status = tgetent (entry_buffer, terminal_type); -#if !defined(WIN32) +#ifdef SIGTTOU EMACS_UNBLOCK_SIGNAL (SIGTTOU); #endif #if 0 @@ -1185,12 +1190,14 @@ init_tty_for_redisplay (struct device *d, char *terminal_type) TTY_SD (c).audio_bell = "\07"; } - TTY_SD (c).cursor_visible = tgetstr ("ve", &bufptr); - TTY_SD (c).cursor_normal = tgetstr ("vs", &bufptr); + TTY_SD (c).cursor_visible = tgetstr ("vs", &bufptr); + TTY_SD (c).cursor_normal = tgetstr ("ve", &bufptr); TTY_SD (c).init_motion = tgetstr ("ti", &bufptr); TTY_SD (c).end_motion = tgetstr ("te", &bufptr); TTY_SD (c).keypad_on = tgetstr ("ks", &bufptr); TTY_SD (c).keypad_off = tgetstr ("ke", &bufptr); + TTY_SD (c).disable_auto_margins = tgetstr ("RA", &bufptr); + TTY_SD (c).enable_auto_margins = tgetstr ("SA", &bufptr); /* @@ -1203,6 +1210,7 @@ init_tty_for_redisplay (struct device *d, char *terminal_type) TTY_FLAGS (c).memory_below_frame = tgetflag ("db"); TTY_FLAGS (c).standout_width = tgetnum ("sg"); TTY_FLAGS (c).underline_width = tgetnum ("ug"); + TTY_FLAGS (c).auto_margins = tgetflag ("am"); if (TTY_FLAGS (c).standout_width == -1) TTY_FLAGS (c).standout_width = 0; @@ -1218,6 +1226,7 @@ init_tty_for_redisplay (struct device *d, char *terminal_type) */ cm_cost_init (c); +#ifdef NOT_YET /* * Initialize local flags. */ @@ -1226,6 +1235,7 @@ init_tty_for_redisplay (struct device *d, char *terminal_type) underline_mode_on = 0; alternate_mode_on = 0; attributes_on = 0; +#endif /* * Attempt to initialize the function_key_map to