Deleted Added
full compact
1/* $FreeBSD: head/contrib/libreadline/display.c 75409 2001-04-11 03:15:56Z ache $ */
2/* display.c -- readline redisplay facility. */
3
4/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
5
6 This file is part of the GNU Readline Library, a library for
7 reading lines of text with interactive input and history editing.
8
9 The GNU Readline Library is free software; you can redistribute it

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

39#else
40# include "ansi_stdlib.h"
41#endif /* HAVE_STDLIB_H */
42
43#include <stdio.h>
44
45/* System-specific feature definitions and include files. */
46#include "rldefs.h"
47
48/* Termcap library stuff. */
49#include "tcap.h"
50
51/* Some standard library routines. */
52#include "readline.h"
53#include "history.h"
54
55#include "rlprivate.h"
56#include "xmalloc.h"
57
58#if !defined (strchr) && !defined (__STDC__)
59extern char *strchr (), *strrchr ();
60#endif /* !strchr && !__STDC__ */
61
62#if defined (HACK_TERMCAP_MOTION)
63extern char *_rl_term_forward_char;
64#endif
65
66static void update_line __P((char *, char *, int, int, int, int));
67static void space_to_eol __P((int));
68static void delete_chars __P((int));
69static void insert_some_chars __P((char *, int));
70static void cr __P((void));
71
72static int *inv_lbreaks, *vis_lbreaks;
73static int inv_lbsize, vis_lbsize;
74
75/* Heuristic used to decide whether it is faster to move from CUR to NEW
76 by backing up or outputting a carriage return and moving forward. */
77#define CR_FASTER(new, cur) (((new) + 1) < ((cur) - (new)))
78
79/* **************************************************************** */

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

