* fPreviousText can be NULL for views that don't have focus (ie. by using SetEventMask()).
* Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15059 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
82d8744887
commit
2c5ab65d23
@ -68,7 +68,7 @@ _BTextInput_::Instantiate(BMessage *archive)
|
||||
{
|
||||
if (validate_instantiation(archive, "_BTextInput_"))
|
||||
return new _BTextInput_(archive);
|
||||
else
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ _BTextInput_::KeyDown(const char* bytes, int32 numBytes)
|
||||
if (!TextControl()->IsEnabled())
|
||||
break;
|
||||
|
||||
if(strcmp(Text(), fPreviousText) != 0) {
|
||||
if (fPreviousText == NULL || strcmp(Text(), fPreviousText) != 0) {
|
||||
TextControl()->Invoke();
|
||||
free(fPreviousText);
|
||||
fPreviousText = strdup(Text());
|
||||
@ -211,11 +211,12 @@ _BTextInput_::InsertText(const char *inText, int32 inLength,
|
||||
if (buffer) {
|
||||
strcpy(buffer, inText);
|
||||
|
||||
for (int32 i = 0; i < inLength; i++)
|
||||
for (int32 i = 0; i < inLength; i++) {
|
||||
if (buffer[i] == '\r' || buffer[i] == '\n')
|
||||
buffer[i] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BTextView::InsertText(buffer ? buffer : inText, inLength, inOffset,
|
||||
inRuns);
|
||||
|
Loading…
Reference in New Issue
Block a user