]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - form/frm_driver.c
ncurses 5.9 - patch 20130720
[ncurses.git] / form / frm_driver.c
index 5aac0060551ba656b6dfa54ec8ee152195e53673..9131edf57a035ed2dc0a4966e02382c743810f96 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_driver.c,v 1.101 2012/06/10 00:28:04 tom Exp $")
+MODULE_ID("$Id: frm_driver.c,v 1.104 2013/06/22 20:02:55 tom Exp $")
 
 /*----------------------------------------------------------------------------
   This is the core module of the form library. It contains the majority
@@ -1211,7 +1211,7 @@ Synchronize_Linked_Fields(FIELD *field)
     return (E_SYSTEM_ERROR);
 
   for (linked_field = field->link;
-       linked_field != field;
+       (linked_field != field) && (linked_field != 0);
        linked_field = linked_field->link)
     {
       if (((syncres = Synchronize_Field(linked_field)) != E_OK) &&
@@ -4229,7 +4229,10 @@ form_driver(FORM *form, int c)
 
   if ((c >= MIN_FORM_COMMAND && c <= MAX_FORM_COMMAND) &&
       ((bindings[c - MIN_FORM_COMMAND].keycode & Key_Mask) == c))
-    BI = &(bindings[c - MIN_FORM_COMMAND]);
+    {
+      TR(TRACE_CALLS, ("form_request %s", form_request_name(c)));
+      BI = &(bindings[c - MIN_FORM_COMMAND]);
+    }
 
   if (BI)
     {
@@ -4256,9 +4259,13 @@ form_driver(FORM *form, int c)
          Generic_Method fct = Generic_Methods[method];
 
          if (fct)
-           res = fct(BI->cmd, form);
+           {
+             res = fct(BI->cmd, form);
+           }
          else
-           res = (BI->cmd) (form);
+           {
+             res = (BI->cmd) (form);
+           }
        }
     }
 #ifdef NCURSES_MOUSE_VERSION
@@ -4527,7 +4534,7 @@ field_buffer(const FIELD *field, int buffer)
 
              init_mb(state);
              next = _nc_wcrtomb(0, data[n].chars[0], &state);
-             if (!isEILSEQ(next))
+             if (next > 0)
                need += next;
            }
        }