bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Patch] Ncurses/Forms: Vertical Scrolling breaks form editing


From: Leon Winter
Subject: [Patch] Ncurses/Forms: Vertical Scrolling breaks form editing
Date: Tue, 24 Jun 2014 16:07:39 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

Hi,

when making use of a vertical scrolling movement in Ncurses/Forms the
function Vertical_Scrolling is called. Due to a mistake in a commit two
years ago, the _NEWTOP flag will be assigned to the status bitmap of the
form. However in this context _NEWTOP does not exist, unfortunately it
has the same value as _IN_DRIVER (both are defined as the integer 2). In
turn every call after such an operation will fail at the check for
_IN_DRIVER and return E_BAD_STATE.

Utilizing the useful inofficial git repository [0] I traced the change
back to this commit/release [1]:

commit b6d0d9ad9e372e856f01a4c283cf784a15993903
Author: Thomas E. Dickey <address@hidden>
Date:   Sat Jun 16 23:57:20 2012 +0000

    ncurses 5.9 - patch 20120616
    
    + add configure check to distinguish clang from gcc to eliminate
      warnings about unused command-line parameters when compiler warnings
      are enabled.
    + improve behavior when updating terminfo entries which are hardlinked
      by allowing for the possibility that an alias has been repurposed to
      a new primary name.
    + fix some strict compiler warnings based on package scripts.
    + further fixes for configure check for working poll (Debian #676461).

The actual mistake is this part of the patch:
@@ -1998,7 +1998,7 @@ Vertical_Scrolling(int (*const fct) (FORM *), FORM *form)
     {
       res = fct(form);
       if (res == E_OK)
-       form->current->status |= _NEWTOP;
+       SetStatus(form, _NEWTOP);
     }
   return (res);
 }

The obvious fix is:

diff --git a/form/frm_driver.c b/form/frm_driver.c
index 9c73125..a9b4692 100644
--- a/form/frm_driver.c
+++ b/form/frm_driver.c
@@ -1998,7 +2004,7 @@ Vertical_Scrolling(int (*const fct) (FORM *), FORM *form)
     {   
       res = fct(form);
       if (res == E_OK)
-       SetStatus(form, _NEWTOP);
+       SetStatus(form->current, _NEWTOP);
     }   
   return (res);
 }

Regards,
Leon Winter

[0] http://ncurses.scripts.mit.edu/
[1] b6d0d9ad9e372e856f01a4c283cf784a15993903
    In Web UI:
    
http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff;f=form/frm_driver.c;h=5aac0060551ba656b6dfa54ec8ee152195e53673;hp=549ce8058efa5d25c33876b885fa17f51ade4dec;hb=b6d0d9ad9e372e856f01a4c283cf784a15993903;hpb=1d7867d33e6954be7c7121b1028ad6768f487752



reply via email to

[Prev in Thread] Current Thread [Next in Thread]