little bug in cMenuEditStrItem?
Commit Message
Markus Hahn wrote:
> Hi everybody,
>
> the issue is found in SetupRecordings->Name instant recording:
> If I edit the item an press enter to confirm the change I stay
> in the actuall menu, editing mode ist off.
> On the other hand, if I do not confirm the change an go
> out with kBack I the menu goes to the last parent menu.
>
> I think kBack should make the same like kOK without
> remember the changes.
You're absolutely right.
The attached patch should fix this.
Klaus
Comments
Klaus Schmidinger wrote:
> You're absolutely right.
>
> The attached patch should fix this.
> ------------------------------------------------------------------------
>
> --- menuitems.h 2006/01/21 10:45:55 1.16
> +++ menuitems.h 2006/02/12 10:22:03
> @@ -77,6 +77,7 @@
2# patch -p0 <vdr-1.3.42-editstrkback.diff
(Stripping trailing CRs from patch.)
patching file menuitems.h
Hunk #1 succeeded at 65 with fuzz 2 (offset -12 lines).
(Stripping trailing CRs from patch.)
patching file menuitems.c
menuitems.c:242: error: `orgValue' was not declared in this scope
menuitems.c:242: warning: unused variable 'orgValue'
menuitems.c: In destructor `virtual cMenuEditStrItem::~cMenuEditStrItem()':
menuitems.c:257: error: `orgValue' was not declared in this scope
menuitems.c:257: warning: unused variable 'orgValue'
menuitems.c: In member function `virtual eOSState
cMenuEditStrItem::ProcessKey(eKeys)':
menuitems.c:415: error: `orgValue' was not declared in this scope
menuitems.c:415: warning: unused variable 'orgValue'
menuitems.c:478: error: `orgValue' was not declared in this scope
make: *** [menuitems.o] Error 1
Suur Karu wrote:
> Klaus Schmidinger wrote:
>
>> You're absolutely right.
>>
>> The attached patch should fix this.
>> ------------------------------------------------------------------------
>>
>> --- menuitems.h 2006/01/21 10:45:55 1.16
>> +++ menuitems.h 2006/02/12 10:22:03
>> @@ -77,6 +77,7 @@
>
>
> 2# patch -p0 <vdr-1.3.42-editstrkback.diff
> (Stripping trailing CRs from patch.)
> patching file menuitems.h
> Hunk #1 succeeded at 65 with fuzz 2 (offset -12 lines).
> (Stripping trailing CRs from patch.)
> patching file menuitems.c
>
>
>
> menuitems.c:242: error: `orgValue' was not declared in this scope
> menuitems.c:242: warning: unused variable 'orgValue'
> menuitems.c: In destructor `virtual cMenuEditStrItem::~cMenuEditStrItem()':
> menuitems.c:257: error: `orgValue' was not declared in this scope
> menuitems.c:257: warning: unused variable 'orgValue'
> menuitems.c: In member function `virtual eOSState
> cMenuEditStrItem::ProcessKey(eKeys)':
> menuitems.c:415: error: `orgValue' was not declared in this scope
> menuitems.c:415: warning: unused variable 'orgValue'
> menuitems.c:478: error: `orgValue' was not declared in this scope
> make: *** [menuitems.o] Error 1
Are you sure you're applying this patch to VDR version 1.3.42?
Klaus
Klaus Schmidinger wrote:
> Are you sure you're applying this patch to VDR version 1.3.42?
>
Absolutely:
root@vdr:/usr/local/vdr-1.3.42# pwd
/usr/local/vdr-1.3.42
root@vdr:/usr/local/vdr-1.3.42# patch -p0 <vdr-1.3.42-editstrkback.diff
(Stripping trailing CRs from patch.)
patching file menuitems.h
Hunk #1 succeeded at 65 with fuzz 2 (offset -12 lines).
(Stripping trailing CRs from patch.)
patching file menuitems.c
Not very vanilla vdr, but i think it is not important there.
gcc version 3.4.5
Regards,
SK
Suur Karu wrote:
> Klaus Schmidinger wrote:
>
>> Are you sure you're applying this patch to VDR version 1.3.42?
>>
>
> Absolutely:
>
> root@vdr:/usr/local/vdr-1.3.42# pwd
> /usr/local/vdr-1.3.42
>
> root@vdr:/usr/local/vdr-1.3.42# patch -p0 <vdr-1.3.42-editstrkback.diff
> (Stripping trailing CRs from patch.)
> patching file menuitems.h
> Hunk #1 succeeded at 65 with fuzz 2 (offset -12 lines).
> (Stripping trailing CRs from patch.)
> patching file menuitems.c
>
>
> Not very vanilla vdr, but i think it is not important there.
> gcc version 3.4.5
Well, it compiles here just fine.
Could you try with plain vanilla VDR 1.3.42?
Klaus
Klaus Schmidinger wrote:
> Could you try with plain vanilla VDR 1.3.42?
>
Yes, vanilla OK.
I will try to found, where problem is.
Thanks.
@@ -77,6 +77,7 @@
class cMenuEditStrItem : public cMenuEditItem {
private:
+ char *orgValue;
char *value;
int length;
char *allowed;
@@ -239,6 +239,7 @@
cMenuEditStrItem::cMenuEditStrItem(const char *Name, char *Value, int Length, const char *Allowed)
:cMenuEditItem(Name)
{
+ orgValue = NULL;
value = Value;
length = Length;
allowed = strdup(Allowed);
@@ -253,6 +254,7 @@
cMenuEditStrItem::~cMenuEditStrItem()
{
+ free(orgValue);
free(allowed);
}
@@ -409,8 +411,10 @@
break;
case kRight|k_Repeat:
case kRight: AdvancePos();
- if (pos == 0)
+ if (pos == 0) {
+ orgValue = strdup(value);
SetHelpKeys();
+ }
break;
case kUp|k_Repeat:
case kUp:
@@ -469,7 +473,13 @@
return cMenuEditItem::ProcessKey(Key);
}
break;
+ case kBack:
case kOk: if (InEditMode()) {
+ if (Key == kBack && orgValue) {
+ strcpy(value, orgValue);
+ free(orgValue);
+ orgValue = NULL;
+ }
pos = -1;
newchar = true;
stripspace(value);