summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/TEScreen.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/TEScreen.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/TEScreen.cpp17
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)
982 sel_BR = l; 982 sel_BR = l;
983 } 983 }
984} 984}
985 985
986QString TEScreen::getSelText(const BOOL preserve_line_breaks) 986QString TEScreen::getSelText(const BOOL preserve_line_breaks)
987{ 987{
988 if (sel_begin == -1) 988 if (sel_begin == -1)
989 return QString::null; // Selection got clear while selecting. 989 return QString::null; // Selection got clear while selecting.
990 990
991 int *m; // buffer to fill. 991 int *m; // buffer to fill.
992 int s, d; // source index, dest. index. 992 int s, d; // source index, dest. index.
993 int hist_BR = loc(0, hist.getLines()); 993 int hist_BR = loc(0, hist.getLines());
994 int hY = sel_TL / columns; 994 int hY = sel_TL / columns;
@@ -1012,13 +1012,13 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks)
1012 1012
1013 if ((hY == (sel_BR / columns)) && 1013 if ((hY == (sel_BR / columns)) &&
1014 (eol >= (sel_BR % columns))) 1014 (eol >= (sel_BR % columns)))
1015 { 1015 {
1016 eol = sel_BR % columns + 1; 1016 eol = sel_BR % columns + 1;
1017 } 1017 }
1018 1018
1019 while (hX < eol) 1019 while (hX < eol)
1020 { 1020 {
1021 m[d++] = hist.getCell(hY, hX++).c; 1021 m[d++] = hist.getCell(hY, hX++).c;
1022 s++; 1022 s++;
1023 } 1023 }
1024 1024
@@ -1109,20 +1109,31 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks)
1109 QChar* qc = new QChar[d]; 1109 QChar* qc = new QChar[d];
1110 1110
1111 for (int i = 0; i < d; i++) 1111 for (int i = 0; i < d; i++)
1112 { 1112 {
1113 qc[i] = m[i]; 1113 qc[i] = m[i];
1114 } 1114 }
1115 1115
1116 QString res(qc, d); 1116 QString res(qc, d);
1117 1117
1118 delete m; 1118 delete m;
1119 delete qc; 1119 delete qc;
1120 1120
1121 return res; 1121 return res;
1122} 1122}
1123QString TEScreen::getHistory() {
1124 sel_begin = 0;
1125 sel_BR = sel_begin;
1126 sel_TL = sel_begin;
1127 setSelExtentXY(columns-1,lines-1);
1128 QString tmp=getSelText(true);
1129 while (tmp.at(tmp.length()-2).unicode()==10 && tmp.at(tmp.length()-1).unicode()==10)
1130 tmp.truncate(tmp.length()-1);
1131
1132 return tmp;
1133}
1123/* above ... end of line processing for selection -- psilva 1134/* above ... end of line processing for selection -- psilva
1124cases: 1135cases:
1125 1136
11261) (eol+1)%columns == 0 --> the whole line is filled. 11371) (eol+1)%columns == 0 --> the whole line is filled.
1127 If the last char is a space, insert (preserve) space. otherwise 1138 If the last char is a space, insert (preserve) space. otherwise
1128 leave the text alone, so that words that are broken by linewrap 1139 leave the text alone, so that words that are broken by linewrap