diff options
author | Jesse Luehrs <doy@tozt.net> | 2016-04-27 01:50:04 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2016-04-27 01:50:36 -0400 |
commit | 85213a843566b82b05626efd97c48644b04935d2 (patch) | |
tree | 1897cb51bd0519aa955310ca049a09064e9a476d /src/screen.rs | |
parent | f0486657754c485f8211c6d00f9bf5ba6953dd67 (diff) | |
download | vt100-rust-85213a843566b82b05626efd97c48644b04935d2.tar.gz vt100-rust-85213a843566b82b05626efd97c48644b04935d2.zip |
start implementing cells
Diffstat (limited to 'src/screen.rs')
-rw-r--r-- | src/screen.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/screen.rs b/src/screen.rs index da96a6a..d3e026f 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -1,6 +1,7 @@ use libc; use std; +use cell; use ffi; use types; @@ -91,6 +92,17 @@ impl Screen { }.to_vec(); std::string::String::from_utf8(rust_plaintext).unwrap() } + + pub fn cell(&self, row: i32, col: i32) -> Option<cell::Cell> { + let Screen(screen_impl) = *self; + if row < 0 || row >= self.rows() || col < 0 || col >= self.cols() { + return None + } + let cell_impl = unsafe { + ffi::vt100_screen_cell_at(screen_impl, row, col) + }; + Some(cell::Cell::new(cell_impl)) + } } impl Drop for Screen { |