diff options
Diffstat (limited to 'readline')
-rw-r--r-- | readline/ChangeLog.Cygnus | 18 | ||||
-rw-r--r-- | readline/display.c | 29 | ||||
-rw-r--r-- | readline/terminal.c | 39 |
3 files changed, 81 insertions, 5 deletions
diff --git a/readline/ChangeLog.Cygnus b/readline/ChangeLog.Cygnus index 40baa984a2a..4556c2ad6ef 100644 --- a/readline/ChangeLog.Cygnus +++ b/readline/ChangeLog.Cygnus @@ -1,3 +1,21 @@ +2000-07-10 Eli Zaretskii <eliz@is.elta.co.il> + + * terminal.c (_rl_get_screen_size) [__DJGPP__]: Determine screen + size via DJGPP-specific calls. + (_rl_init_terminal_io) [__MSDOS__]: DJGPP-specific terminal + initialization. + (_rl_backspace) [__MSDOS__]: Don't call tputs. + (ding) [__MSDOS__]: Use DJGPP-specific calls to support visible + bell. + + * display.c (_rl_move_vert) [__MSDOS__]: Support cursor movement + upwards with DJGPP-specific calls. + (_rl_clear_to_eol) [__MSDOS__]: Don't call tputs. + (_rl_clear_screen) [__MSDOS__]: Support clear-screen with + DJGPP-specific calls. + (insert_some_chars) [__MSDOS__]: Don't call tputs. + (delete_chars) [__MSDOS__]: Don't call tputs. + 2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com> * Import of readline 4.1. diff --git a/readline/display.c b/readline/display.c index 4487004a027..9fff8cc2acb 100644 --- a/readline/display.c +++ b/readline/display.c @@ -41,6 +41,10 @@ #include <stdio.h> +#ifdef __MSDOS__ +# include <pc.h> +#endif + /* System-specific feature definitions and include files. */ #include "rldefs.h" @@ -1224,9 +1228,18 @@ _rl_move_vert (to) } else { /* delta < 0 */ +#ifdef __MSDOS__ + int row, col; + + i = fflush (rl_outstream); /* make sure the cursor pos is current! */ + ScreenGetCursor (&row, &col); + ScreenSetCursor ((row + to - _rl_last_v_pos), col); + delta = i; +#else /* !__MSDOS__ */ if (term_up && *term_up) for (i = 0; i < -delta; i++) tputs (term_up, 1, _rl_output_character_function); +#endif /* !__MSDOS__ */ } _rl_last_v_pos = to; /* Now TO is here */ @@ -1436,9 +1449,12 @@ void _rl_clear_to_eol (count) int count; { +#ifndef __MSDOS__ if (term_clreol) tputs (term_clreol, 1, _rl_output_character_function); - else if (count) + else +#endif + if (count) space_to_eol (count); } @@ -1459,10 +1475,15 @@ space_to_eol (count) void _rl_clear_screen () { +#if defined (__GO32__) + ScreenClear (); /* FIXME: only works in text modes */ + ScreenSetCursor (0, 0); /* term_clrpag is "cl" which homes the cursor */ +#else if (term_clrpag) tputs (term_clrpag, 1, _rl_output_character_function); else crlf (); +#endif } /* Insert COUNT characters from STRING to the output stream. */ @@ -1471,6 +1492,9 @@ insert_some_chars (string, count) char *string; int count; { +#ifdef __MSDOS__ + _rl_output_some_chars (string, count); +#else /* !__MSDOS__ */ /* If IC is defined, then we do not have to "enter" insert mode. */ if (term_IC) { @@ -1503,6 +1527,7 @@ insert_some_chars (string, count) if (term_ei && *term_ei) tputs (term_ei, 1, _rl_output_character_function); } +#endif /* !__MSDOS__ */ } /* Delete COUNT characters from the display line. */ @@ -1513,6 +1538,7 @@ delete_chars (count) if (count > screenwidth) /* XXX */ return; +#ifndef __MSDOS__ if (term_DC && *term_DC) { char *buffer; @@ -1525,6 +1551,7 @@ delete_chars (count) while (count--) tputs (term_dc, 1, _rl_output_character_function); } +#endif /* !__MSDOS__ */ } void diff --git a/readline/terminal.c b/readline/terminal.c index 20ad126ec37..02757fee942 100644 --- a/readline/terminal.c +++ b/readline/terminal.c @@ -55,6 +55,10 @@ # include <sys/ioctl.h> #endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */ +#ifdef __MSDOS__ +# include <pc.h> +#endif + #include "rltty.h" #include "tcap.h" @@ -71,13 +75,15 @@ /* */ /* **************************************************************** */ +#ifndef __MSDOS__ static char *term_buffer = (char *)NULL; static char *term_string_buffer = (char *)NULL; -static int tcap_initialized; - /* Non-zero means this terminal can't really do anything. */ static int dumb_term; +#endif /* !__MSDOS__ */ + +static int tcap_initialized; #if !defined (__linux__) # if defined (__EMX__) || defined (NEED_EXTERN_PC) @@ -185,7 +191,10 @@ _rl_get_screen_size (tty, ignore_env) if (ignore_env == 0 && (ss = get_env_value ("COLUMNS"))) screenwidth = atoi (ss); -#if !defined (__DJGPP__) +#if defined (__DJGPP__) + if (screenwidth <= 0) + screenwidth = ScreenCols (); +#else if (screenwidth <= 0 && term_string_buffer) screenwidth = tgetnum ("co"); #endif @@ -198,7 +207,10 @@ _rl_get_screen_size (tty, ignore_env) if (ignore_env == 0 && (ss = get_env_value ("LINES"))) screenheight = atoi (ss); -#if !defined (__DJGPP__) +#if defined (__DJGPP__) + if (screenheight <= 0) + screenheight = ScreenRows (); +#else if (screenheight <= 0 && term_string_buffer) screenheight = tgetnum ("li"); #endif @@ -318,6 +330,16 @@ _rl_init_terminal_io (terminal_name) if (term == 0) term = "dumb"; +#ifdef __MSDOS__ + term_im = term_ei = term_ic = term_IC = (char *)NULL; + term_up = term_dc = term_DC = visible_bell = (char *)NULL; + term_ku = term_kd = term_kl = term_kr = (char *)NULL; + term_mm = term_mo = (char *)NULL; + terminal_can_insert = term_has_meta = _rl_term_autowrap = 0; + term_cr = "\r"; + + _rl_get_screen_size (tty, 0); +#else /* !__MSDOS__ */ /* I've separated this out for later work on not calling tgetent at all if the calling application has supplied a custom redisplay function, (and possibly if the application has supplied a custom input function). */ @@ -410,6 +432,8 @@ _rl_init_terminal_io (terminal_name) if (!term_has_meta) term_mm = term_mo = (char *)NULL; +#endif /* !__MSDOS__ */ + /* Attempt to find and bind the arrow keys. Do not override already bound keys in an overzealous attempt, however. */ xkeymap = _rl_keymap; @@ -498,10 +522,12 @@ _rl_backspace (count) { register int i; +#ifndef __MSDOS__ if (term_backspace) for (i = 0; i < count; i++) tputs (term_backspace, 1, _rl_output_character_function); else +#endif for (i = 0; i < count; i++) putc ('\b', _rl_out_stream); return 0; @@ -531,11 +557,16 @@ ding () default: break; case VISIBLE_BELL: +#ifdef __MSDOS__ + ScreenVisualBell (); + break; +#else if (visible_bell) { tputs (visible_bell, 1, _rl_output_character_function); break; } +#endif /* FALLTHROUGH */ case AUDIBLE_BELL: fprintf (stderr, "\007"); |