|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2001-2005, Haiku, Inc.
|
|
|
|
|
* Copyright (c) 2001-2006, Haiku, Inc.
|
|
|
|
|
* Copyright (c) 2003-4 Kian Duffy <[email protected]>
|
|
|
|
|
* Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
|
|
|
|
|
* Distributed under the terms of the MIT license.
|
|
|
|
@@ -91,29 +91,39 @@ extern PrefHandler *gTermPref;
|
|
|
|
|
|
|
|
|
|
TermBuffer::TermBuffer(int rows, int cols)
|
|
|
|
|
{
|
|
|
|
|
if (rows < 1)
|
|
|
|
|
rows = 1;
|
|
|
|
|
if (cols < MIN_COLS)
|
|
|
|
|
cols = MIN_COLS;
|
|
|
|
|
else if (cols > MAX_COLS)
|
|
|
|
|
cols = MAX_COLS;
|
|
|
|
|
|
|
|
|
|
mColSize = MAX_COLS;
|
|
|
|
|
mNowColSize = cols;
|
|
|
|
|
mRowSize = rows;
|
|
|
|
|
|
|
|
|
|
mRowOffset = 0;
|
|
|
|
|
|
|
|
|
|
//buffer_size = ARRAY_SIZE;
|
|
|
|
|
buffer_size = gTermPref->getInt32 (PREF_HISTORY_SIZE);
|
|
|
|
|
buffer_size = gTermPref->getInt32(PREF_HISTORY_SIZE);
|
|
|
|
|
if (buffer_size < 1000)
|
|
|
|
|
buffer_size = 1000;
|
|
|
|
|
|
|
|
|
|
// Allocate buffer
|
|
|
|
|
mBase = (term_buffer**) malloc (sizeof (term_buffer*) * buffer_size);
|
|
|
|
|
mBase = (term_buffer**)malloc(sizeof(term_buffer*) * buffer_size);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < buffer_size; i++)
|
|
|
|
|
mBase[i] = (term_buffer *) calloc (mColSize + 1, sizeof (term_buffer));
|
|
|
|
|
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++)
|
|
|
|
|
free (mBase[i]);
|
|
|
|
|
for (int i = 0; i < buffer_size; i++) {
|
|
|
|
|
free(mBase[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(mBase);
|
|
|
|
|
free(mBase);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -148,7 +158,6 @@ TermBuffer::GetString(int row, int col, int num, uchar *buf,
|
|
|
|
|
*attr = ptr->attr;
|
|
|
|
|
|
|
|
|
|
if (ptr->status == NO_CHAR) {
|
|
|
|
|
|
|
|
|
|
// Buffer is empty and No selected by mouse.
|
|
|
|
|
do {
|
|
|
|
|
if (col >= mNowColSize)
|
|
|
|
@@ -162,24 +171,23 @@ TermBuffer::GetString(int row, int col, int num, uchar *buf,
|
|
|
|
|
|
|
|
|
|
if (mSelStart.y == row) {
|
|
|
|
|
if (col == mSelStart.x)
|
|
|
|
|
return count;
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mSelEnd.y == row) {
|
|
|
|
|
if (col - 1 == mSelEnd.x)
|
|
|
|
|
return count;
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
}while (col <= num);
|
|
|
|
|
} while (col <= num);
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
else if (IS_WIDTH(ptr->attr)) {
|
|
|
|
|
memcpy (buf, (char *)ptr->code, 4);
|
|
|
|
|
} else if (IS_WIDTH(ptr->attr)) {
|
|
|
|
|
memcpy(buf, (char *)ptr->code, 4);
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (col <= num) {
|
|
|
|
|
memcpy (buf, ptr->code, 4);
|
|
|
|
|
memcpy(buf, ptr->code, 4);
|
|
|
|
|
all_count++;
|
|
|
|
|
|
|
|
|
|
if (*buf == 0) {
|
|
|
|
@@ -187,9 +195,9 @@ TermBuffer::GetString(int row, int col, int num, uchar *buf,
|
|
|
|
|
*(buf + 1) = '\0';
|
|
|
|
|
}
|
|
|
|
|
if (ptr->attr != (ptr + 1)->attr)
|
|
|
|
|
return all_count;
|
|
|
|
|
return all_count;
|
|
|
|
|
|
|
|
|
|
buf = (uchar *)index ((char *)buf, 0x00);
|
|
|
|
|
buf = (uchar *)index((char *)buf, 0x00);
|
|
|
|
|
ptr++;
|
|
|
|
|
col++;
|
|
|
|
|
|
|
|
|
@@ -206,9 +214,10 @@ TermBuffer::GetString(int row, int col, int num, uchar *buf,
|
|
|
|
|
return all_count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Write a character at the cursor point.
|
|
|
|
|
|
|
|
|
|
//! Write a character at the cursor point.
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::WriteChar (const CurPos &pos, const uchar *u, ushort attr)
|
|
|
|
|
TermBuffer::WriteChar(const CurPos &pos, const uchar *u, ushort attr)
|
|
|
|
|
{
|
|
|
|
|
term_buffer *ptr;
|
|
|
|
|
|
|
|
|
@@ -225,9 +234,10 @@ TermBuffer::WriteChar (const CurPos &pos, const uchar *u, ushort attr)
|
|
|
|
|
ptr->attr = attr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Write CR status to buffer attribute.
|
|
|
|
|
|
|
|
|
|
//! Write CR status to buffer attribute.
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::WriteCR (const CurPos &pos)
|
|
|
|
|
TermBuffer::WriteCR(const CurPos &pos)
|
|
|
|
|
{
|
|
|
|
|
int row = pos.y;
|
|
|
|
|
int col = pos.x;
|
|
|
|
@@ -237,20 +247,22 @@ TermBuffer::WriteCR (const CurPos &pos)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Insert 'num' spaces at cursor point.
|
|
|
|
|
//! Insert 'num' spaces at cursor point.
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::InsertSpace (const CurPos &pos, int num)
|
|
|
|
|
TermBuffer::InsertSpace(const CurPos &pos, int num)
|
|
|
|
|
{
|
|
|
|
|
const int row = pos.y;
|
|
|
|
|
const int col = pos.x;
|
|
|
|
|
|
|
|
|
|
for (int i = mNowColSize - num; i >= col; i--)
|
|
|
|
|
for (int i = mNowColSize - num; i >= col; i--) {
|
|
|
|
|
*(mBase[ROW(row)] + i + num) = *(mBase[ROW(row)] + i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memset(mBase[ROW(row)] + col, 0, num * sizeof(term_buffer));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Delete 'num' characters at cursor point.
|
|
|
|
|
|
|
|
|
|
//! Delete 'num' characters at cursor point.
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::DeleteChar(const CurPos &pos, int num)
|
|
|
|
|
{
|
|
|
|
@@ -260,88 +272,90 @@ TermBuffer::DeleteChar(const CurPos &pos, int num)
|
|
|
|
|
term_buffer *ptr = mBase[ROW(row)];
|
|
|
|
|
size_t movesize = mNowColSize - (col + num);
|
|
|
|
|
|
|
|
|
|
memmove (ptr + col, ptr + col + num, movesize * sizeof(term_buffer));
|
|
|
|
|
memset (ptr + (mNowColSize - num), 0, num * sizeof(term_buffer));
|
|
|
|
|
memmove(ptr + col, ptr + col + num, movesize * sizeof(term_buffer));
|
|
|
|
|
memset(ptr + (mNowColSize - num), 0, num * sizeof(term_buffer));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Erase characters below cursor position.
|
|
|
|
|
|
|
|
|
|
//! Erase characters below cursor position.
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::EraseBelow(const CurPos &pos)
|
|
|
|
|
{
|
|
|
|
|
const int row = pos.y;
|
|
|
|
|
const int col = pos.x;
|
|
|
|
|
|
|
|
|
|
memset (mBase[ROW(row)] + col, 0, (mColSize - col ) * sizeof (term_buffer));
|
|
|
|
|
memset(mBase[ROW(row)] + col, 0, (mColSize - col ) * sizeof(term_buffer));
|
|
|
|
|
|
|
|
|
|
for (int i = row; i < mRowSize; i++)
|
|
|
|
|
EraseLine (i);
|
|
|
|
|
for (int i = row; i < mRowSize; i++) {
|
|
|
|
|
EraseLine(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Scroll the terminal buffer region
|
|
|
|
|
|
|
|
|
|
//! Scroll the terminal buffer region
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::ScrollRegion(int top, int bot, int dir, int num)
|
|
|
|
|
{
|
|
|
|
|
if(dir == SCRUP) {
|
|
|
|
|
for(int i = 0; i < num; i++){
|
|
|
|
|
|
|
|
|
|
if (dir == SCRUP) {
|
|
|
|
|
for (int i = 0; i < num; i++) {
|
|
|
|
|
term_buffer *ptr = mBase[ROW(top)];
|
|
|
|
|
|
|
|
|
|
for(int j = top; j < bot; j++)
|
|
|
|
|
for (int j = top; j < bot; j++) {
|
|
|
|
|
mBase[ROW(j)] = mBase[ROW(j+1)];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mBase[ROW(bot)] = ptr;
|
|
|
|
|
|
|
|
|
|
EraseLine(bot);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// scroll up
|
|
|
|
|
for(int i = 0; i < num; i++){
|
|
|
|
|
for (int i = 0; i < num; i++) {
|
|
|
|
|
term_buffer *ptr = mBase[ROW(bot)];
|
|
|
|
|
|
|
|
|
|
for(int j = bot; j > top; j--)
|
|
|
|
|
for (int j = bot; j > top; j--) {
|
|
|
|
|
mBase[ROW(j)] = mBase[ROW(j-1)];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mBase[ROW(top)] = ptr;
|
|
|
|
|
|
|
|
|
|
EraseLine(top);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Scroll the terminal buffer.
|
|
|
|
|
|
|
|
|
|
//! Scroll the terminal buffer.
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::ScrollLine(void)
|
|
|
|
|
TermBuffer::ScrollLine()
|
|
|
|
|
{
|
|
|
|
|
for (int i = mRowSize; i < mRowSize * 2; i++)
|
|
|
|
|
EraseLine (i);
|
|
|
|
|
for (int i = mRowSize; i < mRowSize * 2; i++) {
|
|
|
|
|
EraseLine(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mRowOffset++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Resize the terminal buffer.
|
|
|
|
|
|
|
|
|
|
//! Resize the terminal buffer.
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::ResizeTo(int newRows, int newCols, int offset)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
// TODO: Why is this code #if 0'd? It should either be fixed or removed
|
|
|
|
|
#if 0
|
|
|
|
|
if (newCols > mColSize) {
|
|
|
|
|
for (i = 0; i < buffer_size; i++) {
|
|
|
|
|
mBase[i] = (ulong *) realloc (mBase[i], sizeof(ulong) * newCols);
|
|
|
|
|
base = mBase[i] + mColSize;
|
|
|
|
|
for (j= 0; j < newCols - mColSize; j++)
|
|
|
|
|
*base++ = 0;
|
|
|
|
|
}
|
|
|
|
|
mColSize = newCols;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
if ( newRows <= mRowSize) {
|
|
|
|
|
// make sure the new size is within the allowed limits
|
|
|
|
|
if (newRows < 1)
|
|
|
|
|
newRows = 1;
|
|
|
|
|
|
|
|
|
|
if (newCols < MIN_COLS)
|
|
|
|
|
newCols = MIN_COLS;
|
|
|
|
|
else if (newCols > MAX_COLS)
|
|
|
|
|
newCols = MAX_COLS;
|
|
|
|
|
|
|
|
|
|
if (newRows <= mRowSize) {
|
|
|
|
|
for (i = newRows; i <= mRowSize; i++)
|
|
|
|
|
EraseLine (i);
|
|
|
|
|
EraseLine(i);
|
|
|
|
|
} else {
|
|
|
|
|
for (i = mRowSize; i <= newRows * 2; i++)
|
|
|
|
|
EraseLine (i);
|
|
|
|
|
for (i = mRowSize; i <= newRows * 2; i++)
|
|
|
|
|
EraseLine(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mNowColSize = newCols;
|
|
|
|
@@ -349,32 +363,36 @@ TermBuffer::ResizeTo(int newRows, int newCols, int offset)
|
|
|
|
|
mRowSize = newRows;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get the buffer's size.
|
|
|
|
|
|
|
|
|
|
//! Get the buffer's size.
|
|
|
|
|
int32
|
|
|
|
|
TermBuffer::GetArraySize (void)
|
|
|
|
|
TermBuffer::GetArraySize()
|
|
|
|
|
{
|
|
|
|
|
return buffer_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Erase one column.
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::EraseLine (int row)
|
|
|
|
|
TermBuffer::EraseLine(int row)
|
|
|
|
|
{
|
|
|
|
|
memset (mBase[ROW(row)], 0, mColSize * sizeof (term_buffer));
|
|
|
|
|
memset(mBase[ROW(row)], 0, mColSize * sizeof(term_buffer));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Clear the contents of the TermBuffer.
|
|
|
|
|
|
|
|
|
|
//! Clear the contents of the TermBuffer.
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::ClearAll (void)
|
|
|
|
|
TermBuffer::ClearAll()
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < buffer_size; i++)
|
|
|
|
|
memset (mBase[i], 0, mColSize * sizeof (term_buffer));
|
|
|
|
|
for (int i = 0; i < buffer_size; i++) {
|
|
|
|
|
memset(mBase[i], 0, mColSize * sizeof(term_buffer));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mRowOffset = 0;
|
|
|
|
|
DeSelect ();
|
|
|
|
|
DeSelect();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Mark text in the given range as selected
|
|
|
|
|
|
|
|
|
|
//! Mark text in the given range as selected
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::Select(const CurPos &start, const CurPos &end)
|
|
|
|
|
{
|
|
|
|
@@ -387,22 +405,24 @@ TermBuffer::Select(const CurPos &start, const CurPos &end)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Mark text in the given range as not selected
|
|
|
|
|
|
|
|
|
|
//! Mark text in the given range as not selected
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::DeSelect (void)
|
|
|
|
|
TermBuffer::DeSelect()
|
|
|
|
|
{
|
|
|
|
|
mSelStart.Set (-1, -1);
|
|
|
|
|
mSelEnd.Set (-1, -1);
|
|
|
|
|
mSelStart.Set(-1, -1);
|
|
|
|
|
mSelEnd.Set(-1, -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check cursor position which be including selected area.
|
|
|
|
|
|
|
|
|
|
//! Check cursor position which be including selected area.
|
|
|
|
|
int
|
|
|
|
|
TermBuffer::CheckSelectedRegion (const CurPos &pos)
|
|
|
|
|
{
|
|
|
|
|
return (mSelStart.y == pos.y || mSelEnd.y == pos.y);
|
|
|
|
|
return mSelStart.y == pos.y || mSelEnd.y == pos.y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Find a word in the TermBuffer
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
TermBuffer::FindWord(const CurPos &pos, CurPos *start, CurPos *end)
|
|
|
|
|
{
|
|
|
|
@@ -413,8 +433,8 @@ TermBuffer::FindWord(const CurPos &pos, CurPos *start, CurPos *end)
|
|
|
|
|
y = pos.y;
|
|
|
|
|
|
|
|
|
|
// Search start point
|
|
|
|
|
for(x = pos.x - 1; x >= 0; x--){
|
|
|
|
|
if((this->GetChar (y, x, buf, &attr) == NO_CHAR) || (*buf == ' ')){
|
|
|
|
|
for (x = pos.x - 1; x >= 0; x--) {
|
|
|
|
|
if (GetChar(y, x, buf, &attr) == NO_CHAR || *buf == ' ') {
|
|
|
|
|
++x;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@@ -422,30 +442,31 @@ TermBuffer::FindWord(const CurPos &pos, CurPos *start, CurPos *end)
|
|
|
|
|
start_x = x;
|
|
|
|
|
|
|
|
|
|
// Search end point
|
|
|
|
|
for(x = pos.x; x < mColSize; x++){
|
|
|
|
|
if( (GetChar(y, x, buf, &attr) == NO_CHAR) || (*buf == ' ')) {
|
|
|
|
|
for (x = pos.x; x < mColSize; x++) {
|
|
|
|
|
if (GetChar(y, x, buf, &attr) == NO_CHAR || *buf == ' ') {
|
|
|
|
|
--x;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(start_x > x)
|
|
|
|
|
if (start_x > x)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
mSelStart.Set(start_x, y);
|
|
|
|
|
if(start != NULL)
|
|
|
|
|
if (start != NULL)
|
|
|
|
|
start->Set(start_x, y);
|
|
|
|
|
|
|
|
|
|
mSelEnd.Set(x, y);
|
|
|
|
|
if(end != NULL)
|
|
|
|
|
if (end != NULL)
|
|
|
|
|
end->Set(x, y);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get one character from the selected region.
|
|
|
|
|
|
|
|
|
|
//! Get one character from the selected region.
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::GetCharFromRegion (int x, int y, BString &str)
|
|
|
|
|
TermBuffer::GetCharFromRegion(int x, int y, BString &str)
|
|
|
|
|
{
|
|
|
|
|
uchar buf[5];
|
|
|
|
|
ushort attr;
|
|
|
|
@@ -453,34 +474,33 @@ TermBuffer::GetCharFromRegion (int x, int y, BString &str)
|
|
|
|
|
|
|
|
|
|
status = GetChar(y, x, buf, &attr);
|
|
|
|
|
|
|
|
|
|
switch(status) {
|
|
|
|
|
switch (status) {
|
|
|
|
|
case NO_CHAR:
|
|
|
|
|
if (IS_CR (attr))
|
|
|
|
|
str += '\n';
|
|
|
|
|
else
|
|
|
|
|
str += ' ';
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NO_CHAR:
|
|
|
|
|
if (IS_CR (attr))
|
|
|
|
|
str += '\n';
|
|
|
|
|
else
|
|
|
|
|
str += ' ';
|
|
|
|
|
break;
|
|
|
|
|
case IN_STRING:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IN_STRING:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
str += (const char *)&buf;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
str += (const char *)&buf;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Delete useless char at end of line and convert LF code.
|
|
|
|
|
|
|
|
|
|
//! Delete useless char at end of line and convert LF code.
|
|
|
|
|
inline void
|
|
|
|
|
TermBuffer::AvoidWaste (BString &str)
|
|
|
|
|
TermBuffer::AvoidWaste(BString &str)
|
|
|
|
|
{
|
|
|
|
|
// TODO: Remove the goto
|
|
|
|
|
|
|
|
|
|
int32 len, point;
|
|
|
|
|
|
|
|
|
|
start:
|
|
|
|
|
|
|
|
|
|
start:
|
|
|
|
|
len = str.Length() - 1;
|
|
|
|
|
point = str.FindLast (' ');
|
|
|
|
|
|
|
|
|
@@ -491,31 +511,36 @@ TermBuffer::AvoidWaste (BString &str)
|
|
|
|
|
// str += '\n';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get a string from selected region.
|
|
|
|
|
|
|
|
|
|
//! Get a string from selected region.
|
|
|
|
|
void
|
|
|
|
|
TermBuffer::GetStringFromRegion(BString &str)
|
|
|
|
|
{
|
|
|
|
|
int y;
|
|
|
|
|
|
|
|
|
|
if(mSelStart.y == mSelEnd.y) {
|
|
|
|
|
if (mSelStart.y == mSelEnd.y) {
|
|
|
|
|
y = mSelStart.y;
|
|
|
|
|
for(int x = mSelStart.x ; x <= mSelEnd.x; x++)
|
|
|
|
|
GetCharFromRegion (x, y, str);
|
|
|
|
|
for (int x = mSelStart.x ; x <= mSelEnd.x; x++) {
|
|
|
|
|
GetCharFromRegion(x, y, str);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
y = mSelStart.y;
|
|
|
|
|
for(int x = mSelStart.x ; x < mNowColSize; x++)
|
|
|
|
|
GetCharFromRegion (x, y, str);
|
|
|
|
|
AvoidWaste (str);
|
|
|
|
|
for (int x = mSelStart.x ; x < mNowColSize; x++) {
|
|
|
|
|
GetCharFromRegion(x, y, str);
|
|
|
|
|
}
|
|
|
|
|
AvoidWaste(str);
|
|
|
|
|
|
|
|
|
|
for(y = mSelStart.y + 1 ; y < mSelEnd.y; y++){
|
|
|
|
|
for(int x = 0 ; x < mNowColSize; x++)
|
|
|
|
|
GetCharFromRegion (x, y, str);
|
|
|
|
|
AvoidWaste (str);
|
|
|
|
|
for (y = mSelStart.y + 1 ; y < mSelEnd.y; y++) {
|
|
|
|
|
for (int x = 0 ; x < mNowColSize; x++) {
|
|
|
|
|
GetCharFromRegion(x, y, str);
|
|
|
|
|
}
|
|
|
|
|
AvoidWaste(str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
y = mSelEnd.y;
|
|
|
|
|
for(int x = 0 ; x <= mSelEnd.x; x++)
|
|
|
|
|
GetCharFromRegion (x, y, str);
|
|
|
|
|
for (int x = 0 ; x <= mSelEnd.x; x++) {
|
|
|
|
|
GetCharFromRegion(x, y, str);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|