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