Deleted Added
full compact
1/* display.c -- How to display Info windows.
2 $Id: display.c,v 1.6 1997/07/24 21:13:27 karl Exp $
3
4 Copyright (C) 1993, 97 Free Software Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10

--- 87 unchanged lines hidden (view full) ---

98 WINDOW *win;
99{
100 register char *nodetext; /* Current character to display. */
101 register char *last_node_char; /* Position of the last character in node. */
102 register int i; /* General use index. */
103 char *printed_line; /* Buffer for a printed line. */
104 int pl_index = 0; /* Index into PRINTED_LINE. */
105 int line_index = 0; /* Number of lines done so far. */
106 DISPLAY_LINE **display = the_display;
107
108 /* If display is inhibited, that counts as an interrupted display. */
109 if (display_inhibited)
110 display_was_interrupted_p = 1;
111
112 /* If the window has no height, or display is inhibited, quit now. */
113 if (!win->height || display_inhibited)

--- 4 unchanged lines hidden (view full) ---

118 window to be displayed, and the screen has shrunk to less than one
119 line. */
120 if ((win->first_row < 0) || (win->first_row > the_screen->height))
121 return;
122
123 /* Print each line in the window into our local buffer, and then
124 check the contents of that buffer against the display. If they
125 differ, update the display. */
126 printed_line = (char *)xmalloc (1 + win->width);
127
128 if (!win->node || !win->line_starts)
129 goto done_with_node_display;
130
131 nodetext = win->line_starts[win->pagetop];
132 last_node_char = win->node->contents + win->node->nodelen;
133
134 for (; nodetext < last_node_char; nodetext++)

--- 7 unchanged lines hidden (view full) ---

142 replen = 1;
143 rep_temp[1] = '\0';
144 rep = rep_temp;
145 }
146 else
147 {
148 if (*nodetext == '\r' || *nodetext == '\n')
149 {
150 replen = win->width - pl_index;
151 }
152 else
153 {
154 rep = printed_representation (*nodetext, pl_index);
155 replen = strlen (rep);
156 }
157 }
158
159 /* If this character can be printed without passing the width of
160 the line, then stuff it into the line. */
161 if (replen + pl_index < win->width)
162 {
163 /* Optimize if possible. */
164 if (replen == 1)
165 {
166 printed_line[pl_index++] = *rep;
167 }
168 else
169 {

--- 14 unchanged lines hidden (view full) ---

184 rep_carried_over = (char *)NULL;
185 }
186 else
187 {
188 /* The printed representation of this character extends into
189 the next line. Remember the offset of the last character
190 printed out of REP so that we can carry the character over
191 to the next line. */
192 for (i = 0; pl_index < (win->width - 1);)
193 printed_line[pl_index++] = rep[i++];
194
195 rep_carried_over = rep + i;
196
197 /* If printing the last character in this window couldn't
198 possibly cause the screen to scroll, place a backslash
199 in the rightmost column. */
200 if (1 + line_index + win->first_row < the_screen->height)

--- 8 unchanged lines hidden (view full) ---

209
210 /* We have the exact line as it should appear on the screen.
211 Check to see if this line matches the one already appearing
212 on the screen. */
213 entry = display[line_index + win->first_row];
214
215 /* If the screen line is inversed, then we have to clear
216 the line from the screen first. Why, I don't know. */
217 if (entry->inverse)
218 {
219 terminal_goto_xy (0, line_index + win->first_row);
220 terminal_clear_to_eol ();
221 entry->inverse = 0;
222 entry->text[0] = '\0';
223 entry->textlen = 0;
224 }
225

--- 11 unchanged lines hidden (view full) ---

237
238 /* If there is any text to print, print it. */
239 if (i != pl_index)
240 terminal_put_text (printed_line + i);
241
242 /* If the printed text didn't extend all the way to the edge
243 of the window, and text was appearing between here and the
244 edge of the window, clear from here to the end of the line. */
245 if ((pl_index < win->width && pl_index < entry->textlen) ||
246 (entry->inverse))
247 terminal_clear_to_eol ();
248
249 fflush (stdout);
250
251 /* Update the display text buffer. */
252 strcpy (entry->text + i, printed_line + i);
253 entry->textlen = pl_index;
254
255 /* Lines showing node text are not in inverse. Only modelines
256 have that distinction. */
257 entry->inverse = 0;
258 }
259

--- 9 unchanged lines hidden (view full) ---

269 {
270 free (printed_line);
271 display_was_interrupted_p = 1;
272 return;
273 }
274
275 /* Reset PL_INDEX to the start of the line. */
276 pl_index = 0;
277
278 /* If there are characters from REP left to print, stuff them
279 into the buffer now. */
280 if (rep_carried_over)
281 for (; rep[pl_index]; pl_index++)
282 printed_line[pl_index] = rep[pl_index];
283
284 /* If this window has chosen not to wrap lines, skip to the end

--- 273 unchanged lines hidden ---