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