198 {
199 r = savestring (pmt);
200 if (lp)
201 *lp = strlen (r);
202 return r;
203 }
204
205 l = strlen (pmt);
206 r = ret = xmalloc (l + 1);
207
208 invfl = 0; /* invisible chars in first line of prompt */
209
210 for (rl = ignoring = last = ninvis = 0, p = pmt; p && *p; p++)
211 {
212 /* This code strips the invisible character string markers
213 RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE */
214 if (*p == RL_PROMPT_START_IGNORE)

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

331 int minsize;
332{
333 register int n;
334
335 if (invisible_line == 0) /* initialize it */
336 {
337 if (line_size < minsize)
338 line_size = minsize;
339 visible_line = xmalloc (line_size);
340 invisible_line = xmalloc (line_size);
341 }
342 else if (line_size < minsize) /* ensure it can hold MINSIZE chars */
343 {
344 line_size *= 2;
345 if (line_size < minsize)
346 line_size = minsize;
347 visible_line = xrealloc (visible_line, line_size);
348 invisible_line = xrealloc (invisible_line, line_size);
349 }
350
351 for (n = minsize; n < line_size; n++)
352 {
353 visible_line[n] = 0;
354 invisible_line[n] = 1;
355 }
356
357 if (vis_lbreaks == 0)
358 {
359 /* should be enough. */
360 inv_lbsize = vis_lbsize = 256;
361 inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
362 vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
363 inv_lbreaks[0] = vis_lbreaks[0] = 0;
364 }
365}
366
367/* Basic redisplay algorithm. */
368void
369rl_redisplay ()
370{
371 register int in, out, c, linenum, cursor_linenum;
372 register char *line;
373 int c_pos, inv_botlin, lb_botlin, lb_linenum;
374 int newlines, lpos, temp;
375 char *prompt_this_line;
376
377 if (!readline_echoing_p)
378 return;
379
380 if (!rl_display_prompt)
381 rl_display_prompt = "";
382
383 if (invisible_line == 0)

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

417 _rl_output_some_chars (local_prompt_prefix, strlen (local_prompt_prefix));
418
419 if (local_len > 0)
420 {
421 temp = local_len + out + 2;
422 if (temp >= line_size)
423 {
424 line_size = (temp + 1024) - (temp % 1024);
425 visible_line = xrealloc (visible_line, line_size);
426 line = invisible_line = xrealloc (invisible_line, line_size);
427 }
428 strncpy (line + out, local_prompt, local_len);
429 out += local_len;
430 }
431 line[out] = '\0';
432 wrap_offset = local_len - prompt_visible_length;
433 }
434 else

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

451 }
452 }
453
454 pmtlen = strlen (prompt_this_line);
455 temp = pmtlen + out + 2;
456 if (temp >= line_size)
457 {
458 line_size = (temp + 1024) - (temp % 1024);
459 visible_line = xrealloc (visible_line, line_size);
460 line = invisible_line = xrealloc (invisible_line, line_size);
461 }
462 strncpy (line + out, prompt_this_line, pmtlen);
463 out += pmtlen;
464 line[out] = '\0';
465 wrap_offset = prompt_invis_chars_first_line = 0;
466 }
467
468#define CHECK_INV_LBREAKS() \
469 do { \
470 if (newlines >= (inv_lbsize - 2)) \
471 { \
472 inv_lbsize *= 2; \
473 inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
474 } \
475 } while (0)
476
477#define CHECK_LPOS() \
478 do { \
479 lpos++; \
480 if (lpos >= _rl_screenwidth) \
481 { \
482 if (newlines >= (inv_lbsize - 2)) \
483 { \
484 inv_lbsize *= 2; \
485 inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
486 } \
487 inv_lbreaks[++newlines] = out; \
488 lpos = 0; \
489 } \
490 } while (0)
491
492 /* inv_lbreaks[i] is where line i starts in the buffer. */
493 inv_lbreaks[newlines = 0] = 0;
494 lpos = out - wrap_offset;
495
496 /* prompt_invis_chars_first_line is the number of invisible characters in
497 the first physical line of the prompt.
498 wrap_offset - prompt_invis_chars_first_line is the number of invis
499 chars on the second line. */
500
501 /* what if lpos is already >= _rl_screenwidth before we start drawing the
502 contents of the command line? */
503 while (lpos >= _rl_screenwidth)
504 {
505 /* fix from Darin Johnson <darin@acuson.com> for prompt string with
506 invisible characters that is longer than the screen width. The
507 prompt_invis_chars_first_line variable could be made into an array
508 saying how many invisible characters there are per line, but that's
509 probably too much work for the benefit gained. How many people have
510 prompts that exceed two physical lines? */
511 temp = ((newlines + 1) * _rl_screenwidth) +
512 ((newlines == 0) ? prompt_invis_chars_first_line : 0) +
513 ((newlines == 1) ? wrap_offset : 0);
514
515 inv_lbreaks[++newlines] = temp;
516 lpos -= _rl_screenwidth;
517 }
518
519 prompt_last_screen_line = newlines;
520
521 /* Draw the rest of the line (after the prompt) into invisible_line, keeping
522 track of where the cursor is (c_pos), the number of the line containing
523 the cursor (lb_linenum), the last line number (lb_botlin and inv_botlin).
524 It maintains an array of line breaks for display (inv_lbreaks).
525 This handles expanding tabs for display and displaying meta characters. */
526 lb_linenum = 0;
527 for (in = 0; in < rl_end; in++)
528 {
529 c = (unsigned char)rl_line_buffer[in];
530
531 if (out + 8 >= line_size) /* XXX - 8 for \t */
532 {
533 line_size *= 2;
534 visible_line = xrealloc (visible_line, line_size);
535 invisible_line = xrealloc (invisible_line, line_size);
536 line = invisible_line;
537 }
538
539 if (in == rl_point)
540 {
541 c_pos = out;
542 lb_linenum = newlines;
543 }
544
545 if (META_CHAR (c))
546 {
547 if (_rl_output_meta_chars == 0)
548 {
549 sprintf (line + out, "\\%o", c);
550
551 if (lpos + 4 >= _rl_screenwidth)
552 {
553 temp = _rl_screenwidth - lpos;

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

606 {
607 line[out++] = '^';
608 CHECK_LPOS();
609 line[out++] = CTRL_CHAR (c) ? UNCTRL (c) : '?';
610 CHECK_LPOS();
611 }
612 else
613 {
614 line[out++] = c;
615 CHECK_LPOS();
616 }
617 }
618 line[out] = '\0';
619 if (c_pos < 0)
620 {
621 c_pos = out;
622 lb_linenum = newlines;
623 }
624

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

646 if (!rl_display_fixed || forced_display)
647 {
648 forced_display = 0;
649
650 /* If we have more than a screenful of material to display, then
651 only display a screenful. We should display the last screen,
652 not the first. */
653 if (out >= _rl_screenchars)
654 out = _rl_screenchars - 1;
655
656 /* The first line is at character position 0 in the buffer. The
657 second and subsequent lines start at inv_lbreaks[N], offset by
658 OFFSET (which has already been calculated above). */
659
660#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
661#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
662#define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l])

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

732 {
733#if defined (__MSDOS__)
734 putc ('\r', rl_outstream);
735#else
736 if (_rl_term_cr)
737 tputs (_rl_term_cr, 1, _rl_output_character_function);
738#endif
739 _rl_output_some_chars (local_prompt, nleft);
740 _rl_last_c_pos = nleft;
741 }
742
743 /* Where on that line? And where does that line start
744 in the buffer? */
745 pos = inv_lbreaks[cursor_linenum];
746 /* nleft == number of characters in the line buffer between the
747 start of the line and the cursor position. */
748 nleft = c_pos - pos;
749
750 /* Since _rl_backspace() doesn't know about invisible characters in the
751 prompt, and there's no good way to tell it, we compensate for
752 those characters here and call _rl_backspace() directly. */
753 if (wrap_offset && cursor_linenum == 0 && nleft < _rl_last_c_pos)
754 {
755 _rl_backspace (_rl_last_c_pos - nleft);
756 _rl_last_c_pos = nleft;
757 }
758
759 if (nleft != _rl_last_c_pos)
760 _rl_move_cursor_relative (nleft, &invisible_line[pos]);
761 }
762 }
763 else /* Do horizontal scrolling. */
764 {
765#define M_OFFSET(margin, offset) ((margin) == 0 ? offset : 0)
766 int lmargin, ndisp, nleft, phys_c_pos, t;
767
768 /* Always at top line. */

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

896static void
897update_line (old, new, current_line, omax, nmax, inv_botlin)
898 register char *old, *new;
899 int current_line, omax, nmax, inv_botlin;
900{
901 register char *ofd, *ols, *oe, *nfd, *nls, *ne;
902 int temp, lendiff, wsatend, od, nd;
903 int current_invis_chars;
904
905 /* If we're at the right edge of a terminal that supports xn, we're
906 ready to wrap around, so do so. This fixes problems with knowing
907 the exact cursor position and cut-and-paste with certain terminal
908 emulators. In this calculation, TEMP is the physical screen
909 position of the cursor. */
910 temp = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset);
911 if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
912 && _rl_last_v_pos == current_line - 1)
913 {
914 if (new[0])
915 putc (new[0], rl_outstream);
916 else
917 putc (' ', rl_outstream);
918 _rl_last_c_pos = 1; /* XXX */
919 _rl_last_v_pos++;
920 if (old[0] && new[0])
921 old[0] = new[0];
922 }
923
924 /* Find first difference. */
925 for (ofd = old, nfd = new;
926 (ofd - old < omax) && *ofd && (*ofd == *nfd);
927 ofd++, nfd++)
928 ;
929
930 /* Move to the end of the screen line. ND and OD are used to keep track
931 of the distance between ne and new and oe and old, respectively, to
932 move a subtraction out of each loop. */
933 for (od = ofd - old, oe = ofd; od < omax && *oe; oe++, od++);
934 for (nd = nfd - new, ne = nfd; nd < nmax && *ne; ne++, nd++);
935
936 /* If no difference, continue to next line. */
937 if (ofd == oe && nfd == ne)
938 return;
939
940 wsatend = 1; /* flag for trailing whitespace */
941 ols = oe - 1; /* find last same */
942 nls = ne - 1;
943 while ((ols > ofd) && (nls > nfd) && (*ols == *nls))
944 {
945 if (*ols != ' ')
946 wsatend = 0;
947 ols--;
948 nls--;
949 }
950
951 if (wsatend)
952 {
953 ols = oe;
954 nls = ne;
955 }
956 else if (*ols != *nls)
957 {
958 if (*ols) /* don't step past the NUL */
959 ols++;
960 if (*nls)
961 nls++;
962 }
963
964 /* count of invisible characters in the current invisible line. */
965 current_invis_chars = W_OFFSET (current_line, wrap_offset);
966 if (_rl_last_v_pos != current_line)
967 {
968 _rl_move_vert (current_line);
969 if (current_line == 0 && visible_wrap_offset)

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

989 od >= lendiff && _rl_last_c_pos <= prompt_last_invisible)
990 {
991#if defined (__MSDOS__)
992 putc ('\r', rl_outstream);
993#else
994 tputs (_rl_term_cr, 1, _rl_output_character_function);
995#endif
996 _rl_output_some_chars (local_prompt, lendiff);
997 _rl_last_c_pos = lendiff;
998 }
999
1000 _rl_move_cursor_relative (od, old);
1001
1002 /* if (len (new) > len (old)) */
1003 lendiff = (nls - nfd) - (ols - ofd);
1004
1005 /* If we are changing the number of invisible characters in a line, and
1006 the spot of first difference is before the end of the invisible chars,
1007 lendiff needs to be adjusted. */
1008 if (current_line == 0 && !_rl_horizontal_scroll_mode &&
1009 current_invis_chars != visible_wrap_offset)
1010 lendiff += visible_wrap_offset - current_invis_chars;
1011
1012 /* Insert (diff (len (old), len (new)) ch. */
1013 temp = ne - nfd;
1014 if (lendiff > 0)
1015 {
1016 /* Non-zero if we're increasing the number of lines. */
1017 int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin;
1018 /* Sometimes it is cheaper to print the characters rather than
1019 use the terminal's capabilities. If we're growing the number
1020 of lines, make sure we actually cause the new line to wrap
1021 around on auto-wrapping terminals. */
1022 if (_rl_terminal_can_insert && ((2 * temp) >= lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
1023 {
1024 /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and
1025 _rl_horizontal_scroll_mode == 1, inserting the characters with
1026 _rl_term_IC or _rl_term_ic will screw up the screen because of the
1027 invisible characters. We need to just draw them. */
1028 if (*ols && (!_rl_horizontal_scroll_mode || _rl_last_c_pos > 0 ||
1029 lendiff <= prompt_visible_length || !current_invis_chars))
1030 {
1031 insert_some_chars (nfd, lendiff);
1032 _rl_last_c_pos += lendiff;
1033 }
1034 else if (*ols == 0)
1035 {
1036 /* At the end of a line the characters do not have to
1037 be "inserted". They can just be placed on the screen. */
1038 /* However, this screws up the rest of this block, which
1039 assumes you've done the insert because you can. */
1040 _rl_output_some_chars (nfd, lendiff);
1041 _rl_last_c_pos += lendiff;
1042 }
1043 else
1044 {
1045 /* We have horizontal scrolling and we are not inserting at
1046 the end. We have invisible characters in this line. This
1047 is a dumb update. */
1048 _rl_output_some_chars (nfd, temp);
1049 _rl_last_c_pos += temp;
1050 return;
1051 }
1052 /* Copy (new) chars to screen from first diff to last match. */
1053 temp = nls - nfd;
1054 if ((temp - lendiff) > 0)
1055 {
1056 _rl_output_some_chars (nfd + lendiff, temp - lendiff);
1057 _rl_last_c_pos += temp - lendiff;
1058 }
1059 }
1060 else
1061 {
1062 /* cannot insert chars, write to EOL */
1063 _rl_output_some_chars (nfd, temp);
1064 _rl_last_c_pos += temp;
1065 }
1066 }
1067 else /* Delete characters from line. */
1068 {
1069 /* If possible and inexpensive to use terminal deletion, then do so. */
1070 if (_rl_term_dc && (2 * temp) >= -lendiff)
1071 {
1072 /* If all we're doing is erasing the invisible characters in the
1073 prompt string, don't bother. It screws up the assumptions
1074 about what's on the screen. */
1075 if (_rl_horizontal_scroll_mode && _rl_last_c_pos == 0 &&
1076 -lendiff == visible_wrap_offset)
1077 lendiff = 0;
1078
1079 if (lendiff)
1080 delete_chars (-lendiff); /* delete (diff) characters */
1081
1082 /* Copy (new) chars to screen from first diff to last match */
1083 temp = nls - nfd;
1084 if (temp > 0)
1085 {
1086 _rl_output_some_chars (nfd, temp);
1087 _rl_last_c_pos += temp;
1088 }
1089 }
1090 /* Otherwise, print over the existing material. */
1091 else
1092 {
1093 if (temp > 0)
1094 {
1095 _rl_output_some_chars (nfd, temp);
1096 _rl_last_c_pos += temp;
1097 }
1098 lendiff = (oe - old) - (ne - new);
1099 if (lendiff)
1100 {
1101 if (_rl_term_autowrap && current_line < inv_botlin)
1102 space_to_eol (lendiff);
1103 else
1104 _rl_clear_to_eol (lendiff);
1105 }
1106 }
1107 }
1108}
1109
1110/* Tell the update routines that we have moved onto a new (empty) line. */
1111int
1112rl_on_new_line ()

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

1142 strcpy (invisible_line, rl_prompt);
1143
1144 /* If the prompt contains newlines, take the last tail. */
1145 prompt_last_line = strrchr (rl_prompt, '\n');
1146 if (!prompt_last_line)
1147 prompt_last_line = rl_prompt;
1148
1149 l = strlen (prompt_last_line);
1150 _rl_last_c_pos = l;
1151
1152 /* Dissect prompt_last_line into screen lines. Note that here we have
1153 to use the real screenwidth. Readline's notion of screenwidth might be
1154 one less, see terminal.c. */
1155 real_screenwidth = _rl_screenwidth + (_rl_term_autowrap ? 0 : 1);
1156 _rl_last_v_pos = l / real_screenwidth;
1157 /* If the prompt length is a multiple of real_screenwidth, we don't know
1158 whether the cursor is at the end of the last line, or already at the

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

1197void
1198_rl_move_cursor_relative (new, data)
1199 int new;
1200 const char *data;
1201{
1202 register int i;
1203
1204 /* If we don't have to do anything, then return. */
1205 if (_rl_last_c_pos == new) return;
1206
1207 /* It may be faster to output a CR, and then move forwards instead
1208 of moving backwards. */
1209 /* i == current physical cursor position. */
1210 i = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset);
1211 if (new == 0 || CR_FASTER (new, _rl_last_c_pos) ||
1212 (_rl_term_autowrap && i == _rl_screenwidth))
1213 {

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

1227
1228 /* The above comment is left here for posterity. It is faster
1229 to print one character (non-control) than to print a control
1230 sequence telling the terminal to move forward one character.
1231 That kind of control is for people who don't know what the
1232 data is underneath the cursor. */
1233#if defined (HACK_TERMCAP_MOTION)
1234 if (_rl_term_forward_char)
1235 for (i = _rl_last_c_pos; i < new; i++)
1236 tputs (_rl_term_forward_char, 1, _rl_output_character_function);
1237 else
1238 for (i = _rl_last_c_pos; i < new; i++)
1239 putc (data[i], rl_outstream);
1240#else
1241 for (i = _rl_last_c_pos; i < new; i++)
1242 putc (data[i], rl_outstream);
1243#endif /* HACK_TERMCAP_MOTION */
1244 }
1245 else if (_rl_last_c_pos > new)
1246 _rl_backspace (_rl_last_c_pos - new);
1247 _rl_last_c_pos = new;
1248}
1249
1250/* PWP: move the cursor up or down. */
1251void
1252_rl_move_vert (to)
1253 int to;
1254{
1255 register int delta, i;

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

1326#else
1327 return (2);
1328#endif /* !DISPLAY_TABS */
1329 }
1330
1331 if (CTRL_CHAR (c) || c == RUBOUT)
1332 return (2);
1333
1334 return ((isprint (uc)) ? 1 : 2);
1335}
1336
1337/* How to print things in the "echo-area". The prompt is treated as a
1338 mini-modeline. */
1339
1340#if defined (USE_VARARGS)
1341int
1342#if defined (PREFER_STDARG)

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

