changeset 17214:3d1205d5771e

make history widget respect history_control settings * input.cc(octave_gets): don't call octave_link::append_history because it is now called via command_history::add * oct-hist.cc(edit_history_add_hist,octave_history_write_timestamp): don't call octave_link::append_history because it is now called via command_history::add * cmd-hist.cc: include octave-link.h, (gnu_history::do_add): call octave_link::append_history only if octave_add_history really has added something * liboctave/Makefile.am: add libinterp/corefcn as include path as cmd-hist.cc needs to include octave-link.h
author Torsten <ttl@justmail.de>
date Sat, 10 Aug 2013 20:51:54 +0200
parents 4407606d0939
children 7c06875c2dcc
files libinterp/corefcn/input.cc libinterp/corefcn/oct-hist.cc liboctave/Makefile.am liboctave/util/cmd-hist.cc
diffstat 4 files changed, 12 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/input.cc	Sat Aug 10 12:37:12 2013 -0400
+++ b/libinterp/corefcn/input.cc	Sat Aug 10 20:51:54 2013 +0200
@@ -271,12 +271,7 @@
   if (retval != "\n")
     {
       if (! history_skip_auto_repeated_debugging_command)
-        {
-          command_history::add (retval);
-
-          if (! command_history::ignoring_entries ())
-            octave_link::append_history (retval);
-        }
+        command_history::add (retval);
 
       octave_diary << retval;
 
--- a/libinterp/corefcn/oct-hist.cc	Sat Aug 10 12:37:12 2013 -0400
+++ b/libinterp/corefcn/oct-hist.cc	Sat Aug 10 20:51:54 2013 +0200
@@ -328,10 +328,7 @@
         tmp.resize (len - 1);
 
       if (! tmp.empty ())
-        {
-          command_history::add (tmp);
-          octave_link::append_history (tmp);
-        }
+        command_history::add (tmp);
     }
 }
 
@@ -580,10 +577,7 @@
   std::string timestamp = now.strftime (Vhistory_timestamp_format_string);
 
   if (! timestamp.empty ())
-    {
-      command_history::add (timestamp); 
-      octave_link::append_history (timestamp);
-   }
+    command_history::add (timestamp);
 }
 
 DEFUN (edit_history, args, ,
--- a/liboctave/Makefile.am	Sat Aug 10 12:37:12 2013 -0400
+++ b/liboctave/Makefile.am	Sat Aug 10 20:51:54 2013 +0200
@@ -34,7 +34,8 @@
   -Ioperators -I$(srcdir)/operators \
   -I$(srcdir)/system \
   -I$(srcdir)/util \
-  -I$(top_builddir)/libgnu -I$(top_srcdir)/libgnu
+  -I$(top_builddir)/libgnu -I$(top_srcdir)/libgnu \
+  -I$(top_srcdir)/libinterp/corefcn
 
 AM_CFLAGS += $(WARN_CFLAGS)
 
--- a/liboctave/util/cmd-hist.cc	Sat Aug 10 12:37:12 2013 -0400
+++ b/liboctave/util/cmd-hist.cc	Sat Aug 10 20:51:54 2013 +0200
@@ -48,6 +48,7 @@
 #include <fcntl.h>
 
 #include "oct-rl-hist.h"
+#include "octave-link.h"
 
 #include "file-stat.h"
 
@@ -199,7 +200,12 @@
       if (stmp[stmp_len - 1] == '\n')
         stmp.resize (stmp_len - 1);
 
-      lines_this_session += ::octave_add_history (stmp.c_str (), history_control);
+      int added = ::octave_add_history (stmp.c_str (), history_control);
+      if (added > 0)
+        {
+          lines_this_session += added;
+          octave_link::append_history (stmp.c_str ());
+        }
     }
 }