mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-29 16:39:34 +08:00
21
src/ftxui/screen/terminal.cpp
Normal file
21
src/ftxui/screen/terminal.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <iostream>
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ftxui/screen/terminal.hpp"
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
Terminal::Dimensions Terminal::Size() {
|
||||
#ifdef __EMSCRIPTEN__
|
||||
return Dimensions{80,43};
|
||||
#else
|
||||
winsize w;
|
||||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
||||
std::cerr << w.ws_col << "," << w.ws_row << std::endl;
|
||||
return Dimensions{w.ws_col, w.ws_row};
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
Reference in New Issue
Block a user