summaryrefslogtreecommitdiff
path: root/src/Fl_Text_Buffer.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2010-11-04 21:53:56 +0000
committerMatthias Melcher <fltk@matthiasm.com>2010-11-04 21:53:56 +0000
commit38dcb5a463e0b41e220c79ee85b5fd9cd2318c33 (patch)
tree651a89bda966f3ebbe657ce0ec553d33989ab5fa /src/Fl_Text_Buffer.cxx
parent644fe622830a2319e84bdb40282b65c4115ebe27 (diff)
Starting to rework Fl_Text_Display from scratch to make wrapping work correctly. Fixed a few issues that made wrapping crash. Using ASCII range only with fixed character sizes should still wrap as expected?!
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7794 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Text_Buffer.cxx')
-rw-r--r--src/Fl_Text_Buffer.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx
index cdd43e491..622ccd1ee 100644
--- a/src/Fl_Text_Buffer.cxx
+++ b/src/Fl_Text_Buffer.cxx
@@ -270,6 +270,10 @@ char Fl_Text_Buffer::byte_at(int pos) const {
*/
void Fl_Text_Buffer::insert(int pos, const char *text)
{
+ /* check if there is actually any text */
+ if (!text || !*text)
+ return;
+
/* if pos is not contiguous to existing text, make it */
if (pos > mLength)
pos = mLength;
@@ -1010,7 +1014,7 @@ int Fl_Text_Buffer::search_forward(int startPos, const char *searchString,
return 1;
}
// FIXME: character is ucs-4
- } while ((matchCase ? char_at(bp++) == *sp++ :
+ } while ((matchCase ? char_at(bp++) == (unsigned int)*sp++ :
toupper(char_at(bp++)) == toupper(*sp++))
&& bp < length());
startPos++;
@@ -1040,7 +1044,7 @@ int Fl_Text_Buffer::search_backward(int startPos, const char *searchString,
return 1;
}
// FIXME: character is ucs-4
- } while ((matchCase ? char_at(bp--) == *sp-- :
+ } while ((matchCase ? char_at(bp--) == (unsigned int)*sp-- :
toupper(char_at(bp--)) == toupper(*sp--))
&& bp >= 0);
startPos--;
@@ -1128,6 +1132,9 @@ int Fl_Text_Buffer::findchars_backward(int startPos, const char *searchChars,
*/
int Fl_Text_Buffer::insert_(int pos, const char *text)
{
+ if (!text || !*text)
+ return 0;
+
int insertedLength = strlen(text);
/* Prepare the buffer to receive the new text. If the new text fits in
@@ -1246,7 +1253,7 @@ int Fl_Text_Selection::position(int *startpos, int *endpos) const {
*/
int Fl_Text_Selection::includes(int pos) const {
return (selected() && pos >= start() && pos < end() );
- }
+}
/*