fixed linux implementation and added test
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
#include "term.h"
|
||||
#include "../includes/tart.h"
|
||||
|
||||
|
||||
// if windows is defined.
|
||||
|
||||
@@ -23,16 +21,19 @@ struct tart_vec2 term_current_size() {
|
||||
}
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
struct tart_vec2 term_current_size() {
|
||||
struct tart_vec2 ret;
|
||||
|
||||
unsigned int rows = w.ws_row;
|
||||
unsigned int cols = w.ws_col;
|
||||
|
||||
struct winsize w;
|
||||
|
||||
|
||||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
||||
|
||||
unsigned int rows = w.ws_col;
|
||||
unsigned int cols = w.ws_row;
|
||||
|
||||
unsigned short max_short = 0XFFFF;
|
||||
if(rows < max_short && cols < max_short) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user