1353
1354#if defined (PREFER_STDARG)
1355 va_start (args, format);
1356#else
1357 va_start (args);
1358 format = va_arg (args, char *);
1359#endif
1360
1361 vsprintf (msg_buf, format, args);
1362 va_end (args);
1363
1364 rl_display_prompt = msg_buf;
1365 (*rl_redisplay_function) ();
1366 return 0;
1367}
1368#else /* !USE_VARARGS */
1369int
1370rl_message (format, arg1, arg2)
1371 char *format;
1372{
1373 sprintf (msg_buf, format, arg1, arg2);
1374 rl_display_prompt = msg_buf;
1375 (*rl_redisplay_function) ();
1376 return 0;
1377}
1378#endif /* !USE_VARARGS */
1379
1380/* How to clear things from the "echo-area". */
1381int

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

1432 int len;
1433 char *pmt;
1434
1435 rl_save_prompt ();
1436
1437 if (saved_local_prompt == 0)
1438 {
1439 len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
1440 pmt = xmalloc (len + 2);
1441 if (len)
1442 strcpy (pmt, rl_prompt);
1443 pmt[len] = pchar;
1444 pmt[len+1] = '\0';
1445 }
1446 else
1447 {
1448 len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
1449 pmt = xmalloc (len + 2);
1450 if (len)
1451 strcpy (pmt, saved_local_prompt);
1452 pmt[len] = pchar;
1453 pmt[len+1] = '\0';
1454 local_prompt = savestring (pmt);
1455 prompt_last_invisible = saved_last_invisible;
1456 prompt_visible_length = saved_visible_length + 1;
1457 }

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

