annotate src/redisplay-tty.c @ 237:89ec2bb86eea r20-5b17

Import from CVS: tag r20-5b17
author cvs
date Mon, 13 Aug 2007 10:15:03 +0200
parents 41ff10fd062f
children 677f6a0ee643
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Communication module for TTY terminals.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 Copyright (C) 1995, 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 Copyright (C) 1996 Chuck Thompson.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 /* Synched up with: Not completely synched with FSF. Mostly divergent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 from FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 /* This file has been Mule-ized. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 /* Written by Chuck Thompson. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 /* Color support added by Ben Wing. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include "lisp.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #include "buffer.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include "console-tty.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #include "events.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #include "faces.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #include "frame.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 #include "glyphs.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 #include "lstream.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #include "objects-tty.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 #include "redisplay.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #include "sysdep.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #include "window.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 /* These headers #define all kinds of common words like "columns"...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 What a bunch of losers. If we were to include them, we'd have to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 include them last to prevent them from messing up our own header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 files (struct slot names, etc.). But it turns out that there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 other conflicts as well on some systems, so screw it: we'll just
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 re-declare the routines we use and assume the code in this file is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 invoking them correctly. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 /* # include <curses.h> */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 /* # include <term.h> */
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
56 #ifdef __cplusplus
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
57 extern "C" {
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
58 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 extern int tgetent (CONST char *, CONST char *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 extern int tgetflag (CONST char *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 extern int tgetnum (CONST char *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 extern char *tgetstr (CONST char *, char **);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 extern void tputs (CONST char *, int, void (*)(int));
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
64 #ifdef __cplusplus
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
65 }
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
66 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 #define FORCE_CURSOR_UPDATE(c) send_string_to_tty_console (c, 0, 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 #define OUTPUTN(c, a, n) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 cmputc_console = c; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 FORCE_CURSOR_UPDATE (c); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 tputs (a, n, cmputc); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 #define OUTPUT1(c, a) OUTPUTN (c, a, 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 #define OUTPUTN_IF(c, a, n) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 cmputc_console = c; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 FORCE_CURSOR_UPDATE (c); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 if (a) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 tputs (a, n, cmputc); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 #define OUTPUT1_IF(c, a) OUTPUTN_IF (c, a, 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 static void tty_output_emchar_dynarr (struct window *w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 struct display_line *dl,
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
86 Emchar_dynarr *buf, int xpos,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 face_index findex,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 int cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 static void tty_output_bufbyte_string (struct window *w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 Bufbyte *str, Bytecount len,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 int xpos, face_index findex,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 int cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 static void tty_turn_on_face (struct window *w, face_index findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 static void tty_turn_off_face (struct window *w, face_index findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 static void tty_turn_on_frame_face (struct frame *f, Lisp_Object face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 static void tty_turn_off_frame_face (struct frame *f, Lisp_Object face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 static void term_get_fkeys (Lisp_Object keymap, char **address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 tty_text_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 tty's don't have fonts (that we use at least), so everything is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 considered to be fixed width. In other words, we just return len.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 tty_text_width (struct face_cachel *cachel, CONST Emchar *str,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 Charcount len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 return emchar_string_displayed_columns (str, len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 tty_divider_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 Return the width of the vertical divider. This is a function because
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 divider_width is a console method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 tty_divider_width (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 tty_divider_height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 Return the width of the horizontal divider. This is a function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 because divider_height is a console method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 tty_divider_height (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 tty_eol_cursor_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 Return the width of the end-of-line cursor. This is a function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 because eol_cursor_width is a console method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 tty_eol_cursor_width (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 tty_output_begin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 Perform any necessary initialization prior to an update.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 #ifdef DEBUG_XEMACS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 void tty_output_begin (struct device *d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 tty_output_begin (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 #ifndef HAVE_TERMIOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 /* Termcap requires `ospeed' to be a global variable so we have to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 always set it for whatever tty console we are actually currently
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 working with. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ospeed = DEVICE_TTY_DATA (d)->ospeed;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 tty_output_end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 Perform any necessary flushing of queues when an update has completed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 #ifdef DEBUG_XEMACS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 void tty_output_end (struct device *d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 tty_output_end (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 FORCE_CURSOR_UPDATE (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 Lstream_flush (XLSTREAM (CONSOLE_TTY_DATA (c)->outstream));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 tty_output_display_block
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 Given a display line, a block number for that start line, output all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 runes between start and end in the specified display block.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 tty_output_display_block (struct window *w, struct display_line *dl, int block,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 int start, int end, int start_pixpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 int cursor_start, int cursor_width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 int cursor_height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 struct frame *f = XFRAME (w->frame);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
203 Emchar_dynarr *buf = Dynarr_new (Emchar);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 rune_dynarr *rba = db->runes;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 struct rune *rb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 int elt = start;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 face_index findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 int xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 rb = Dynarr_atp (rba, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 if (!rb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 /* Nothing to do so don't do anything. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 findex = rb->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 if (end < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 end = Dynarr_length (rba);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 while (elt < end && Dynarr_atp (rba, elt)->xpos < start_pixpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 findex = Dynarr_atp (rba, elt)->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 xpos = Dynarr_atp (rba, elt)->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 while (elt < end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 rb = Dynarr_atp (rba, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 if (rb->findex == findex && rb->type == RUNE_CHAR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 && rb->object.chr.ch != '\n'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 && (rb->cursor_type != CURSOR_ON
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 || NILP (w->text_cursor_visible_p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 Dynarr_add (buf, rb->object.chr.ch);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 if (Dynarr_length (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 if (rb->type == RUNE_CHAR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 findex = rb->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 if (rb->object.chr.ch == '\n')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 /* Clear in case a cursor was formerly here. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 Dynarr_add (buf, ' ');
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 tty_output_emchar_dynarr (w, dl, buf, rb->xpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 DEFAULT_INDEX, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 cmgoto (f, dl->ypos - 1, rb->xpos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 else if (rb->cursor_type == CURSOR_ON)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 /* There is not a distinct eol cursor on tty's. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 Dynarr_add (buf, rb->object.chr.ch);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 cmgoto (f, dl->ypos - 1, xpos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 xpos += rb->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 /* #### RUNE_HLINE is actualy a little more complicated than this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 but at the moment it is only used to draw a turned off
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 modeline and this will suffice for that. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 Emchar ch_to_add;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 int size = rb->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 if (rb->type == RUNE_BLANK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 ch_to_add = ' ';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 ch_to_add = '-';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 while (size--)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 Dynarr_add (buf, ch_to_add);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 tty_output_emchar_dynarr (w, dl, buf, rb->xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 if (xpos >= cursor_start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 && cursor_start < xpos + Dynarr_length (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 cmgoto (f, dl->ypos - 1, cursor_start);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 Dynarr_reset (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 if (elt < end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 rb = Dynarr_atp (rba, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 findex = rb->findex;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 xpos = rb->xpos;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 else if (rb->type == RUNE_DGLYPH)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 Lisp_Object window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 Lisp_Object instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 XSETWINDOW (window, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 instance = glyph_image_instance (rb->object.dglyph.glyph,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 window, ERROR_ME_NOT, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 if (IMAGE_INSTANCEP (instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 switch (XIMAGE_INSTANCE_TYPE (instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 case IMAGE_TEXT:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 Bufbyte *temptemp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 Lisp_Object string =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 XIMAGE_INSTANCE_TEXT_STRING (instance);
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
342 Bytecount len = XSTRING_LENGTH (string);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 /* In the unlikely instance that a garbage-collect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 occurs during encoding, we at least need to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 copy the string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 temptemp = (Bufbyte *) alloca (len);
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
349 memcpy (temptemp, XSTRING_DATA (string), len);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 /* Now truncate the first rb->object.dglyph.xoffset
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 columns. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 for (i = 0; i < rb->object.dglyph.xoffset;)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 {
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
357 #ifdef MULE
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
358 Emchar ch = charptr_emchar (temptemp);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
359 i += XCHARSET_COLUMNS (CHAR_CHARSET (ch));
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
360 #else
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 i++; /* telescope this */
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 50
diff changeset
362 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 INC_CHARPTR (temptemp);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 /* If we truncated one column too many, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 add a space at the beginning. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 if (i > rb->object.dglyph.xoffset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 assert (i > 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 *--temptemp = ' ';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 i--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 len -= i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 tty_output_bufbyte_string (w, dl, temptemp, len,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 xpos, findex, 0);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
379
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 if (xpos >= cursor_start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 && (cursor_start <
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 xpos + (bufbyte_string_displayed_columns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (temptemp, len))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 cmgoto (f, dl->ypos - 1, cursor_start);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 case IMAGE_SUBWINDOW:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 /* just do nothing here */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 case IMAGE_NOTHING:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 /* nothing is as nothing does */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 xpos += rb->width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 if (Dynarr_length (buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 Dynarr_free (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 tty_output_vertical_divider
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 Draw a vertical divider down the left side of the given window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 tty_output_vertical_divider (struct window *w, int clear)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 int line;
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 122
diff changeset
434 int y_top = WINDOW_TEXT_TOP (w);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 122
diff changeset
435 int y_bot = WINDOW_TEXT_BOTTOM (w);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 unsigned char divv = '|';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 82
diff changeset
438 tty_turn_on_face (w, MODELINE_INDEX);
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 122
diff changeset
439 for (line = y_top; line < y_bot; line++)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 cmgoto (f, line, WINDOW_TEXT_LEFT (w) - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 send_string_to_tty_console (c, &divv, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 TTY_INC_CURSOR_X (c, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 /* Draw the divider in the modeline. */
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 122
diff changeset
447 cmgoto (f, y_bot, WINDOW_TEXT_LEFT (w) - 1);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 send_string_to_tty_console (c, &divv, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 TTY_INC_CURSOR_X (c, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 tty_turn_off_face (w, MODELINE_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 tty_clear_region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 Clear the area in the box defined by the given parameters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 tty_clear_region (Lisp_Object window, face_index findex, int x, int y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 int width, int height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 struct window *w = XWINDOW (window);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 int line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 if (!width || !height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 tty_turn_on_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 for (line = y; line < y + height; line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 int col;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 cmgoto (f, line, x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 if (window_is_leftmost (w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 && window_is_rightmost (w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 && TTY_SE (c).clr_to_eol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 unsigned char sp = ' ';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 /* #### Of course, this is all complete and utter crap. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 for (col = x; col < x + width; col++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 send_string_to_tty_console (c, &sp, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 TTY_INC_CURSOR_X (c, width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 tty_turn_off_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 cmgoto (f, y, x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 tty_clear_to_window_end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 Clear the area between ypos1 and ypos2. Each margin area and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 text area is handled separately since they may each have their own
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 background color.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 tty_clear_to_window_end (struct window *w, int ypos1, int ypos2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 int x, width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 x = WINDOW_TEXT_LEFT (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 width = WINDOW_TEXT_WIDTH (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 if (window_is_rightmost (w))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 /* #### Optimize to use clr_to_eol function of tty if available, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 the window is the entire width of the frame. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 /* #### Is this actually an optimization? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 int line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 tty_turn_on_face (w, DEFAULT_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 for (line = ypos1; line < ypos2; line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 cmgoto (XFRAME (w->frame), line, x);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 tty_turn_off_face (w, DEFAULT_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 Lisp_Object window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 XSETWINDOW (window, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 tty_clear_region (window, DEFAULT_INDEX, x, ypos1, width, ypos2 - ypos1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 tty_clear_frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 Clear the entire frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 tty_clear_frame (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 tty_turn_on_frame_face (f, Vdefault_face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 if (TTY_SE (c).clr_frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 OUTPUT1 (c, TTY_SE (c).clr_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 #ifdef NOT_SURE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 FRAME_CURSOR_X (f) = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 FRAME_CURSOR_Y (f) = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 #ifdef NOT_SURE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 internal_cursor_to (f, 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 clear_to_end (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 /* #### Not implemented. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 fprintf (stderr, "Not yet.\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 tty_turn_off_frame_face (f, Vdefault_face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 tty_output_bufbyte_string (struct window *w, struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 Bufbyte *str, Bytecount len, int xpos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 face_index findex, int cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 /* First position the cursor. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 cmgoto (f, dl->ypos - 1, xpos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 /* Enable any face properties. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 tty_turn_on_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 send_string_to_tty_console (c, str, len);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 TTY_INC_CURSOR_X (c, bufbyte_string_displayed_columns (str, len));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 /* Turn the face properties back off. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 tty_turn_off_face (w, findex);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
589 static Bufbyte_dynarr *tty_output_emchar_dynarr_dynarr;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 tty_output_emchar_dynarr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 Given a string and a starting position, output that string in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 given face. If cursor is true, draw a cursor around the string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 tty_output_emchar_dynarr (struct window *w, struct display_line *dl,
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
599 Emchar_dynarr *buf, int xpos, face_index findex,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 int cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 if (!tty_output_emchar_dynarr_dynarr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 tty_output_emchar_dynarr_dynarr = Dynarr_new (Bufbyte);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 Dynarr_reset (tty_output_emchar_dynarr_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 convert_emchar_string_into_bufbyte_dynarr (Dynarr_atp (buf, 0),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 Dynarr_length (buf),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 tty_output_emchar_dynarr_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 tty_output_bufbyte_string (w, dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 Dynarr_atp (tty_output_emchar_dynarr_dynarr, 0),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 Dynarr_length (tty_output_emchar_dynarr_dynarr),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 xpos, findex, cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
619 static Bufbyte_dynarr *sidcs_dynarr;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 substitute_in_dynamic_color_string (Lisp_Object spec, Lisp_Object string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 int i;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
625 Bufbyte *specdata = XSTRING_DATA (spec);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
626 Bytecount speclen = XSTRING_LENGTH (spec);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 if (!sidcs_dynarr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 sidcs_dynarr = Dynarr_new (Bufbyte);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 Dynarr_reset (sidcs_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 for (i = 0; i < speclen; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 if (specdata[i] == '%' && specdata[i+1] == '%')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 Dynarr_add (sidcs_dynarr, '%');
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 i++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 else if (specdata[i] == '%' && specdata[i+1] == 's')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 {
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
642 Dynarr_add_many (sidcs_dynarr,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
643 XSTRING_DATA (string),
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
644 XSTRING_LENGTH (string));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 i++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 Dynarr_add (sidcs_dynarr, specdata[i]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 set_foreground_to (struct console *c, Lisp_Object sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 Lisp_Object result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 Bufbyte *escseq = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 Bytecount escseqlen = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 result = assq_no_quit (sym, Vtty_color_alist);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 if (!NILP (result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 Lisp_Object esc_seq = XCAR (XCDR (result));
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
665 escseq = XSTRING_DATA (esc_seq);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
666 escseqlen = XSTRING_LENGTH (esc_seq);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 else if (STRINGP (Vtty_dynamic_color_fg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 substitute_in_dynamic_color_string (Vtty_dynamic_color_fg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 Fsymbol_name (sym));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 escseq = Dynarr_atp (sidcs_dynarr, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 escseqlen = Dynarr_length (sidcs_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 if (escseq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 send_string_to_tty_console (c, escseq, escseqlen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 set_background_to (struct console *c, Lisp_Object sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 Lisp_Object result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 Bufbyte *escseq = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 Bytecount escseqlen = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 result = assq_no_quit (sym, Vtty_color_alist);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 if (!NILP (result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 Lisp_Object esc_seq = XCDR (XCDR (result));
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
695 escseq = XSTRING_DATA (esc_seq);
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
696 escseqlen = XSTRING_LENGTH (esc_seq);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 else if (STRINGP (Vtty_dynamic_color_bg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 substitute_in_dynamic_color_string (Vtty_dynamic_color_bg,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 Fsymbol_name (sym));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 escseq = Dynarr_atp (sidcs_dynarr, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 escseqlen = Dynarr_length (sidcs_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 if (escseq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 send_string_to_tty_console (c, escseq, escseqlen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 tty_turn_on_face_1 (struct console *c, int highlight_p,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 int blinking_p, int dim_p, int underline_p,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 int reverse_p, Lisp_Object cinst_fore,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 Lisp_Object cinst_back)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 if (highlight_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 OUTPUT1_IF (c, TTY_SD (c).turn_on_bold);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 if (blinking_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 OUTPUT1_IF (c, TTY_SD (c).turn_on_blinking);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 if (dim_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 OUTPUT1_IF (c, TTY_SD (c).turn_on_dim);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 if (underline_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 /* #### punt for now if underline mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 if (!TTY_FLAGS (c).underline_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 OUTPUT1_IF (c, TTY_SD (c).begin_underline);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 if (reverse_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 /* #### punt for now if standout mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 if (!TTY_FLAGS (c).standout_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 OUTPUT1_IF (c, TTY_SD (c).begin_standout);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 reverse_p = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 if (reverse_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 Lisp_Object temp = cinst_fore;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 cinst_fore = cinst_back;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 cinst_back = temp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 if (COLOR_INSTANCEP (cinst_fore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 && !EQ (cinst_fore, Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 set_foreground_to (c, COLOR_INSTANCE_TTY_SYMBOL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (XCOLOR_INSTANCE (cinst_fore)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 if (COLOR_INSTANCEP (cinst_back)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 && !EQ (cinst_back, Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 set_background_to (c, COLOR_INSTANCE_TTY_SYMBOL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 (XCOLOR_INSTANCE (cinst_back)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 tty_turn_on_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 Turn on all set properties of the given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 tty_turn_on_face (struct window *w, face_index findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
784 tty_turn_on_face_1 (c,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 WINDOW_FACE_CACHEL_HIGHLIGHT_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 WINDOW_FACE_CACHEL_BLINKING_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 WINDOW_FACE_CACHEL_DIM_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 WINDOW_FACE_CACHEL_UNDERLINE_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 WINDOW_FACE_CACHEL_REVERSE_P (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 WINDOW_FACE_CACHEL_FOREGROUND (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 WINDOW_FACE_CACHEL_BACKGROUND (w, findex));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 tty_turn_off_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 Turn off all set properties of the given face (revert to default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 face). We assume that tty_turn_on_face has been called for the given
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 face so that it's properties are actually active.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 tty_turn_off_face (struct window *w, face_index findex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 struct frame *f = XFRAME (w->frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 if (WINDOW_FACE_CACHEL_REVERSE_P (w, findex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 /* #### punt for now if standout mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 if (!TTY_FLAGS (c).standout_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 OUTPUT1_IF (c, TTY_SD (c).end_standout);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 if (WINDOW_FACE_CACHEL_UNDERLINE_P (w, findex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 /* #### punt for now if underline mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 if (!TTY_FLAGS (c).underline_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 OUTPUT1_IF (c, TTY_SD (c).end_underline);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 if (WINDOW_FACE_CACHEL_HIGHLIGHT_P (w, findex) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 WINDOW_FACE_CACHEL_BLINKING_P (w, findex) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 WINDOW_FACE_CACHEL_DIM_P (w, findex) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 !EQ (WINDOW_FACE_CACHEL_FOREGROUND (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 Vthe_null_color_instance) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 !EQ (WINDOW_FACE_CACHEL_BACKGROUND (w, findex),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 OUTPUT1_IF (c, TTY_SD (c).turn_off_attributes);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 tty_turn_on_frame_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 Turn on all set properties of the given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 tty_turn_on_frame_face (struct frame *f, Lisp_Object face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 Lisp_Object frame = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
847
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 XSETFRAME (frame, f);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
849 tty_turn_on_face_1 (c,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 FACE_HIGHLIGHT_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 FACE_BLINKING_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 FACE_DIM_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 FACE_UNDERLINE_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 FACE_REVERSE_P (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 FACE_FOREGROUND (face, frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 FACE_BACKGROUND (face, frame));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 tty_turn_off_frame_face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 Turn off all set properties of the given face (revert to default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 face). We assume that tty_turn_on_face has been called for the given
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 face so that it's properties are actually active.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 tty_turn_off_frame_face (struct frame *f, Lisp_Object face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 Lisp_Object frame = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 XSETFRAME (frame, f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 if (FACE_REVERSE_P (face, frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 /* #### punt for now if standout mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 if (!TTY_FLAGS (c).standout_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 OUTPUT1_IF (c, TTY_SD (c).end_standout);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 if (FACE_UNDERLINE_P (face, frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 /* #### punt for now if underline mode is glitchy */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 if (!TTY_FLAGS (c).underline_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 OUTPUT1_IF (c, TTY_SD (c).end_underline);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 if (FACE_HIGHLIGHT_P (face, frame) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 FACE_BLINKING_P (face, frame) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 FACE_DIM_P (face, frame) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 !EQ (FACE_FOREGROUND (face, frame), Vthe_null_color_instance) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 !EQ (FACE_BACKGROUND (face, frame), Vthe_null_color_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 OUTPUT1_IF (c, TTY_SD (c).turn_off_attributes);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 set_tty_modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 Sets up various parameters on tty modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 set_tty_modes (struct console *c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 if (!CONSOLE_TTY_P (c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 OUTPUT1_IF (c, TTY_SD (c).init_motion);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 OUTPUT1_IF (c, TTY_SD (c).cursor_visible);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 OUTPUT1_IF (c, TTY_SD (c).keypad_on);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 reset_tty_modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 Restore default state of tty.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 reset_tty_modes (struct console *c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 if (!CONSOLE_TTY_P (c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 82
diff changeset
929 OUTPUT1_IF (c, TTY_SD (c).orig_pair);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 OUTPUT1_IF (c, TTY_SD (c).keypad_off);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 OUTPUT1_IF (c, TTY_SD (c).cursor_normal);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 OUTPUT1_IF (c, TTY_SD (c).end_motion);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 tty_output_end (XDEVICE (CONSOLE_SELECTED_DEVICE (c)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 tty_redisplay_shutdown
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 Clear the frame and position the cursor properly for exiting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 tty_redisplay_shutdown (struct console *c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 Lisp_Object dev = CONSOLE_SELECTED_DEVICE (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 if (!GC_NILP (dev))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 Lisp_Object frm = DEVICE_SELECTED_FRAME (XDEVICE (dev));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 if (!GC_NILP (frm))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 struct frame *f = XFRAME (frm);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 /* Clear the bottom line of the frame. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 tty_clear_region (FRAME_SELECTED_WINDOW (f), DEFAULT_INDEX, 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 f->height, f->width, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 /* And then stick the cursor there. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 cmgoto (f, f->height, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 tty_output_end (XDEVICE (dev));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 /* #### Everything below here is old shit. It should either be moved
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 up or removed. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 /* FLAGS - these don't need to be console local since only one console
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 can be being updated at a time. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 static int insert_mode_on; /* nonzero if in insert mode */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 static int standout_mode_on; /* nonzero if in standout mode */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 static int underline_mode_on; /* nonzero if in underline mode */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 static int alternate_mode_on; /* nonzero if in alternate char set */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 static int attributes_on; /* nonzero if any attributes on */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 #ifdef NOT_YET
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 turn_on_insert (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 if (!insert_mode_on)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 OUTPUT1_IF (c, TTY_SE (c).begin_ins_mode);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 insert_mode_on = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 turn_off_insert (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 if (insert_mode_on)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 OUTPUT1 (c, TTY_SE (c).end_ins_mode);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 insert_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 internal_cursor_to (struct frame *f, int row, int col)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 if (!TTY_FLAGS (c).insert_mode_motion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 turn_off_insert (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 if (!TTY_FLAGS (c).standout_motion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 turn_off_standout (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 turn_off_underline (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 turn_off_alternate (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 cmgoto (f, row, col);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 clear_to_end (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 /* assumes cursor is already positioned */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 if (TTY_SE (c).clr_from_cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 OUTPUT1 (c, TTY_SE (c).clr_from_cursor);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 int line = FRAME_CURSOR_Y (f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 while (line < FRAME_HEIGHT (f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 internal_cursor_to (f, line, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 #endif /* 0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 * clear from last visible line on window to window end (presumably
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 * the line above window's modeline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 tty_clear_window_end (struct window *w, int ystart, int yend)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 struct console *c = XCONSOLE (WINDOW_CONSOLE (w));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 int line;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 for (line = ystart; line < yend; line++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 cmgoto (XFRAME (w->frame), line, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 OUTPUT1 (c, TTY_SE (c).clr_to_eol);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 #endif /* 0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 tty_flash (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 if (TTY_SD (c).visual_bell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 OUTPUT1 (c, TTY_SD (c).visual_bell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 Lstream_flush (XLSTREAM (CONSOLE_TTY_DATA (c)->outstream));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 * tty_ring_bell - sound an audio beep.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 tty_ring_bell (struct device *d, int volume, int pitch, int duration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1081 if (volume)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1082 {
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1083 OUTPUT1 (c, TTY_SD (c).audio_bell);
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1084 Lstream_flush (XLSTREAM (CONSOLE_TTY_DATA (c)->outstream));
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 74
diff changeset
1085 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 init_tty_for_redisplay (struct device *d, char *terminal_type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 int status;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 char entry_buffer[2044];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 /* char temp_buffer[2044]; */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 char *bufptr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 /* What we should really do is allocate just enough space for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 the actual strings that are stored; but this would require
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 doing this after all the tgetstr()s and adjusting all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 pointers. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 CONSOLE_TTY_DATA (c)->term_entry_buffer = (char *) xmalloc (2044);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1103 bufptr = CONSOLE_TTY_DATA (c)->term_entry_buffer;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 193
diff changeset
1105 #if !defined(WIN32)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 193
diff changeset
1106 /* SIGTT* don't exist under win32 */
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1107 EMACS_BLOCK_SIGNAL (SIGTTOU);
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 193
diff changeset
1108 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 status = tgetent (entry_buffer, terminal_type);
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 193
diff changeset
1110 #if !defined(WIN32)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1111 EMACS_UNBLOCK_SIGNAL (SIGTTOU);
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 193
diff changeset
1112 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 if (status < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 return TTY_UNABLE_OPEN_DATABASE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 else if (status == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 return TTY_TYPE_UNDEFINED;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 /* Under Linux at least, <0 is returned for TTY_TYPE_UNDEFINED. --ben */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 if (status <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 return TTY_TYPE_UNDEFINED;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 * Establish the terminal size.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 /* First try to get the info from the system. If that fails, check
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 the termcap entry. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 get_tty_device_size (d, &CONSOLE_TTY_DATA (c)->width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 &CONSOLE_TTY_DATA (c)->height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 if (CONSOLE_TTY_DATA (c)->width <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 CONSOLE_TTY_DATA (c)->width = tgetnum ("co");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 if (CONSOLE_TTY_DATA (c)->height <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 CONSOLE_TTY_DATA (c)->height = tgetnum ("li");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 if (CONSOLE_TTY_DATA (c)->width <= 0 || CONSOLE_TTY_DATA (c)->height <= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 return TTY_SIZE_UNSPECIFIED;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 * Initialize cursor motion information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 /* local cursor movement */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 TTY_CM (c).up = tgetstr ("up", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 TTY_CM (c).down = tgetstr ("do", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 TTY_CM (c).left = tgetstr ("le", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 TTY_CM (c).right = tgetstr ("nd", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 TTY_CM (c).home = tgetstr ("ho", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 TTY_CM (c).low_left = tgetstr ("ll", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 TTY_CM (c).car_return = tgetstr ("cr", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 /* absolute cursor motion */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 TTY_CM (c).abs = tgetstr ("cm", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 TTY_CM (c).hor_abs = tgetstr ("ch", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 TTY_CM (c).ver_abs = tgetstr ("cv", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 /* Verify that the terminal is powerful enough to run Emacs */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 if (!TTY_CM (c).abs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 if (!TTY_CM (c).up || !TTY_CM (c).down
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 || !TTY_CM (c).left || !TTY_CM (c).right)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 return TTY_TYPE_INSUFFICIENT;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 /* parameterized local cursor movement */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 TTY_CM (c).multi_up = tgetstr ("UP", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 TTY_CM (c).multi_down = tgetstr ("DO", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 TTY_CM (c).multi_left = tgetstr ("LE", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 TTY_CM (c).multi_right = tgetstr ("RI", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 /* scrolling */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 TTY_CM (c).scroll_forw = tgetstr ("sf", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 TTY_CM (c).scroll_back = tgetstr ("sr", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 TTY_CM (c).multi_scroll_forw = tgetstr ("SF", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 TTY_CM (c).multi_scroll_back = tgetstr ("SR", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 TTY_CM (c).set_scroll_region = tgetstr ("cs", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 * Initialize screen editing information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 /* adding to the screen */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 TTY_SE (c).ins_line = tgetstr ("al", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 TTY_SE (c).multi_ins_line = tgetstr ("AL", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 TTY_SE (c).repeat = tgetstr ("rp", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 TTY_SE (c).begin_ins_mode = tgetstr ("im", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 TTY_SE (c).end_ins_mode = tgetstr ("ei", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 TTY_SE (c).ins_char = tgetstr ("ic", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 TTY_SE (c).multi_ins_char = tgetstr ("IC", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 TTY_SE (c).insert_pad = tgetstr ("ip", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 /* deleting from the screen */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 TTY_SE (c).clr_frame = tgetstr ("cl", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 TTY_SE (c).clr_from_cursor = tgetstr ("cd", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 TTY_SE (c).clr_to_eol = tgetstr ("ce", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 TTY_SE (c).del_line = tgetstr ("dl", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 TTY_SE (c).multi_del_line = tgetstr ("DL", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 TTY_SE (c).del_char = tgetstr ("dc", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 TTY_SE (c).multi_del_char = tgetstr ("DC", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 TTY_SE (c).begin_del_mode = tgetstr ("dm", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 TTY_SE (c).end_del_mode = tgetstr ("ed", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 TTY_SE (c).erase_at_cursor = tgetstr ("ec", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 * Initialize screen display information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 TTY_SD (c).begin_standout = tgetstr ("so", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 TTY_SD (c).end_standout = tgetstr ("se", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 TTY_SD (c).begin_underline = tgetstr ("us", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 TTY_SD (c).end_underline = tgetstr ("ue", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 TTY_SD (c).begin_alternate = tgetstr ("as", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 TTY_SD (c).end_alternate = tgetstr ("ae", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 TTY_SD (c).turn_on_reverse = tgetstr ("mr", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 TTY_SD (c).turn_on_blinking = tgetstr ("mb", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 TTY_SD (c).turn_on_bold = tgetstr ("md", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 TTY_SD (c).turn_on_dim = tgetstr ("mh", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 TTY_SD (c).turn_off_attributes = tgetstr ("me", &bufptr);
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 82
diff changeset
1220 TTY_SD (c).orig_pair = tgetstr ("op", &bufptr);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 TTY_SD (c).visual_bell = tgetstr ("vb", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 TTY_SD (c).audio_bell = tgetstr ("bl", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 if (!TTY_SD (c).audio_bell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 /* If audio_bell doesn't get set, then assume C-g. This is gross and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 ugly but is what Emacs has done from time immortal. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 TTY_SD (c).audio_bell = "\07";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 TTY_SD (c).cursor_visible = tgetstr ("ve", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 TTY_SD (c).cursor_normal = tgetstr ("vs", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 TTY_SD (c).init_motion = tgetstr ("ti", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 TTY_SD (c).end_motion = tgetstr ("te", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 TTY_SD (c).keypad_on = tgetstr ("ks", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 TTY_SD (c).keypad_off = tgetstr ("ke", &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 * Initialize additional terminal information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 TTY_FLAGS (c).must_write_spaces = tgetflag ("in");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 TTY_FLAGS (c).insert_mode_motion = tgetflag ("mi");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 TTY_FLAGS (c).standout_motion = tgetflag ("ms");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 TTY_FLAGS (c).memory_above_frame = tgetflag ("da");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 TTY_FLAGS (c).memory_below_frame = tgetflag ("db");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 TTY_FLAGS (c).standout_width = tgetnum ("sg");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 TTY_FLAGS (c).underline_width = tgetnum ("ug");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 if (TTY_FLAGS (c).standout_width == -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 TTY_FLAGS (c).standout_width = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 if (TTY_FLAGS (c).underline_width == -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 TTY_FLAGS (c).underline_width = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1255 TTY_FLAGS (c).meta_key =
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 eight_bit_tty (d) ? tgetflag ("km") || tgetflag ("MT") ? 1 : 2 : 0;
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1257
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1258
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 * Setup the costs tables for this tty console.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 cm_cost_init (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 * Initialize local flags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 insert_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 standout_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 underline_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 alternate_mode_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 attributes_on = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 * Attempt to initialise the function_key_map to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 * some kind of sensible value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 term_get_fkeys (c->function_key_map, &bufptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 /* check for ANSI set-foreground and set-background strings,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 and assume color if so.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 #### we should support the other (non-ANSI) ways of specifying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 color, too. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 char foobuf[500];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 char *fooptr = foobuf;
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1288 if ((tgetstr ("AB", &fooptr) && tgetstr ("AF", &fooptr)) ||
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1289 (tgetstr ("Sf", &fooptr) && tgetstr ("Sb", &fooptr)) ||
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1290 ((tgetnum ("Co") > 0) && (tgetnum ("pa") > 0)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 DEVICE_CLASS (d) = Qcolor;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 DEVICE_CLASS (d) = Qmono;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 return TTY_INIT_SUCCESS;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 struct fkey_table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 CONST char *cap, *name;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 /* Termcap capability names that correspond directly to X keysyms.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 Some of these (marked "terminfo") aren't supplied by old-style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 (Berkeley) termcap entries. They're listed in X keysym order;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 except we put the keypad keys first, so that if they clash with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 other keys (as on the IBM PC keyboard) they get overridden.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 static struct fkey_table keys[] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 {"kh", "home"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 {"kl", "left"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 {"ku", "up"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 {"kr", "right"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 {"kd", "down"}, /* termcap */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 {"%8", "prior"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 {"%5", "next"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 {"@7", "end"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 {"@1", "begin"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 {"*6", "select"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 {"%9", "print"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 {"@4", "execute"}, /* terminfo --- actually the `command' key */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 * "insert" --- see below
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 {"&8", "undo"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 {"%0", "redo"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 {"%7", "menu"}, /* terminfo --- actually the `options' key */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 {"@0", "find"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 {"@2", "cancel"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 {"%1", "help"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 * "break" goes here, but can't be reliably intercepted with termcap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 {"&4", "reset"}, /* terminfo --- actually `restart' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 * "system" and "user" --- no termcaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 {"kE", "clearline"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 {"kA", "insertline"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 {"kL", "deleteline"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 {"kI", "insertchar"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 {"kD", "delete"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 {"kB", "backtab"}, /* terminfo */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1348 * "kp-backtab", "kp-space", "kp-tab" --- no termcaps
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1350 {"@8", "kp-enter"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1352 * "kp-f1", "kp-f2", "kp-f3" "kp-f4",
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1353 * "kp-multiply", "kp-add", "kp-separator",
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1354 * "kp-subtract", "kp-decimal", "kp-divide", "kp-0";
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 * --- no termcaps for any of these.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1357 {"K4", "kp-1"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1359 * "kp-2" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1361 {"K5", "kp-3"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1363 * "kp-4" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1365 {"K2", "kp-5"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1367 * "kp-6" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1369 {"K1", "kp-7"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1371 * "kp-8" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 */
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1373 {"K3", "kp-9"}, /* terminfo */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 /*
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1375 * "kp-equal" --- no termcap
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 {"k1", "f1"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 {"k2", "f2"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 {"k3", "f3"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 {"k4", "f4"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 {"k5", "f5"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 {"k6", "f6"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 {"k7", "f7"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 {"k8", "f8"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 {"k9", "f9"},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 static char **term_get_fkeys_arg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 static Lisp_Object term_get_fkeys_1 (Lisp_Object keymap);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 static Lisp_Object term_get_fkeys_error (Lisp_Object err, Lisp_Object arg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 /* Find the escape codes sent by the function keys for Vfunction_key_map.
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1394 This function scans the termcap function key sequence entries, and
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 adds entries to Vfunction_key_map for each function key it finds. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 term_get_fkeys (Lisp_Object keymap, char **address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 /* We run the body of the function (term_get_fkeys_1) and ignore all Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 errors during the call. The only errors should be from Fdefine_key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 when given a key sequence containing an invalid prefix key. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 termcap defines function keys which use a prefix that is already bound
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 to a command by the default bindings, we should silently ignore that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 function key specification, rather than giving the user an error and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 refusing to run at all on such a terminal. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 term_get_fkeys_arg = address;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 condition_case_1 (Qerror,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 term_get_fkeys_1, keymap,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 term_get_fkeys_error, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 term_get_fkeys_error (Lisp_Object err, Lisp_Object arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 return arg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 term_get_fkeys_1 (Lisp_Object function_key_map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 char **address = term_get_fkeys_arg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 185
diff changeset
1428 for (i = 0; i < countof (keys); i++)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 char *sequence = tgetstr (keys[i].cap, address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 if (sequence)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 Fdefine_key (function_key_map,
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 185
diff changeset
1433 build_ext_string (sequence, FORMAT_BINARY),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 vector1 (intern (keys[i].name)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 /* The uses of the "k0" capability are inconsistent; sometimes it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 describes F10, whereas othertimes it describes F0 and "k;" describes F10.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 We will attempt to politely accommodate both systems by testing for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 char *k_semi = tgetstr ("k;", address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 char *k0 = tgetstr ("k0", address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 CONST char *k0_name = "f10";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 if (k_semi)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 {
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 185
diff changeset
1449 Fdefine_key (function_key_map, build_ext_string (k_semi, FORMAT_BINARY),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 vector1 (intern ("f10")));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 k0_name = "f0";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 if (k0)
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 185
diff changeset
1455 Fdefine_key (function_key_map, build_ext_string (k0, FORMAT_BINARY),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 vector1 (intern (k0_name)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 /* Set up cookies for numbered function keys above f10. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 char fcap[3], fkey[4];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 fcap[0] = 'F'; fcap[2] = '\0';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 for (i = 11; i < 64; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 if (i <= 19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 fcap[1] = '1' + i - 11;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 else if (i <= 45)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 fcap[1] = 'A' + i - 20;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 fcap[1] = 'a' + i - 46;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 char *sequence = tgetstr (fcap, address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 if (sequence)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 sprintf (fkey, "f%d", i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 Fdefine_key (function_key_map,
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 185
diff changeset
1479 build_ext_string (sequence, FORMAT_BINARY),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 vector1 (intern (fkey)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 * Various mappings to try and get a better fit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 #define CONDITIONAL_REASSIGN(cap1, cap2, sym) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 if (!tgetstr (cap1, address)) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 char *sequence = tgetstr (cap2, address); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 if (sequence) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 Fdefine_key (function_key_map, \
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 185
diff changeset
1496 build_ext_string (sequence, FORMAT_BINARY), \
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 vector1 (intern (sym))); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 }
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 169
diff changeset
1499
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 /* if there's no key_next keycap, map key_npage to `next' keysym */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 CONDITIONAL_REASSIGN ("%5", "kN", "next");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 /* if there's no key_prev keycap, map key_ppage to `previous' keysym */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 CONDITIONAL_REASSIGN ("%8", "kP", "prior");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 /* if there's no key_dc keycap, map key_ic to `insert' keysym */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 CONDITIONAL_REASSIGN ("kD", "kI", "insert");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 /* IBM has their own non-standard dialect of terminfo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 If the standard name isn't found, try the IBM name. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 CONDITIONAL_REASSIGN ("kB", "KO", "backtab");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 CONDITIONAL_REASSIGN ("@4", "kJ", "execute"); /* actually "action" */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 CONDITIONAL_REASSIGN ("@4", "kc", "execute"); /* actually "command" */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 CONDITIONAL_REASSIGN ("%7", "ki", "menu");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 CONDITIONAL_REASSIGN ("@7", "kw", "end");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 CONDITIONAL_REASSIGN ("F1", "k<", "f11");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 CONDITIONAL_REASSIGN ("F2", "k>", "f12");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 CONDITIONAL_REASSIGN ("%1", "kq", "help");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 CONDITIONAL_REASSIGN ("*6", "kU", "select");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 #undef CONDITIONAL_REASSIGN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 /* initialization */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 console_type_create_redisplay_tty (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 /* redisplay methods */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 CONSOLE_HAS_METHOD (tty, text_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 CONSOLE_HAS_METHOD (tty, output_display_block);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 CONSOLE_HAS_METHOD (tty, output_vertical_divider);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 CONSOLE_HAS_METHOD (tty, divider_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 CONSOLE_HAS_METHOD (tty, divider_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 CONSOLE_HAS_METHOD (tty, eol_cursor_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 CONSOLE_HAS_METHOD (tty, clear_to_window_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540 CONSOLE_HAS_METHOD (tty, clear_region);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 CONSOLE_HAS_METHOD (tty, clear_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 CONSOLE_HAS_METHOD (tty, output_begin);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 CONSOLE_HAS_METHOD (tty, output_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 CONSOLE_HAS_METHOD (tty, flash);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 CONSOLE_HAS_METHOD (tty, ring_bell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546 }