Diffstat (limited to 'core/apps/embeddedkonsole/TEScreen.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/embeddedkonsole/TEScreen.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/core/apps/embeddedkonsole/TEScreen.cpp b/core/apps/embeddedkonsole/TEScreen.cpp index a6cf6a1..4ebc28e 100644 --- a/core/apps/embeddedkonsole/TEScreen.cpp +++ b/core/apps/embeddedkonsole/TEScreen.cpp | |||
@@ -501,24 +501,28 @@ void TEScreen::effectiveRendition() | |||
501 | 501 | ||
502 | NOTE that the image returned by this function must later be | 502 | NOTE that the image returned by this function must later be |
503 | freed. | 503 | freed. |
504 | 504 | ||
505 | */ | 505 | */ |
506 | 506 | ||
507 | ca* TEScreen::getCookedImage() | 507 | ca* TEScreen::getCookedImage() |
508 | { | 508 | { |
509 | int x,y; | 509 | int x,y; |
510 | ca* merged = (ca*)malloc(lines*columns*sizeof(ca)); | 510 | ca* merged = (ca*)malloc(lines*columns*sizeof(ca)); |
511 | ca dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION); | 511 | ca dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION); |
512 | 512 | ||
513 | if (histCursor > hist.getLines()) { | ||
514 | histCursor = hist.getLines(); | ||
515 | } | ||
516 | |||
513 | for (y = 0; (y < lines) && (y < (hist.getLines()-histCursor)); y++) | 517 | for (y = 0; (y < lines) && (y < (hist.getLines()-histCursor)); y++) |
514 | { | 518 | { |
515 | int len = QMIN(columns,hist.getLineLen(y+histCursor)); | 519 | int len = QMIN(columns,hist.getLineLen(y+histCursor)); |
516 | int yp = y*columns; | 520 | int yp = y*columns; |
517 | int yq = (y+histCursor)*columns; | 521 | int yq = (y+histCursor)*columns; |
518 | 522 | ||
519 | hist.getCells(y+histCursor,0,len,merged+yp); | 523 | hist.getCells(y+histCursor,0,len,merged+yp); |
520 | for (x = len; x < columns; x++) merged[yp+x] = dft; | 524 | for (x = len; x < columns; x++) merged[yp+x] = dft; |
521 | for (x = 0; x < columns; x++) | 525 | for (x = 0; x < columns; x++) |
522 | { int p=x + yp; int q=x + yq; | 526 | { int p=x + yp; int q=x + yq; |
523 | if ( ( q >= sel_TL ) && ( q <= sel_BR ) ) | 527 | if ( ( q >= sel_TL ) && ( q <= sel_BR ) ) |
524 | reverseRendition(&merged[p]); // for selection | 528 | reverseRendition(&merged[p]); // for selection |
@@ -549,25 +553,25 @@ ca* TEScreen::getCookedImage() | |||
549 | if (getMode(MODE_Cursor) && (cuY+(hist.getLines()-histCursor) < lines)) // cursor visible | 553 | if (getMode(MODE_Cursor) && (cuY+(hist.getLines()-histCursor) < lines)) // cursor visible |
550 | reverseRendition(&merged[loc(cuX,cuY+(hist.getLines()-histCursor))]); | 554 | reverseRendition(&merged[loc(cuX,cuY+(hist.getLines()-histCursor))]); |
551 | return merged; | 555 | return merged; |
552 | 556 | ||
553 | } | 557 | } |
554 | 558 | ||
555 | 559 | ||
556 | /*! | 560 | /*! |
557 | */ | 561 | */ |
558 | 562 | ||
559 | void TEScreen::reset() | 563 | void TEScreen::reset() |
560 | { | 564 | { |
561 | Config cfg("Konsole"); | 565 | Config cfg("Qkonsole"); |
562 | cfg.setGroup("ScrollBar"); | 566 | cfg.setGroup("ScrollBar"); |
563 | if( !cfg.readBoolEntry("HorzScroll",0) ) | 567 | if( !cfg.readBoolEntry("HorzScroll",0) ) |
564 | setMode(MODE_Wrap ); saveMode(MODE_Wrap ); // wrap at end of margin | 568 | setMode(MODE_Wrap ); saveMode(MODE_Wrap ); // wrap at end of margin |
565 | 569 | ||
566 | 570 | ||
567 | resetMode(MODE_Origin); saveMode(MODE_Origin); // position refere to [1,1] | 571 | resetMode(MODE_Origin); saveMode(MODE_Origin); // position refere to [1,1] |
568 | resetMode(MODE_Insert); saveMode(MODE_Insert); // overstroke | 572 | resetMode(MODE_Insert); saveMode(MODE_Insert); // overstroke |
569 | setMode(MODE_Cursor); // cursor visible | 573 | setMode(MODE_Cursor); // cursor visible |
570 | resetMode(MODE_Screen); // screen not inverse | 574 | resetMode(MODE_Screen); // screen not inverse |
571 | resetMode(MODE_NewLine); | 575 | resetMode(MODE_NewLine); |
572 | 576 | ||
573 | tmargin=0; | 577 | tmargin=0; |
@@ -962,32 +966,38 @@ void TEScreen::setForeColorToDefault() | |||
962 | /* */ | 966 | /* */ |
963 | /* ------------------------------------------------------------------------- */ | 967 | /* ------------------------------------------------------------------------- */ |
964 | 968 | ||
965 | void TEScreen::clearSelection() | 969 | void TEScreen::clearSelection() |
966 | { | 970 | { |
967 | sel_BR = -1; | 971 | sel_BR = -1; |
968 | sel_TL = -1; | 972 | sel_TL = -1; |
969 | sel_begin = -1; | 973 | sel_begin = -1; |
970 | } | 974 | } |
971 | 975 | ||
972 | void TEScreen::setSelBeginXY(const int x, const int y) | 976 | void TEScreen::setSelBeginXY(const int x, const int y) |
973 | { | 977 | { |
978 | if (histCursor > hist.getLines()) { | ||
979 | histCursor = hist.getLines(); | ||
980 | } | ||
974 | sel_begin = loc(x,y+histCursor) ; | 981 | sel_begin = loc(x,y+histCursor) ; |
975 | sel_BR = sel_begin; | 982 | sel_BR = sel_begin; |
976 | sel_TL = sel_begin; | 983 | sel_TL = sel_begin; |
977 | } | 984 | } |
978 | 985 | ||
979 | void TEScreen::setSelExtentXY(const int x, const int y) | 986 | void TEScreen::setSelExtentXY(const int x, const int y) |
980 | { | 987 | { |
981 | if (sel_begin == -1) return; | 988 | if (sel_begin == -1) return; |
989 | if (histCursor > hist.getLines()) { | ||
990 | histCursor = hist.getLines(); | ||
991 | } | ||
982 | int l = loc(x,y + histCursor); | 992 | int l = loc(x,y + histCursor); |
983 | 993 | ||
984 | if (l < sel_begin) | 994 | if (l < sel_begin) |
985 | { | 995 | { |
986 | sel_TL = l; | 996 | sel_TL = l; |
987 | sel_BR = sel_begin; | 997 | sel_BR = sel_begin; |
988 | } | 998 | } |
989 | else | 999 | else |
990 | { | 1000 | { |
991 | /* FIXME, HACK to correct for x too far to the right... */ | 1001 | /* FIXME, HACK to correct for x too far to the right... */ |
992 | if (( x == columns )|| (x == 0)) l--; | 1002 | if (( x == columns )|| (x == 0)) l--; |
993 | 1003 | ||
@@ -1176,24 +1186,30 @@ void TEScreen::addHistLine() | |||
1176 | hist.addLine(); | 1186 | hist.addLine(); |
1177 | 1187 | ||
1178 | // adjust history cursor | 1188 | // adjust history cursor |
1179 | histCursor += ( hist.getLines() - 1 == histCursor); | 1189 | histCursor += ( hist.getLines() - 1 == histCursor); |
1180 | } | 1190 | } |
1181 | 1191 | ||
1182 | if (!hasScroll()) histCursor = 0; //FIXME: a poor workaround | 1192 | if (!hasScroll()) histCursor = 0; //FIXME: a poor workaround |
1183 | } | 1193 | } |
1184 | 1194 | ||
1185 | void TEScreen::setHistCursor(int cursor) | 1195 | void TEScreen::setHistCursor(int cursor) |
1186 | { | 1196 | { |
1187 | histCursor = cursor; //FIXME:rangecheck | 1197 | histCursor = cursor; //FIXME:rangecheck |
1198 | if (histCursor > hist.getLines()) { | ||
1199 | histCursor = hist.getLines(); | ||
1200 | } | ||
1201 | if (histCursor < 0) { | ||
1202 | histCursor = 0; | ||
1203 | } | ||
1188 | } | 1204 | } |
1189 | 1205 | ||
1190 | void TEScreen::setHorzCursor(int cursor) | 1206 | void TEScreen::setHorzCursor(int cursor) |
1191 | { | 1207 | { |
1192 | horzCursor = cursor; | 1208 | horzCursor = cursor; |
1193 | } | 1209 | } |
1194 | 1210 | ||
1195 | int TEScreen::getHistCursor() | 1211 | int TEScreen::getHistCursor() |
1196 | { | 1212 | { |
1197 | return histCursor; | 1213 | return histCursor; |
1198 | } | 1214 | } |
1199 | 1215 | ||