From fc1658382d8acc8ce9b7392f165c2c5e78d07aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 15 Dec 2004 14:03:56 +0000 Subject: [PATCH] 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 --- src/apps/diskprobe/FindWindow.cpp | 33 ++++++++++--------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/src/apps/diskprobe/FindWindow.cpp b/src/apps/diskprobe/FindWindow.cpp index 066b6fa95e..dc6d976bb6 100644 --- a/src/apps/diskprobe/FindWindow.cpp +++ b/src/apps/diskprobe/FindWindow.cpp @@ -174,38 +174,25 @@ FindTextView::KeyDown(const char *bytes, int32 numBytes) break; 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: { int32 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); + if (bytes[0] == B_BACKSPACE) + GetSelection(&start, &end); + HexReformat(start, start); Select(start, start); return;