summaryrefslogtreecommitdiffstats
path: root/gui/terminal.cpp
diff options
context:
space:
mode:
authorthat <github@that.at>2017-03-14 20:58:08 +0100
committerEthan Yonker <dees_troy@teamw.in>2017-05-15 22:14:32 +0200
commit0d0d522b889ce86860abb229c7cdd4d0299b1127 (patch)
treecc549614afc6b282a73472e67f2ee596fbd1bdc2 /gui/terminal.cpp
parent3.1.1 (diff)
downloadandroid_bootable_recovery-0d0d522b889ce86860abb229c7cdd4d0299b1127.tar
android_bootable_recovery-0d0d522b889ce86860abb229c7cdd4d0299b1127.tar.gz
android_bootable_recovery-0d0d522b889ce86860abb229c7cdd4d0299b1127.tar.bz2
android_bootable_recovery-0d0d522b889ce86860abb229c7cdd4d0299b1127.tar.lz
android_bootable_recovery-0d0d522b889ce86860abb229c7cdd4d0299b1127.tar.xz
android_bootable_recovery-0d0d522b889ce86860abb229c7cdd4d0299b1127.tar.zst
android_bootable_recovery-0d0d522b889ce86860abb229c7cdd4d0299b1127.zip
Diffstat (limited to 'gui/terminal.cpp')
-rw-r--r--gui/terminal.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/gui/terminal.cpp b/gui/terminal.cpp
index fe80fb097..1744788da 100644
--- a/gui/terminal.cpp
+++ b/gui/terminal.cpp
@@ -389,6 +389,7 @@ public:
lines.clear();
setY(0);
unpackLine(0);
+ linewrap = false;
++updateCounter;
}
@@ -465,6 +466,7 @@ public:
{
x = min(width, max(x, 0));
cursorX = x;
+ linewrap = false;
++updateCounter;
}
@@ -473,6 +475,7 @@ public:
//y = min(height, max(y, 0));
y = max(y, 0);
cursorY = y;
+ linewrap = false;
while (lines.size() <= (size_t) y)
lines.push_back(Line());
++updateCounter;
@@ -581,21 +584,20 @@ private:
void processChar(CodePoint cp)
{
+ if (linewrap) {
+ down();
+ setX(0);
+ }
ensureUnpacked(cursorY);
// extend unpackedLine if needed, write ch into cell
if (unpackedLine.cells.size() <= (size_t)cursorX)
unpackedLine.cells.resize(cursorX+1);
unpackedLine.cells[cursorX].cp = cp;
- right();
+ right(); // also bumps updateCounter
+
if (cursorX >= width)
- {
- // TODO: configurable line wrapping
- // TODO: don't go down immediately but only on next char?
- down();
- setX(0);
- }
- // TODO: update all GUI objects that display this terminal engine
+ linewrap = true;
}
void processEsc(CodePoint cp)
@@ -744,6 +746,7 @@ private:
private:
int cursorX, cursorY; // 0-based, char based. TODO: decide how to handle scrollback
+ bool linewrap; // true to put next character into next line
int width, height; // window size in chars
std::vector<Line> lines; // the text buffer
UnpackedLine unpackedLine; // current line for editing