Fixed a bug that I introduced with revision 1.9 when fixing the selection

deletion: you just couldn't delete over a ' ' with backspace...
Merged B_BACKSPACE and B_DELETE handling again.
Applied suggestions made by Stefano, like using ByteAt(x) over Text()[x].


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10464 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-12-15 14:03:56 +00:00
parent 5622a2e2c5
commit fc1658382d

View File

@ -174,38 +174,25 @@ FindTextView::KeyDown(const char *bytes, int32 numBytes)
break; break;
case B_BACKSPACE: case B_BACKSPACE:
{
int32 start, end;
GetSelection(&start, &end);
if (bytes[0] == B_BACKSPACE) {
if (--start < 0 && end == 0)
return;
start = 0;
}
if (Text()[start] == ' ')
BTextView::KeyDown(bytes, numBytes);
BTextView::KeyDown(bytes, numBytes);
GetSelection(&start, &end);
HexReformat(start, start);
Select(start, start);
return;
}
case B_DELETE: case B_DELETE:
{ {
int32 start, end; int32 start, end;
GetSelection(&start, &end); GetSelection(&start, &end);
if (Text()[start] == ' ') if (bytes[0] == B_BACKSPACE && --start < 0) {
if (end == 0)
return;
start = 0;
}
if (ByteAt(start) == ' ')
BTextView::KeyDown(bytes, numBytes); BTextView::KeyDown(bytes, numBytes);
BTextView::KeyDown(bytes, numBytes); BTextView::KeyDown(bytes, numBytes);
if (bytes[0] == B_BACKSPACE)
GetSelection(&start, &end);
HexReformat(start, start); HexReformat(start, start);
Select(start, start); Select(start, start);
return; return;