annotate src/redisplay-tty.c @ 298:70ad99077275 r21-0b47

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