aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-11-06 15:47:10 +0000
committerJesse Luehrs <doy@tozt.net>2019-11-06 15:47:10 +0000
commitb35f9999fbb059b73c54821257565920ddfb4bee (patch)
tree151b2824134ce2d148c58cf7d0d0da472d04349a /src
parentbf8c3de0e5d945167645ecfd4f6de18e048f356c (diff)
downloadvt100-rust-b35f9999fbb059b73c54821257565920ddfb4bee.tar.gz
vt100-rust-b35f9999fbb059b73c54821257565920ddfb4bee.zip
stop pretending to support left/right scroll regions
Diffstat (limited to 'src')
-rw-r--r--src/grid.rs9
-rw-r--r--src/screen.rs31
2 files changed, 10 insertions, 30 deletions
diff --git a/src/grid.rs b/src/grid.rs
index 1f1100d..0e0ff9d 100644
--- a/src/grid.rs
+++ b/src/grid.rs
@@ -304,14 +304,7 @@ impl Grid {
}
}
- // TODO: left/right
- pub fn set_scroll_region(
- &mut self,
- top: u16,
- bottom: u16,
- _left: u16,
- _right: u16,
- ) {
+ pub fn set_scroll_region(&mut self, top: u16, bottom: u16) {
let bottom = bottom.min(self.size().rows - 1);
if top < bottom {
self.scroll_top = top;
diff --git a/src/screen.rs b/src/screen.rs
index 5a3a957..d39b406 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -796,13 +796,8 @@ impl Screen {
}
// CSI r
- fn csr(&mut self, (top, bottom, left, right): (u16, u16, u16, u16)) {
- self.grid_mut().set_scroll_region(
- top - 1,
- bottom - 1,
- left - 1,
- right - 1,
- );
+ fn decstbm(&mut self, (top, bottom): (u16, u16)) {
+ self.grid_mut().set_scroll_region(top - 1, bottom - 1);
}
// osc codes
@@ -899,8 +894,10 @@ impl vte::Perform for Screen {
'h' => self.sm(canonicalize_params_multi(params)),
'l' => self.rm(canonicalize_params_multi(params)),
'm' => self.sgr(canonicalize_params_multi(params)),
- 'r' => self
- .csr(canonicalize_params_csr(params, self.grid().size())),
+ 'r' => self.decstbm(canonicalize_params_decstbm(
+ params,
+ self.grid().size(),
+ )),
_ => {
if log::log_enabled!(log::Level::Warn) {
log::warn!(
@@ -1015,10 +1012,10 @@ fn canonicalize_params_multi(params: &[i64]) -> &[i64] {
}
}
-fn canonicalize_params_csr(
+fn canonicalize_params_decstbm(
params: &[i64],
size: crate::grid::Size,
-) -> (u16, u16, u16, u16) {
+) -> (u16, u16) {
let top = params.get(0).copied().unwrap_or(0);
let top = if top == 0 { 1 } else { i64_to_u16(top) };
@@ -1029,17 +1026,7 @@ fn canonicalize_params_csr(
i64_to_u16(bottom)
};
- let left = params.get(2).copied().unwrap_or(0);
- let left = if left == 0 { 1 } else { i64_to_u16(left) };
-
- let right = params.get(3).copied().unwrap_or(0);
- let right = if right == 0 {
- size.cols
- } else {
- i64_to_u16(right)
- };
-
- (top, bottom, left, right)
+ (top, bottom)
}
fn i64_to_u16(i: i64) -> u16 {