Diffstat (limited to 'noncore/apps/opie-console/TEScreen.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/TEScreen.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/TEScreen.cpp b/noncore/apps/opie-console/TEScreen.cpp index 2675d31..8e91532 100644 --- a/noncore/apps/opie-console/TEScreen.cpp +++ b/noncore/apps/opie-console/TEScreen.cpp | |||
@@ -1070,98 +1070,98 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks) | |||
1070 | { | 1070 | { |
1071 | while ((eol > s) && | 1071 | while ((eol > s) && |
1072 | isspace(image[eol - hist_BR].c)) | 1072 | isspace(image[eol - hist_BR].c)) |
1073 | { | 1073 | { |
1074 | eol--; | 1074 | eol--; |
1075 | } | 1075 | } |
1076 | } | 1076 | } |
1077 | else | 1077 | else |
1078 | { | 1078 | { |
1079 | eol = sel_BR; | 1079 | eol = sel_BR; |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | while (s <= eol) | 1082 | while (s <= eol) |
1083 | { | 1083 | { |
1084 | m[d++] = image[s++ - hist_BR].c; | 1084 | m[d++] = image[s++ - hist_BR].c; |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | if (eol < sel_BR) | 1087 | if (eol < sel_BR) |
1088 | { | 1088 | { |
1089 | // eol processing see below ... | 1089 | // eol processing see below ... |
1090 | if ((eol + 1) % columns == 0) | 1090 | if ((eol + 1) % columns == 0) |
1091 | { | 1091 | { |
1092 | if (image[eol - hist_BR].c == ' ') | 1092 | if (image[eol - hist_BR].c == ' ') |
1093 | { | 1093 | { |
1094 | m[d++] = ' '; | 1094 | m[d++] = ' '; |
1095 | } | 1095 | } |
1096 | } | 1096 | } |
1097 | else | 1097 | else |
1098 | { | 1098 | { |
1099 | m[d++] = ((preserve_line_breaks || | 1099 | m[d++] = ((preserve_line_breaks || |
1100 | ((eol % columns) == 0)) ? | 1100 | ((eol % columns) == 0)) ? |
1101 | '\n' : ' '); | 1101 | '\n' : ' '); |
1102 | } | 1102 | } |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | s = (eol / columns + 1) * columns; | 1105 | s = (eol / columns + 1) * columns; |
1106 | } | 1106 | } |
1107 | } | 1107 | } |
1108 | 1108 | ||
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 | } |
1123 | QString TEScreen::getHistory() { | 1123 | QString TEScreen::getHistory() { |
1124 | sel_begin = 0; | 1124 | sel_begin = 0; |
1125 | sel_BR = sel_begin; | 1125 | sel_BR = sel_begin; |
1126 | sel_TL = sel_begin; | 1126 | sel_TL = sel_begin; |
1127 | setSelExtentXY(columns-1,lines-1); | 1127 | setSelExtentXY(columns-1,lines-1); |
1128 | QString tmp=getSelText(true); | 1128 | QString tmp=getSelText(true); |
1129 | while (tmp.at(tmp.length()-2).unicode()==10 && tmp.at(tmp.length()-1).unicode()==10) | 1129 | while (tmp.at(tmp.length()-2).unicode()==10 && tmp.at(tmp.length()-1).unicode()==10) |
1130 | tmp.truncate(tmp.length()-1); | 1130 | tmp.truncate(tmp.length()-1); |
1131 | 1131 | ||
1132 | return tmp; | 1132 | return tmp; |
1133 | } | 1133 | } |
1134 | /* above ... end of line processing for selection -- psilva | 1134 | /* above ... end of line processing for selection -- psilva |
1135 | cases: | 1135 | cases: |
1136 | 1136 | ||
1137 | 1) (eol+1)%columns == 0 --> the whole line is filled. | 1137 | 1) (eol+1)%columns == 0 --> the whole line is filled. |
1138 | If the last char is a space, insert (preserve) space. otherwise | 1138 | If the last char is a space, insert (preserve) space. otherwise |
1139 | 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 |
1140 | are preserved. | 1140 | are preserved. |
1141 | 1141 | ||
1142 | FIXME: | 1142 | FIXME: |
1143 | * this suppresses \n for command output that is | 1143 | * this suppresses \n for command output that is |
1144 | sized to the exact column width of the screen. | 1144 | sized to the exact column width of the screen. |
1145 | 1145 | ||
1146 | 2) eol%columns == 0 --> blank line. | 1146 | 2) eol%columns == 0 --> blank line. |
1147 | insert a \n unconditionally. | 1147 | insert a \n unconditionally. |
1148 | Do it either you would because you are in preserve_line_break mode, | 1148 | Do it either you would because you are in preserve_line_break mode, |
1149 | or because it's an ASCII paragraph delimiter, so even when | 1149 | or because it's an ASCII paragraph delimiter, so even when |
1150 | not preserving line_breaks, you want to preserve paragraph breaks. | 1150 | not preserving line_breaks, you want to preserve paragraph breaks. |
1151 | 1151 | ||
1152 | 3) else --> partially filled line | 1152 | 3) else --> partially filled line |
1153 | insert a \n in preserve line break mode, else a space | 1153 | insert a \n in preserve line break mode, else a space |
1154 | The space prevents concatenation of the last word of one | 1154 | The space prevents concatenation of the last word of one |
1155 | line with the first of the next. | 1155 | line with the first of the next. |
1156 | 1156 | ||
1157 | */ | 1157 | */ |
1158 | 1158 | ||
1159 | void TEScreen::addHistLine() | 1159 | void TEScreen::addHistLine() |
1160 | { | 1160 | { |
1161 | assert(hasScroll() || histCursor == 0); | 1161 | assert(hasScroll() || histCursor == 0); |
1162 | 1162 | ||
1163 | // add to hist buffer | 1163 | // add to hist buffer |
1164 | // we have to take care about scrolling, too... | 1164 | // we have to take care about scrolling, too... |
1165 | 1165 | ||
1166 | if (hasScroll()) | 1166 | if (hasScroll()) |
1167 | { ca dft; | 1167 | { ca dft; |