# include <config.h>
#endif
-#include <stdio.h>
#include <sys/types.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
+#include "posixstat.h"
+
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
-#include "posixstat.h"
+#include <stdio.h>
+
+#if defined (__GO32__)
+# include <go32.h>
+# include <pc.h>
+#endif /* __GO32__ */
/* System-specific feature definitions and include files. */
#include "rldefs.h"
extern int _rl_output_character_function ();
extern int _rl_backspace ();
-extern char *term_clreol, *term_im, *term_ic, *term_ei, *term_DC;
+extern char *term_clreol, *term_clrpag;
+extern char *term_im, *term_ic, *term_ei, *term_DC;
extern char *term_up, *term_dc, *term_cr, *term_IC;
extern int screenheight, screenwidth, screenchars;
extern int terminal_can_insert, _rl_term_autowrap;
by this file. */
void _rl_move_cursor_relative (), _rl_output_some_chars ();
void _rl_move_vert ();
+void _rl_clear_to_eol (), _rl_clear_screen ();
-static void update_line (), clear_to_eol (), space_to_eol ();
+static void update_line (), space_to_eol ();
static void delete_chars (), insert_some_chars ();
static void cr ();
register int in, out, c, linenum, cursor_linenum;
register char *line;
int c_pos, inv_botlin, lb_botlin, lb_linenum;
- int newlines, lpos;
+ int newlines, lpos, temp;
char *prompt_this_line;
if (!readline_echoing_p)
/* inv_lbreaks[i] is where line i starts in the buffer. */
inv_lbreaks[newlines = 0] = 0;
+ lpos = out - wrap_offset;
+
+ /* XXX - what if lpos is already >= screenwidth before we start drawing the
+ contents of the command line? */
+ while (lpos >= screenwidth)
+ {
+ temp = ((newlines + 1) * screenwidth) - ((newlines == 0) ? wrap_offset : 0);
+ inv_lbreaks[++newlines] = temp;
+ lpos -= screenwidth;
+ }
- for (in = 0, lpos = out - wrap_offset; in < rl_end; in++)
+ lb_linenum = 0;
+ for (in = 0; in < rl_end; in++)
{
c = (unsigned char)rl_line_buffer[in];
if (lpos + 4 >= screenwidth)
{
- register int temp;
-
temp = screenwidth - lpos;
inv_lbreaks[++newlines] = out + temp;
lpos = 4 - temp;
{
nleft = screenwidth + wrap_offset - _rl_last_c_pos;
if (nleft)
- clear_to_eol (nleft);
+ _rl_clear_to_eol (nleft);
}
/* Since the new first line is now visible, save its length. */
tt = VIS_CHARS (linenum);
_rl_move_vert (linenum);
_rl_move_cursor_relative (0, tt);
- clear_to_eol
+ _rl_clear_to_eol
((linenum == _rl_vis_botlin) ? strlen (tt) : screenwidth);
}
}
t < visible_first_line_len)
{
nleft = screenwidth - t;
- clear_to_eol (nleft);
+ _rl_clear_to_eol (nleft);
}
visible_first_line_len = out - lmargin - M_OFFSET (lmargin, wrap_offset);
if (visible_first_line_len > screenwidth)
if (_rl_term_autowrap && current_line < inv_botlin)
space_to_eol (lendiff);
else
- clear_to_eol (lendiff);
+ _rl_clear_to_eol (lendiff);
}
}
}
/* Clear to the end of the line. COUNT is the minimum
number of character spaces to clear, */
-static void
-clear_to_eol (count)
+void
+_rl_clear_to_eol (count)
int count;
{
#if !defined (__GO32__)
if (term_clreol)
- {
- tputs (term_clreol, 1, _rl_output_character_function);
- }
- else
+ tputs (term_clreol, 1, _rl_output_character_function);
+ else if (count)
#endif /* !__GO32__ */
space_to_eol (count);
}
_rl_last_c_pos += count;
}
+void
+_rl_clear_screen ()
+{
+#if !defined (__GO32__)
+ if (term_clrpag)
+ tputs (term_clrpag, 1, _rl_output_character_function);
+ else
+#endif /* !__GO32__ */
+ crlf ();
+}
+
/* Insert COUNT characters from STRING to the output stream. */
static void
insert_some_chars (string, count)
/* If the cursor is the only thing on an otherwise-blank last line,
compensate so we don't print an extra CRLF. */
if (_rl_vis_botlin && _rl_last_c_pos == 0 &&
- visible_line[inv_lbreaks[_rl_vis_botlin]+1] == 0)
+ visible_line[vis_lbreaks[_rl_vis_botlin]] == 0)
{
_rl_vis_botlin--;
full_lines = 1;
char *last_line;
last_line = &visible_line[inv_lbreaks[_rl_vis_botlin]];
_rl_move_cursor_relative (screenwidth - 1, last_line);
- clear_to_eol (0);
+ _rl_clear_to_eol (0);
putc (last_line[screenwidth - 1], rl_outstream);
}
_rl_vis_botlin = 0;