Diffstat (limited to 'noncore/apps/opie-console/TEScreen.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/TEScreen.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/TEScreen.cpp b/noncore/apps/opie-console/TEScreen.cpp index a3d115d..2675d31 100644 --- a/noncore/apps/opie-console/TEScreen.cpp +++ b/noncore/apps/opie-console/TEScreen.cpp @@ -982,13 +982,13 @@ void TEScreen::setSelExtentXY(const int x, const int y) sel_BR = l; } } QString TEScreen::getSelText(const BOOL preserve_line_breaks) { - if (sel_begin == -1) + if (sel_begin == -1) return QString::null; // Selection got clear while selecting. int *m; // buffer to fill. int s, d; // source index, dest. index. int hist_BR = loc(0, hist.getLines()); int hY = sel_TL / columns; @@ -1012,13 +1012,13 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks) if ((hY == (sel_BR / columns)) && (eol >= (sel_BR % columns))) { eol = sel_BR % columns + 1; } - + while (hX < eol) { m[d++] = hist.getCell(hY, hX++).c; s++; } @@ -1109,20 +1109,31 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks) QChar* qc = new QChar[d]; for (int i = 0; i < d; i++) { qc[i] = m[i]; } - + QString res(qc, d); delete m; delete qc; return res; } +QString TEScreen::getHistory() { + sel_begin = 0; + sel_BR = sel_begin; + sel_TL = sel_begin; + setSelExtentXY(columns-1,lines-1); + QString tmp=getSelText(true); + while (tmp.at(tmp.length()-2).unicode()==10 && tmp.at(tmp.length()-1).unicode()==10) + tmp.truncate(tmp.length()-1); + + return tmp; +} /* above ... end of line processing for selection -- psilva cases: 1) (eol+1)%columns == 0 --> the whole line is filled. If the last char is a space, insert (preserve) space. otherwise leave the text alone, so that words that are broken by linewrap |