[1.3.40] String edit insert mode broken

Message ID 43E4A2B0.7050100@cadsoft.de
State New
Headers

Commit Message

Klaus Schmidinger Feb. 4, 2006, 12:48 p.m. UTC
  Udo Richter wrote:
> Hi list,
> 
> In 1.3.40 and 1.3.41, the arrow key insert mode of edit fields is 
> broken. It inserts a new char after each up/down press.
> 
> Steps:
> - Go to some edit field (timer name etc) and start editing
> - Press 'green' for insert mode
> - Press 'up' several times
> Result: aaaaa inserted
> 
> The attached patch fixes this for now, though its a bit ugly.
> Simply setting newchar = false like in 1.3.39 now activates the 
> auto-advance timer without setting it, so it advances soon. (I guess 
> this is not expected, though I could get used to it.)

How about the attached patch?

Klaus
  

Comments

Udo Richter Feb. 4, 2006, 2:55 p.m. UTC | #1
Klaus Schmidinger wrote:
> Udo Richter wrote:
>> In 1.3.40 and 1.3.41, the arrow key insert mode of edit fields is 
>> broken. It inserts a new char after each up/down press.
> 
> How about the attached patch?

Works fine for me.

Cheers,

Udo
  

Patch

--- menuitems.c	2006/01/21 12:27:14	1.30
+++ menuitems.c	2006/02/04 12:47:08
@@ -345,7 +345,7 @@ 
   bool SameKey = Key == lastKey;
   if (Key != kNone)
      lastKey = Key;
-  else if (!newchar && autoAdvanceTimeout.TimedOut()) {
+  else if (!newchar && k0 <= NORMALKEY(lastKey) && NORMALKEY(lastKey) <= k9 && autoAdvanceTimeout.TimedOut()) {
      AdvancePos();
      newchar = true;
      currentChar = NULL;
@@ -427,7 +427,7 @@ 
                        value[pos] = toupper(Inc(tolower(value[pos]), NORMALKEY(Key) == kUp));
                     else
                        value[pos] =         Inc(        value[pos],  NORMALKEY(Key) == kUp);
-                    newchar = true;
+                    newchar = false;
                     }
                  else
                     return cMenuEditItem::ProcessKey(Key);