diff options
author | Oliver Kiehl | 2003-01-10 21:33:42 +0000 |
---|---|---|
committer | Oliver Kiehl | 2003-01-10 21:33:42 +0000 |
commit | ebdf89e4184240a752061c7c8d5450dbca809f39 (patch) | |
tree | 6fe9fe552feb98eccfe2c2b7a4d7945e560daf26 /common/str.cpp | |
parent | 23a02b712a83ddd4759dd9158dc470f7f3742dfc (diff) | |
download | scummvm-rg350-ebdf89e4184240a752061c7c8d5450dbca809f39.tar.gz scummvm-rg350-ebdf89e4184240a752061c7c8d5450dbca809f39.tar.bz2 scummvm-rg350-ebdf89e4184240a752061c7c8d5450dbca809f39.zip |
Added some basic line editing to the EditText widget
svn-id: r6393
Diffstat (limited to 'common/str.cpp')
-rw-r--r-- | common/str.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp index e8e73a32a2..ffb8c298b0 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -160,6 +160,16 @@ void String::deleteLastChar() { } } +void String::deleteChar(int p) +{ + if (p >= 0 && p < _len) { + ensureCapacity(_len - 1, true); + while (p++ < _len) + _str[p-1] = _str[p]; + _len--; + } +} + void String::clear() { if (_capacity) { @@ -172,6 +182,17 @@ void String::clear() } } +void String::insertChar(char c, int p) +{ + if (p >= 0 && p <= _len) { + ensureCapacity(++_len, true); + for (int i = _len; i > p; i--) { + _str[i] = _str[i-1]; + } + _str[p] = c; + } +} + void String::toLowercase() { if (_str == 0 || _len == 0) |