Quick fix to prevent the terminal from crashing in case it got a message
with mouse coordinates outside the window (yeah, it has been written that bad). Need to rewrite the whole mouse handling, though... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15152 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
39b345c7b6
commit
498cd44c3a
@ -96,17 +96,18 @@ TermBuffer::TermBuffer(int rows, int cols)
|
||||
mRowSize = rows;
|
||||
|
||||
mRowOffset = 0;
|
||||
|
||||
|
||||
//buffer_size = ARRAY_SIZE;
|
||||
buffer_size = gTermPref->getInt32 (PREF_HISTORY_SIZE);
|
||||
|
||||
|
||||
// Allocate buffer
|
||||
mBase = (term_buffer**) malloc (sizeof (term_buffer*) * buffer_size);
|
||||
|
||||
for(int i = 0; i < buffer_size; i++)
|
||||
|
||||
for (int i = 0; i < buffer_size; i++)
|
||||
mBase[i] = (term_buffer *) calloc (mColSize + 1, sizeof (term_buffer));
|
||||
}
|
||||
|
||||
|
||||
TermBuffer::~TermBuffer()
|
||||
{
|
||||
for(int i = 0; i < buffer_size; i++)
|
||||
@ -115,26 +116,29 @@ TermBuffer::~TermBuffer()
|
||||
free(mBase);
|
||||
}
|
||||
|
||||
// Gets a character from TermBuffer
|
||||
|
||||
//! Gets a character from TermBuffer
|
||||
int
|
||||
TermBuffer::GetChar (int row, int col, uchar *buf, ushort *attr)
|
||||
TermBuffer::GetChar(int row, int col, uchar *buf, ushort *attr)
|
||||
{
|
||||
term_buffer *ptr;
|
||||
|
||||
ptr = (mBase[row % buffer_size] + col);
|
||||
|
||||
if (row < 0 || col < 0)
|
||||
return -1;
|
||||
|
||||
term_buffer *ptr = (mBase[row % buffer_size] + col);
|
||||
|
||||
if (ptr->status == A_CHAR)
|
||||
memcpy (buf, (char *)(ptr->code), 4);
|
||||
|
||||
memcpy(buf, (char *)(ptr->code), 4);
|
||||
|
||||
*attr = ptr->attr;
|
||||
|
||||
|
||||
return ptr->status;
|
||||
}
|
||||
|
||||
// Get a string (length = num) from given position.
|
||||
|
||||
//! Get a string (length = num) from given position.
|
||||
int
|
||||
TermBuffer::GetString (int row, int col, int num, uchar *buf,
|
||||
ushort *attr)
|
||||
TermBuffer::GetString(int row, int col, int num, uchar *buf,
|
||||
ushort *attr)
|
||||
{
|
||||
int count = 0, all_count = 0;
|
||||
term_buffer *ptr;
|
||||
|
@ -904,7 +904,9 @@ TermView::MouseTracking(void *data)
|
||||
}
|
||||
|
||||
edpos = theObj->BPointToCurPos(edpoint);
|
||||
|
||||
if (edpos.y < 0)
|
||||
continue;
|
||||
|
||||
if(stpoint == edpoint) {
|
||||
continue;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user