Skip to content

Commit

Permalink
tty: fix issue with no able to input test repetetly
Browse files Browse the repository at this point in the history
Github Issue: #25

Signed-off-by: Maksym Prymierov <[email protected]>
  • Loading branch information
MaksymPrymierov committed Apr 16, 2021
1 parent f9d2ed4 commit b48de37
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
1 change: 1 addition & 0 deletions arch/x86/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ int main(void* heap_top, void* heap_bottom)
conix::kernel::std::string s;

while (1) {
s.clear();
log << "Enter the test name to start: ";
log >> s;

Expand Down
6 changes: 1 addition & 5 deletions kernel/tty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tty::tty()
{
memory = reinterpret_cast<u16*>(memory_address);
enable_cursor();
k.disable_int();
k.enable_int();
}

tty::~tty()
Expand Down Expand Up @@ -112,7 +112,6 @@ void tty::input_string(char* string, size_t s)
bool can_write = true;
size_t i = 0;
char buffer[2] = { '\0' };
k.enable_int();

while (1) {
buffer[0] = k.get_key();
Expand All @@ -138,14 +137,12 @@ void tty::input_string(char* string, size_t s)
}

print_string("\n");
k.disable_int();
}

void tty::input_string(std::string& str)
{
bool can_write = true;
char buffer[2] = { '\0' };
k.enable_int();
str.clear();

while (true) {
Expand All @@ -169,7 +166,6 @@ void tty::input_string(std::string& str)
print_string(buffer);
}
print_string("\n");
k.disable_int();
}

void tty::get_line(char* string, size_t s)
Expand Down

0 comments on commit b48de37

Please sign in to comment.