Tweak removeWord code to make it work for text editors and make more sense
This commit is contained in:
@@ -867,10 +867,10 @@ void LLLineEditor::removeChar()
|
||||
// Remove a word (set of characters up to next space/punctuation) from the text
|
||||
void LLLineEditor::removeWord(bool prev)
|
||||
{
|
||||
const U32 pos(getCursor());
|
||||
if (prev ? pos > 0 : static_cast<S32>(pos) < getLength())
|
||||
const S32& pos(mCursorPos);
|
||||
if (prev ? pos > 0 : pos < getLength())
|
||||
{
|
||||
U32 new_pos(prev ? prevWordPos(pos) : nextWordPos(pos));
|
||||
S32 new_pos(prev ? prevWordPos(pos) : nextWordPos(pos));
|
||||
if (new_pos == pos) // Other character we don't jump over
|
||||
new_pos = prev ? prevWordPos(new_pos-1) : nextWordPos(new_pos+1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user