1504_rl_clear_screen ()
1505{
1506 if (_rl_term_clrpag)
1507 tputs (_rl_term_clrpag, 1, _rl_output_character_function);
1508 else
1509 rl_crlf ();
1510}
1511
1512/* Insert COUNT characters from STRING to the output stream. */
1513static void
1514insert_some_chars (string, count)
1515 char *string;
1516 int count;
1517{
1518 /* If IC is defined, then we do not have to "enter" insert mode. */
1519 if (_rl_term_IC)
1520 {
1521 char *buffer;
1522 buffer = tgoto (_rl_term_IC, 0, count);
1523 tputs (buffer, 1, _rl_output_character_function);
1524 _rl_output_some_chars (string, count);
1525 }
1526 else
1527 {
1528 register int i;
1529
1530 /* If we have to turn on insert-mode, then do so. */
1531 if (_rl_term_im && *_rl_term_im)
1532 tputs (_rl_term_im, 1, _rl_output_character_function);
1533
1534 /* If there is a special command for inserting characters, then
1535 use that first to open up the space. */
1536 if (_rl_term_ic && *_rl_term_ic)
1537 {
1538 for (i = count; i--; )
1539 tputs (_rl_term_ic, 1, _rl_output_character_function);
1540 }
1541
1542 /* Print the text. */
1543 _rl_output_some_chars (string, count);
1544
1545 /* If there is a string to turn off insert mode, we had best use
1546 it now. */

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

1585 _rl_vis_botlin--;
1586 full_lines = 1;
1587 }
1588 _rl_move_vert (_rl_vis_botlin);
1589 /* If we've wrapped lines, remove the final xterm line-wrap flag. */
1590 if (full_lines && _rl_term_autowrap && (VIS_LLEN(_rl_vis_botlin) == _rl_screenwidth))
1591 {
1592 char *last_line;
1593#if 0
1594 last_line = &visible_line[inv_lbreaks[_rl_vis_botlin]];
1595#else
1596 last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]];
1597#endif
1598 _rl_move_cursor_relative (_rl_screenwidth - 1, last_line);
1599 _rl_clear_to_eol (0);
1600 putc (last_line[_rl_screenwidth - 1], rl_outstream);
1601 }
1602 _rl_vis_botlin = 0;
1603 rl_crlf ();
1604 fflush (rl_outstream);
1605 rl_display_fixed++;

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

1734
1735 if (nleft > 0)
1736 ret = 1 + nleft / _rl_screenwidth;
1737 else
1738 ret = 0;
1739
1740 return ret;
1741}