Fixed deleting the last character of a string menu item in insert mode

This commit is contained in:
Klaus Schmidinger 2006-07-30 09:09:30 +02:00
parent cdad4a6b4e
commit cacd58d036
3 changed files with 7 additions and 2 deletions

View File

@ -1452,6 +1452,7 @@ Udo Richter <udo_richter@gmx.de>
for adding "-fPIC" to the compiler options in Make.config.template when compiling
plugins
for reporting a missing '--vfat' in the vdr.1 man page
for fixing deleting the last character of a string menu item in insert mode
Sven Kreiensen <svenk@kammer.uni-hannover.de>
for his help in keeping 'channels.conf.terr' up to date

View File

@ -4842,3 +4842,5 @@ Video Disk Recorder Revision History
- Increased the APIVERSION to allow plugins that relied on the cStatus::MsgSetVolume()
bug to react properly (suggested by Stefan Huelswitt).
- Fixed cDevice::ToggleMute() (thanks to Christoph Haubrich).
- Fixed deleting the last character of a string menu item in insert mode (thanks
to Udo Richter).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menuitems.c 1.46 2006/07/23 09:42:17 kls Exp $
* $Id: menuitems.c 1.47 2006/07/30 09:09:30 kls Exp $
*/
#include "menuitems.h"
@ -313,7 +313,7 @@ void cMenuEditStrItem::Set(void)
SetValue(buf);
return;
}
width -= font->Width('>'); // assuming '<' and '>' have the same with
width -= font->Width('>'); // assuming '<' and '>' have the same width
int w = 0;
int i = 0;
int l = strlen(buf);
@ -395,6 +395,8 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
if (strlen(value) > 1) {
if (!insert || pos < int(strlen(value)) - 1)
memmove(value + pos, value + pos + 1, strlen(value) - pos);
else if (insert && pos == int(strlen(value)) - 1)
value[pos] = ' '; // in insert mode, deleting the last character replaces it with a blank to keep the cursor position
// reduce position, if we removed the last character
if (pos == int(strlen(value)))
pos--;