2018-09-18 14:48:40 +08:00
|
|
|
#include <stdio.h>
|
2019-06-23 23:47:33 +08:00
|
|
|
#include <sys/ioctl.h>
|
2018-09-18 14:48:40 +08:00
|
|
|
#include <unistd.h>
|
2019-06-23 23:47:33 +08:00
|
|
|
#include <iostream>
|
2018-09-18 14:48:40 +08:00
|
|
|
|
2019-01-12 22:00:08 +08:00
|
|
|
#include "ftxui/screen/terminal.hpp"
|
2018-09-18 14:48:40 +08:00
|
|
|
|
|
|
|
namespace ftxui {
|
|
|
|
|
|
|
|
Terminal::Dimensions Terminal::Size() {
|
2019-02-02 08:59:48 +08:00
|
|
|
#ifdef __EMSCRIPTEN__
|
2019-06-23 23:47:33 +08:00
|
|
|
return Dimensions{80, 43};
|
2019-02-02 08:59:48 +08:00
|
|
|
#else
|
2018-09-18 14:48:40 +08:00
|
|
|
winsize w;
|
|
|
|
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
|
|
|
return Dimensions{w.ws_col, w.ws_row};
|
2019-02-02 08:59:48 +08:00
|
|
|
#endif
|
2018-09-18 14:48:40 +08:00
|
|
|
}
|
|
|
|
|
2019-06-23 23:47:33 +08:00
|
|
|
} // namespace ftxui
|