No longer displays the selection when the file size is 0.

Also fixed a possibly wrong cursor position in that case.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6782 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-02-27 21:35:23 +00:00
parent e27438edba
commit 11d0369852

View File

@ -306,7 +306,7 @@ DataView::ConvertLine(char *line, off_t offset, const uint8 *buffer, size_t size
void
DataView::Draw(BRect updateRect)
{
if (fData == NULL)
if (fData == NULL || fFileSize == 0)
return;
// ToDo: take "updateRect" into account!
@ -415,6 +415,9 @@ DataView::SelectionFrame(view_focus which, int32 start, int32 end)
void
DataView::DrawSelectionFrame(view_focus which)
{
if (fFileSize == 0)
return;
bool drawBlock = false;
bool drawLastLine = false;
BRect block, lastLine;
@ -529,6 +532,9 @@ DataView::DrawSelectionFrame(view_focus which)
void
DataView::DrawSelectionBlock(view_focus which)
{
if (fFileSize == 0)
return;
// draw first line
SetDrawingMode(B_OP_INVERT);
@ -586,14 +592,14 @@ DataView::SetSelection(int32 start, int32 end, view_focus focus)
end = temp;
}
if (start > (int32)fSizeInView - 1)
start = (int32)fSizeInView - 1;
if (start < 0)
start = 0;
else if (start > (int32)fSizeInView - 1)
start = (int32)fSizeInView - 1;
if (end > (int32)fSizeInView - 1)
end = (int32)fSizeInView - 1;
else if (end < 0)
if (end < 0)
end = 0;
if (fStart == start && fEnd == end) {