From cacd58d0362b26190df7cb1505ac1c75a41a45ab Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 30 Jul 2006 09:09:30 +0200 Subject: [PATCH] Fixed deleting the last character of a string menu item in insert mode --- CONTRIBUTORS | 1 + HISTORY | 2 ++ menuitems.c | 6 ++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b9b4809c..7cd104b0 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1452,6 +1452,7 @@ Udo Richter 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 for his help in keeping 'channels.conf.terr' up to date diff --git a/HISTORY b/HISTORY index af73d0f2..df5cfa7b 100644 --- a/HISTORY +++ b/HISTORY @@ -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). diff --git a/menuitems.c b/menuitems.c index cbfcf053..086668ee 100644 --- a/menuitems.c +++ b/menuitems.c @@ -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--;