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: Fri, 18 Jul 2014 13:35:50 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

Hi,

> There wasn't a demo/testcase to go with the patch, and though I made
> a note about it, was very busy at the time, and did not follow up.

I made a testcase to show the change [0]. We have two fields, one of
each type (static/dynamic). Both fields are not focussed (which is
required for justification to be in effect), yet only the static field
is actually rendered with alignment/justification. After applying my
patch both fields would be rendered exactly the same.
In my opinion they should be. A dynamic field limited in length by
set_max_field should behave like a static field with a static length
limit. This allows for more flexibility when a use case demands such a
switch (of input size limits).
As for the patch itself, the first part modifies the semantics of the
Justification_Allowed macro to also permit mentioned dynamic fields to
have a justification. The second part follows up on that and removes a
verification for the field being static. However when allowing dynamic
fields to justified we need to take new precautions since it can be
horizontally scrolled. Therefore we check if the field is horizontally
scrollable (or 'hidden parts' as called in ncurses). Only if the field
contents can be fully displayed inside the current dimensions of the
field a justification makes sense. Hence it will only then be applied.
The last part of the patch deals with the internal differences of both
the dynamic and static field in respect of their rendering propagation
to the parent object.

Best regards,
Leon

[0] see attachment, compile: cc main.c -lform -lncurses

Attachment: main.c
Description: Text Data


reply via email to

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