changeset 27158:af1015a3d558

allow terminal rows and columns to be set when not using readline * cmd-edit.h (command_editor::m_rows, command_editor::m_cols): New data members. (command_editor::command_editor): Initialized them to 24 and 80. (command_editor::do_terminal_rows): Return m_rows, not fixed value. (command_editor::do_terminal_cols): Return m_cols, not fixed value. (command_editor::do_set_screen_size): Set m_rows and m_cols.
author John W. Eaton <jwe@octave.org>
date Fri, 07 Jun 2019 13:28:09 -0400
parents e2061085dc5e
children 25d0c4b5a3aa
files liboctave/util/cmd-edit.h
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/util/cmd-edit.h	Fri Jun 07 15:52:51 2019 +0200
+++ b/liboctave/util/cmd-edit.h	Fri Jun 07 13:28:09 2019 -0400
@@ -41,7 +41,9 @@
   protected:
 
     command_editor (void)
-      : command_number (0), interrupted (false), initial_input () { }
+      : command_number (0), m_rows (24), m_cols (80), interrupted (false),
+        initial_input ()
+      { }
 
   public:
 
@@ -249,15 +251,19 @@
 
     virtual void do_redisplay (void) { }
 
-    virtual int do_terminal_rows (void) { return 24; }
+    virtual int do_terminal_rows (void) { return m_rows; }
 
-    virtual int do_terminal_cols (void) { return 80; }
+    virtual int do_terminal_cols (void) { return m_cols; }
 
     virtual void do_clear_screen (bool) { }
 
     virtual void do_resize_terminal (void) { }
 
-    virtual void do_set_screen_size (int, int) { }
+    virtual void do_set_screen_size (int ht, int wd)
+    {
+      m_rows = ht;
+      m_cols = wd;
+    }
 
     virtual std::string do_decode_prompt_string (const std::string&);
 
@@ -365,6 +371,9 @@
     // The current command number.
     int command_number;
 
+    int m_rows;
+    int m_cols;
+
     bool interrupted;
 
     std::string initial_input;