aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2016-06-06 03:05:51 -0400
committerJesse Luehrs <doy@tozt.net>2016-06-06 03:08:20 -0400
commitb19b92e4482b080d23d867a9750ec21492848b43 (patch)
tree7907321c3a823a05a069c226fe44e6ec5020ee7f
parent4813cd322b86488eee3ecb0e6f7cfe2d998b4115 (diff)
downloadvt100-rust-b19b92e4482b080d23d867a9750ec21492848b43.tar.gz
vt100-rust-b19b92e4482b080d23d867a9750ec21492848b43.zip
bump libvt100
this requires some workarounds since we might have extra scrollback length even if we didn't ask for it (because of the optimization to move scrollback around in chunks). not sure if i'm happy about the workarounds here - we should maybe disable that optimization if no scrollback at all was requested, but this at least gets tests passing for now
m---------libvt1000
-rw-r--r--src/screen.rs30
2 files changed, 26 insertions, 4 deletions
diff --git a/libvt100 b/libvt100
-Subproject bd9fc2ba0396f04df399c1f685aacced8412851
+Subproject 32f97d8385d591ec4026f3fb5a1ab8e34e12a06
diff --git a/src/screen.rs b/src/screen.rs
index fd143d7..1073a6b 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -12,6 +12,12 @@ pub struct Screen(*mut types::ScreenImpl);
struct ScreenGridPrefix {
cur: types::Loc,
max: types::Loc,
+ saved: types::Loc,
+ scroll_top: libc::c_int,
+ scroll_bottom: libc::c_int,
+ row_count: libc::c_int,
+ row_capacity: libc::c_int,
+ row_top: libc::c_int,
}
#[repr(C)]
@@ -79,10 +85,19 @@ impl Screen {
col_end: i32
) -> String {
let Screen(screen_impl) = *self;
+ let prefix: *mut ScreenPrefix = unsafe {
+ std::mem::transmute(screen_impl)
+ };
+
+ // XXX not super happy about this - can we maybe disable the
+ // optimization in libvt100 if no scrollback at all was requested?
+ let grid_max_row = unsafe { (*(*prefix).grid).max.row };
+ let row_count = unsafe { (*(*prefix).grid).row_count };
+
let row_start = std::cmp::min(
std::cmp::max(row_start, 0),
self.rows() - 1
- );
+ ) + row_count - grid_max_row;
let col_start = std::cmp::min(
std::cmp::max(col_start, 0),
self.cols() - 1
@@ -90,7 +105,7 @@ impl Screen {
let row_end = std::cmp::min(
std::cmp::max(row_end, 0),
self.rows() - 1
- );
+ ) + row_count - grid_max_row;
let col_end = std::cmp::min(
std::cmp::max(col_end, 0),
self.cols() - 1
@@ -126,10 +141,17 @@ impl Screen {
col_end: i32
) -> String {
let Screen(screen_impl) = *self;
+ let prefix: *mut ScreenPrefix = unsafe {
+ std::mem::transmute(screen_impl)
+ };
+
+ let grid_max_row = unsafe { (*(*prefix).grid).max.row };
+ let row_count = unsafe { (*(*prefix).grid).row_count };
+
let row_start = std::cmp::min(
std::cmp::max(row_start, 0),
self.rows() - 1
- );
+ ) + row_count - grid_max_row;
let col_start = std::cmp::min(
std::cmp::max(col_start, 0),
self.cols() - 1
@@ -137,7 +159,7 @@ impl Screen {
let row_end = std::cmp::min(
std::cmp::max(row_end, 0),
self.rows() - 1
- );
+ ) + row_count - grid_max_row;
let col_end = std::cmp::min(
std::cmp::max(col_end, 0),
self.cols() - 1