fix bufferedcga bug where buffer was used before init
This commit is contained in:
@ -10,6 +10,7 @@ void BufferedCGA::init() {
|
||||
}
|
||||
|
||||
void BufferedCGA::displaypage() {
|
||||
if (this->initialized) {
|
||||
if (this->current_page == 0) {
|
||||
// Use pagebuffer
|
||||
this->scrollback_buffer->copy_page_from_pagebuffer((cga_page_t*)CGA_START);
|
||||
@ -17,6 +18,9 @@ void BufferedCGA::displaypage() {
|
||||
// Use scrollback
|
||||
this->scrollback_buffer->copy_page_from_buffer((cga_line_t*)CGA_START, this->current_page - 1);
|
||||
}
|
||||
} else {
|
||||
this->print("ScrollbackBuffer not initialized\n\n", 34);
|
||||
}
|
||||
}
|
||||
|
||||
void BufferedCGA::print(char* string, int n, unsigned char attrib) {
|
||||
@ -51,7 +55,9 @@ void BufferedCGA::clear() {
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int BufferedCGA::scroll_page_backward() {
|
||||
void BufferedCGA::scroll_page_backward() {
|
||||
if (this->initialized) {
|
||||
|
||||
// If this is the first scrollback we have to save the current screen content
|
||||
if (this->current_page == 0) {
|
||||
this->scrollback_buffer->copy_page_to_pagebuffer((cga_page_t*)CGA_START);
|
||||
@ -63,13 +69,19 @@ unsigned int BufferedCGA::scroll_page_backward() {
|
||||
this->current_page = this->current_page + 1;
|
||||
}
|
||||
this->displaypage();
|
||||
return this->current_page;
|
||||
} else {
|
||||
this->print("ScrollbackBuffer not initialized\n\n", 34);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int BufferedCGA::scroll_page_forward() {
|
||||
void BufferedCGA::scroll_page_forward() {
|
||||
if (this->initialized) {
|
||||
|
||||
if (this->current_page > 0) {
|
||||
this->current_page = this->current_page - 1;
|
||||
}
|
||||
this->displaypage();
|
||||
return this->current_page;
|
||||
} else {
|
||||
this->print("ScrollbackBuffer not initialized\n\n", 34);
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,8 +21,8 @@ public:
|
||||
|
||||
void init(); // Scrollback needs to be initialized after memorymanagement
|
||||
unsigned char current_page; // The page that is displayed
|
||||
unsigned int scroll_page_backward(); // Scroll up the page history
|
||||
unsigned int scroll_page_forward(); // Scroll down the page history (to the current page)
|
||||
void scroll_page_backward(); // Scroll up the page history
|
||||
void scroll_page_forward(); // Scroll down the page history (to the current page)
|
||||
|
||||
void print(char* string, int n, unsigned char attrib = STD_ATTR) override;
|
||||
void scrollup() override;
|
||||
|
||||
Reference in New Issue
Block a user