implement \n on textwindow
This commit is contained in:
@@ -51,6 +51,18 @@ void TextWindow::print(const char* str, size_t length, CGA::Attribute attrib) {
|
|||||||
for(unsigned i=0; i<length; i++){
|
for(unsigned i=0; i<length; i++){
|
||||||
unsigned x_now, y_now;
|
unsigned x_now, y_now;
|
||||||
getPos(x_now, y_now);
|
getPos(x_now, y_now);
|
||||||
|
if(str[i] == '\n'){
|
||||||
|
x_now = 0;
|
||||||
|
if(from_row + y_now >= to_row-1){
|
||||||
|
//TODO scrollUp()
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
y_now++;
|
||||||
|
}
|
||||||
|
setPos(x_now, y_now);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
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-1){
|
if(from_col+x_now >= to_col-1){
|
||||||
x_now = 0;
|
x_now = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user