diff src/input.cc @ 11367:b2191ebea12f

don't process input_event_hook when we are parsing a function
author John W. Eaton <jwe@octave.org>
date Wed, 15 Dec 2010 00:44:10 -0500
parents 795c97ace02c
children 51b6193e90bb
line wrap: on
line diff
--- a/src/input.cc	Tue Dec 14 18:40:38 2010 -0800
+++ b/src/input.cc	Wed Dec 15 00:44:10 2010 -0500
@@ -1247,29 +1247,32 @@
 static int
 input_event_hook (void)
 {
-  hook_fcn_map_type::iterator p = hook_fcn_map.begin ();
-
-  while (p != hook_fcn_map.end ())
+  if (! lexer_flags.defining_func)
     {
-      std::string hook_fcn = p->first;
-      octave_value user_data = p->second;
+      hook_fcn_map_type::iterator p = hook_fcn_map.begin ();
 
-      p++;
-
-      if (is_valid_function (hook_fcn))
+      while (p != hook_fcn_map.end ())
         {
-          if (user_data.is_defined ())
-            feval (hook_fcn, user_data, 0);
+          std::string hook_fcn = p->first;
+          octave_value user_data = p->second;
+
+          p++;
+
+          if (is_valid_function (hook_fcn))
+            {
+              if (user_data.is_defined ())
+                feval (hook_fcn, user_data, 0);
+              else
+                feval (hook_fcn, octave_value_list (), 0);
+            }
           else
-            feval (hook_fcn, octave_value_list (), 0);
+            hook_fcn_map.erase (p);
         }
-      else
-        hook_fcn_map.erase (p);
+
+      if (hook_fcn_map.empty ())
+        command_editor::remove_event_hook (input_event_hook);
     }
 
-  if (hook_fcn_map.empty ())
-    command_editor::remove_event_hook (input_event_hook);
-
   return 0;
 }