diff options
-rw-r--r-- | src/ios.rs | 8 | ||||
-rw-r--r-- | src/termios_wrapper.c | 4 | ||||
-rw-r--r-- | test/rl.rs | 2 | ||||
-rw-r--r-- | test/termios3.rs | 4 |
4 files changed, 9 insertions, 9 deletions
@@ -26,12 +26,12 @@ pub fn isatty() -> bool { } pub fn size() -> (uint, uint) { - let rows: c_uint = 0; let cols: c_uint = 0; + let rows: c_uint = 0; unsafe { - c::size(&rows, &cols) + c::size(&cols, &rows) } - (rows as uint, cols as uint) + (cols as uint, rows as uint) } enum struct_termios {} @@ -60,7 +60,7 @@ extern mod c { fn get() -> *struct_termios; fn set(t: *struct_termios); - fn size(rows: *c_uint, cols: *c_uint); + fn size(cols: *c_uint, rows: *c_uint); } extern { diff --git a/src/termios_wrapper.c b/src/termios_wrapper.c index 097f470..02f084b 100644 --- a/src/termios_wrapper.c +++ b/src/termios_wrapper.c @@ -89,10 +89,10 @@ void set(struct termios *t) free(t); } -void size(unsigned int *rows, unsigned int *cols) +void size(unsigned int *cols, unsigned int *rows) { struct winsize ws; ioctl(0, TIOCGWINSZ, &ws); - *rows = ws.ws_row; *cols = ws.ws_col; + *rows = ws.ws_row; } @@ -29,7 +29,7 @@ fn draw_ground (x: uint, y: uint) { } fn main () { - let (rows, cols) = term::ios::size(); + let (cols, rows) = term::ios::size(); do term_app { term::ios::cbreak(); diff --git a/test/termios3.rs b/test/termios3.rs index 51f6bb2..491ed5a 100644 --- a/test/termios3.rs +++ b/test/termios3.rs @@ -2,8 +2,8 @@ extern mod term; fn main () { if term::ios::isatty() { - let (rows, cols) = term::ios::size(); - io::println(fmt!("tty: %d %d", rows as int, cols as int)); + let (cols, rows) = term::ios::size(); + io::println(fmt!("tty: %d %d", cols as int, rows as int)); } else { io::println("not tty"); |