No longer ignores the text that comes with a confirmed B_INPUT_METHOD_CHANGED

event; it now only deactivates the inline in that case.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19115 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-10-24 23:20:20 +00:00
parent 79372d08b0
commit 3956f772e1

View File

@ -4337,37 +4337,37 @@ BTextView::HandleInputMethodChanged(BMessage *message)
// TODO: block input if not editable (Andrew) // TODO: block input if not editable (Andrew)
if (!fInline) if (!fInline)
return; return;
const char *string = NULL; const char *string = NULL;
if (message->FindString("be:string", &string) < B_OK || string == NULL) if (message->FindString("be:string", &string) < B_OK || string == NULL)
return; return;
be_app->ObscureCursor(); be_app->ObscureCursor();
// If we find the "be:confirmed" boolean (and the boolean is true), // If we find the "be:confirmed" boolean (and the boolean is true),
// it means it's over for now, so the current _BInlineInput_ object // it means it's over for now, so the current _BInlineInput_ object
// should become inactive. We will probably receive a B_INPUT_METHOD_STOPPED // should become inactive. We will probably receive a B_INPUT_METHOD_STOPPED
// message after this one. // message after this one.
bool confirmed = false; bool confirmed;
if (message->FindBool("be:confirmed", &confirmed) == B_OK && confirmed) { if (message->FindBool("be:confirmed", &confirmed) != B_OK)
fInline->SetActive(false); confirmed = false;
Refresh(0, fInline->Offset() + fInline->Length(), true, false);
return;
}
// Delete the previously inserted text (if any) // Delete the previously inserted text (if any)
if (fInline->IsActive()) { if (fInline->IsActive()) {
int32 oldOffset = fInline->Offset(); int32 oldOffset = fInline->Offset();
DeleteText(oldOffset, oldOffset + fInline->Length()); DeleteText(oldOffset, oldOffset + fInline->Length());
fClickOffset = fSelStart = fSelEnd = oldOffset; fClickOffset = fSelStart = fSelEnd = oldOffset;
if (confirmed)
fInline->SetActive(false);
} }
int32 stringLen = strlen(string); int32 stringLen = strlen(string);
fInline->SetOffset(fSelStart); fInline->SetOffset(fSelStart);
fInline->SetLength(stringLen); fInline->SetLength(stringLen);
fInline->ResetClauses(); fInline->ResetClauses();
// Get the clauses, and pass them to the _BInlineInput_ object // Get the clauses, and pass them to the _BInlineInput_ object
// TODO: Find out if what we did it's ok, currently we don't consider clauses // TODO: Find out if what we did it's ok, currently we don't consider clauses
// at all, while the bebook says we should; though the visual effect we obtained // at all, while the bebook says we should; though the visual effect we obtained
@ -4380,21 +4380,21 @@ BTextView::HandleInputMethodChanged(BMessage *message)
fInline->AddClause(clauseStart, clauseEnd); fInline->AddClause(clauseStart, clauseEnd);
clauseCount++; clauseCount++;
} }
int32 selectionStart = 0; int32 selectionStart = 0;
int32 selectionEnd = 0; int32 selectionEnd = 0;
message->FindInt32("be:selection", 0, &selectionStart); message->FindInt32("be:selection", 0, &selectionStart);
message->FindInt32("be:selection", 1, &selectionEnd); message->FindInt32("be:selection", 1, &selectionEnd);
fInline->SetSelectionOffset(selectionStart); fInline->SetSelectionOffset(selectionStart);
fInline->SetSelectionLength(selectionEnd - selectionStart); fInline->SetSelectionLength(selectionEnd - selectionStart);
// Insert the new text // Insert the new text
InsertText(string, stringLen, fSelStart, NULL); InsertText(string, stringLen, fSelStart, NULL);
fSelStart += stringLen; fSelStart += stringLen;
fClickOffset = fSelEnd = fSelStart; fClickOffset = fSelEnd = fSelStart;
if (!fInline->IsActive()) if (!confirmed && !fInline->IsActive())
fInline->SetActive(true); fInline->SetActive(true);
Refresh(fInline->Offset(), fSelEnd, true, false); Refresh(fInline->Offset(), fSelEnd, true, false);