Add text mode handling.

This commit is contained in:
2026-08-30 14:33:39 +01:00
parent 87d9148b82
commit 7a18aa0db2
10 changed files with 254 additions and 61 deletions
-10
View File
@@ -1,10 +0,0 @@
#include "internal/ui/command.h"
#include "bed.h"
#include "internal/io/io.h"
namespace bed::internal::io {
std::pair<std::string, bool> IO::get_command(BEd &ctx) {
ui::CommandIO cio(ctx, *this);
return cio.run();
}
} // namespace bed::internal::io
-28
View File
@@ -1,28 +0,0 @@
#include "bed.h"
#include "internal/io/io.h"
namespace bed::internal::io {
std::pair<std::string, bool> IO::get_text(BEd &) {
uint16_t start;
uint16_t height;
{
auto [row, col] = cursor_position();
auto [rows, cols] = terminal_size();
if (row > rows)
throw fatal_error("Invalid cursor position.", 1);
start = row;
height = rows - row + 1;
}
enable_mouse();
// uint16_t width = cols;
disable_mouse();
for (uint16_t i = 1; i < height; ++i) {
move_cursor(start + i, 1);
write_all(STDOUT_FILENO, "\x1b[2K", 4);
}
move_cursor(start, 1);
write_all(STDOUT_FILENO, "\n", 1);
return {"", true};
}
} // namespace bed::internal::io