neu-rah / ArduinoMenu

Arduino generic menu/interactivity system
GNU Lesser General Public License v2.1
951 stars 191 forks source link

in the EDIT(Text edit field) the cursor still choose constants that we defined in the validator array which is not changeable. #247

Open HamidSaffari opened 5 years ago

HamidSaffari commented 5 years ago

Hi, Greeting. Consider this example: " char const hexDigit PROGMEM="0123456789ABCDEF";//allowed hexadecimal digits char const hexNr[] PROGMEM={"0","x",hexDigit,hexDigit};//validators char buf1[]="0x11";//the edit target buffer ... EDIT("Hex",buf1,hexNr,doNothing,noEvent,noStyle) " the cursor still choose constants that we defined in the validator array which is not changeable. I think when editing if the cursor jumps "0","x" in above example it's better.

neu-rah commented 5 years ago

Hi! indeed, one could make 0x part of the title text and let only the digits be editable, or drop the 0x part. Its not practical as an hex edit, but it demonstrates character masking... making cursor skip those (single choice) chars (or cursor navigation skip disabled items) its interesting and very useful, it would however grow the already big code base. Some users (and myself) complain about lack of space on small MCU's, so this might be better implemented as a plugin (by deriving the existing class and twist its behavior), so that only users that want/need and can afford the features would use.

on the implementation part, character mask length has to be checked and position changed if single masked, it has to be changed on the edit direction, we have to account with the possibility of not having more editable characters on that direction and revert it... and eventually face an "edit" field with no editable chars as an extreme case.