fix line wrap bounds

main
Eggert Jung 6 months ago
parent 152ed507fd
commit 2d9d72e162

@ -44,9 +44,9 @@ void TextWindow::print(const char* str, size_t length, CGA::Attribute attrib) {
unsigned x_now, y_now; unsigned x_now, y_now;
getPos(x_now, y_now); getPos(x_now, y_now);
CGA::show(x_now, y_now, str[i], attrib); CGA::show(x_now, y_now, str[i], attrib);
if(from_col+x_now >= to_col){ if(from_col+x_now >= to_col-1){
x_now = 0; x_now = 0;
if(from_row + y_now >= to_row){ if(from_row + y_now >= to_row-1){
//scrollUp() //scrollUp()
} }
else{ else{

@ -20,6 +20,9 @@ extern "C" int main() {
// CGA::show(i, i, i+0x30, CGA::Attribute()); // CGA::show(i, i, i+0x30, CGA::Attribute());
//test textwindow implemantation //test textwindow implemantation
TextWindow tw_global = TextWindow(0, 80, 0, 25, true);
tw_global.reset(' ', CGA::Attribute(CGA::LIGHT_GREEN, CGA::BLUE, false));
TextWindow tw = TextWindow(0, 10, 0, 10, true); TextWindow tw = TextWindow(0, 10, 0, 10, true);
tw.reset(); tw.reset();
tw.setPos(0,0); tw.setPos(0,0);

Loading…
Cancel
Save