bug-ncurses
[Top][All Lists]
Advanced

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

Re: Ncurses/Forms: Alignment for dynamic Fields


From: Leon Winter
Subject: Re: Ncurses/Forms: Alignment for dynamic Fields
Date: Mon, 21 Jul 2014 08:00:35 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

Hi,

> ok (suggestions welcome -naming's painful)

most simple name would be O_ALIGN or O_JUSTIFY, however this could look
like it would be required to specified even for O_STATIC. So one could
argue the 'dynamic'-ness should be included, so how about
O_DYNAMIC_JUSTIFY or shorter O_DYN_JUSTIFY. Since we have the function
call form_field_just () we could jo even more cryptic with O_DYN_JUST.
In any case the man page of form_field_opts needs to reflect the
addition and will almost always to be consulted. I would be in favour of
one of the longer variants as it would enable an understanding without
consulting the man page immediately.

> hmm - I see that (I must have broken this fairly recently...)

Not too recently, there have not been serious changes to this file for
some time. The actual change which introduced this missing check was
20121117 [0]. In a direct comparison to the current version [1] we see
that there used to be a check which was replaced by the call to the
get_data () function (which unfortunately can then return NULL):
@@ -121,17 +220,7 @@ make_field(int frow, int fcol, int rows, int cols)
            set_max_field(f, m_value);
        }
 
-       /*
-        * The userptr is used in edit_field.c's inactive_field().
-        */
-       ptr = (FieldAttrs *) field_userptr(f);
-       if (ptr == 0) {
-           ptr = typeCalloc(FieldAttrs, 1);
-           ptr->background = field_back(f);
-       }
-       set_field_userptr(f, (void *) ptr);
-       if (t_value)
-           set_field_buffer(f, 0, t_value);
+       init_edit_field(f, get_data(label));
     }
     return (f);
 }

Just for completeness the diff I provided was against 20140118 but since
there were no other changes, it is still applicable to the current
upstream version.

Regards,
Leon

[0]
http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff;h=98d8891f42d8acac5c2ade39d163f386057a22e4
[1]
http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff;f=test/demo_forms.c;h=1e6806d2e52392926b9ad6ded2cc11ee58933113;hp=d20469460632ddeb2125ef6f73b6ca602f76fdc0;hb=HEAD;hpb=98d8891f42d8acac5c2ade39d163f386057a22e4



reply via email to

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