Mercurial > hg > octave-terminal
changeset 3281:aaaa20d31a5f
[project @ 1999-10-13 07:02:46 by jwe]
author | jwe |
---|---|
date | Wed, 13 Oct 1999 07:05:23 +0000 |
parents | 46b82fca02fc |
children | 518ea57df2c4 |
files | liboctave/ChangeLog liboctave/cmd-edit.cc liboctave/cmd-edit.h readline/ChangeLog readline/readline.h readline/terminal.c src/ChangeLog src/sighandlers.cc |
diffstat | 8 files changed, 64 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +1999-10-13 John W. Eaton <jwe@bevo.che.wisc.edu> + + * cmd-edit.h (command_editor::do_resize_terminal): New function. + * cmd-edit.cc (command_editor::resize_terminal): New function. + (gnu_readline::do_resize_terminal): New function. + Fri Sep 3 12:39:17 1999 John W. Eaton <jwe@bevo.che.wisc.edu> * lo-mappers.cc: Include ieeefp.h and sunmath.h if we have them.
--- a/liboctave/cmd-edit.cc +++ b/liboctave/cmd-edit.cc @@ -91,6 +91,8 @@ void do_clear_screen (void); + void do_resize_terminal (void); + string newline_chars (void); void do_restore_terminal_state (void); @@ -247,6 +249,12 @@ rl_clear_screen (); } +void +gnu_readline::do_resize_terminal (void) +{ + rl_resize_terminal (); +} + string gnu_readline::newline_chars (void) { @@ -594,6 +602,13 @@ instance->do_clear_screen (); } +void +command_editor::resize_terminal (void) +{ + if (instance_ok ()) + instance->do_resize_terminal (); +} + string command_editor::decode_prompt_string (const string& s) {
--- a/liboctave/cmd-edit.h +++ b/liboctave/cmd-edit.h @@ -63,6 +63,8 @@ static void clear_screen (void); + static void resize_terminal (void); + static string decode_prompt_string (const string& s); static void restore_terminal_state (void); @@ -145,6 +147,8 @@ virtual void do_clear_screen (void) { } + virtual void do_resize_terminal (void) { } + virtual string do_decode_prompt_string (const string&); virtual string newline_chars (void) { return "\n"; }
--- a/readline/ChangeLog +++ b/readline/ChangeLog @@ -1,3 +1,7 @@ +1999-10-13 John W. Eaton <jwe@bevo.che.wisc.edu> + + * terminal.c (rl_resize_terminal): Import from readline 4.0. + Thu May 27 21:47:26 1999 John W. Eaton <jwe@bevo.che.wisc.edu> * histfile.c [__CYGWIN__]: Define O_BINARY if not already defined.
--- a/readline/readline.h +++ b/readline/readline.h @@ -207,6 +207,7 @@ /* `Public' utility functions. */ extern int rl_reset_terminal (); +extern void rl_resize_terminal (); extern int rl_stuff_char (); extern int rl_read_key (), rl_getc ();
--- a/readline/terminal.c +++ b/readline/terminal.c @@ -232,6 +232,16 @@ screenchars = screenwidth * screenheight; } +void +rl_resize_terminal () +{ + if (readline_echoing_p) + { + _rl_get_screen_size (fileno (rl_instream), 1); + _rl_redisplay_after_sigwinch (); + } +} + struct _tc_string { char *tc_var; char **tc_value;
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +1999-10-13 John W. Eaton <jwe@bevo.che.wisc.edu> + + * sighandlers.cc (sigwinch_handler): New function. + (install_signal_handlers): Install it. + Thu Sep 23 19:49:36 1999 John W. Eaton <jwe@bevo.che.wisc.edu> * toplev.cc (Fsystem): For async case, use execl instead of
--- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -38,6 +38,8 @@ #include <unistd.h> #endif +#include "cmd-edit.h" + #include "error.h" #include "load-save.h" #include "pager.h" @@ -267,6 +269,20 @@ } #endif +#if defined (SIGWINCH) +static RETSIGTYPE +sigwinch_handler (int /* sig */) +{ + MAYBE_ACK_SIGNAL (SIGWINCH); + + MAYBE_REINSTALL_SIGHANDLER (SIGWINCH, sigwinch_handler); + + command_editor::resize_terminal (); + + SIGHANDLER_RETURN (0); +} +#endif + // Handle SIGINT by restarting the parser (see octave.cc). // // This also has to work for SIGBREAK (on systems that have it), so we @@ -475,7 +491,9 @@ octave_set_signal_handler (SIGIO, SIG_IGN); #endif - // SIGWINCH +#ifdef SIGWINCH + octave_set_signal_handler (SIGWINCH, sigwinch_handler); +#endif #ifdef SIGXCPU octave_set_signal_handler (SIGXCPU, generic_sig_handler);