* 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:
@@ -68,8 +68,8 @@ _BTextInput_::Instantiate(BMessage *archive)
|
|||||||
{
|
{
|
||||||
if (validate_instantiation(archive, "_BTextInput_"))
|
if (validate_instantiation(archive, "_BTextInput_"))
|
||||||
return new _BTextInput_(archive);
|
return new _BTextInput_(archive);
|
||||||
else
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ _BTextInput_::KeyDown(const char* bytes, int32 numBytes)
|
|||||||
if (!TextControl()->IsEnabled())
|
if (!TextControl()->IsEnabled())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(strcmp(Text(), fPreviousText) != 0) {
|
if (fPreviousText == NULL || strcmp(Text(), fPreviousText) != 0) {
|
||||||
TextControl()->Invoke();
|
TextControl()->Invoke();
|
||||||
free(fPreviousText);
|
free(fPreviousText);
|
||||||
fPreviousText = strdup(Text());
|
fPreviousText = strdup(Text());
|
||||||
@@ -201,7 +201,7 @@ _BTextInput_::Paste(BClipboard *clipboard)
|
|||||||
|
|
||||||
void
|
void
|
||||||
_BTextInput_::InsertText(const char *inText, int32 inLength,
|
_BTextInput_::InsertText(const char *inText, int32 inLength,
|
||||||
int32 inOffset, const text_run_array *inRuns)
|
int32 inOffset, const text_run_array *inRuns)
|
||||||
{
|
{
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
|
|
||||||
@@ -211,9 +211,10 @@ _BTextInput_::InsertText(const char *inText, int32 inLength,
|
|||||||
if (buffer) {
|
if (buffer) {
|
||||||
strcpy(buffer, inText);
|
strcpy(buffer, inText);
|
||||||
|
|
||||||
for (int32 i = 0; i < inLength; i++)
|
for (int32 i = 0; i < inLength; i++) {
|
||||||
if (buffer[i] == '\r' || buffer[i] == '\n')
|
if (buffer[i] == '\r' || buffer[i] == '\n')
|
||||||
buffer[i] = ' ';
|
buffer[i] = ' ';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user