fix for Bug#:107494, when editting in IME mode, you cannot delete last uncommitted character. r=smfr; sr=kin; a=drivers

This commit is contained in:
jfrancis%netscape.com 2001-11-14 12:58:57 +00:00
Родитель 93e8c2bfd7
Коммит c076a6367a
1 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
@ -1098,8 +1098,17 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
if (aAction == kInsertTextIME)
{
nsWSRunObject wsObj(mHTMLEditor, selNode, selOffset);
res = wsObj.InsertText(*inString, address_of(selNode), &selOffset, doc);
// Right now the nsWSRunObject code bails on empty strings, but IME needs
// the InsertTextImpl() call to still happen since empty strings are meaningful there.
if (inString->IsEmpty())
{
res = mHTMLEditor->InsertTextImpl(*inString, address_of(selNode), &selOffset, doc);
}
else
{
nsWSRunObject wsObj(mHTMLEditor, selNode, selOffset);
res = wsObj.InsertText(*inString, address_of(selNode), &selOffset, doc);
}
if (NS_FAILED(res)) return res;
}
else // aAction == kInsertText