Klaus Schmidinger wrote: > I agree with the 'if...' part of your fix, but I don't like the > 'else...' part. > If I do just > [..] > it works as I would expect it. I know it looks a bit strange. But that way the delete key does nothing if the cursor is at the end of the string. In overwrite mode, the delete key continues to delete towards left if there are no chars on the right. By the way, in your short form, the inner if is not necessary any more: 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) + // in insert mode, deleting the last character replaces it with a blank to keep the cursor position + value[pos] = ' '; // reduce position, if we removed the last character if (pos == int(strlen(value))) pos--; Cheers, Udo