#133 parse out double-width/double-height, but do not render
This commit is contained in:
1 parent
d2e2c5dec6
commit
c19f330194
3 files changed
+111
No files matched your search
@@ -3579,6 +3579,23 @@ impl<'a> Performer<'a> {
|
||||
Esc::Code(EscCode::DecSaveCursorPosition) => self.dec_save_cursor(),
|
||||
Esc::Code(EscCode::DecRestoreCursorPosition) => self.dec_restore_cursor(),
|
||||
|
||||
Esc::Code(EscCode::DecDoubleHeightTopHalfLine) => {
|
||||
let idx = self.screen.phys_row(self.cursor.y);
|
||||
self.screen.line_mut(idx).set_double_height_top();
|
||||
}
|
||||
Esc::Code(EscCode::DecDoubleHeightBottomHalfLine) => {
|
||||
let idx = self.screen.phys_row(self.cursor.y);
|
||||
self.screen.line_mut(idx).set_double_height_bottom();
|
||||
}
|
||||
Esc::Code(EscCode::DecDoubleWidthLine) => {
|
||||
let idx = self.screen.phys_row(self.cursor.y);
|
||||
self.screen.line_mut(idx).set_double_width();
|
||||
}
|
||||
Esc::Code(EscCode::DecSingleWidthLine) => {
|
||||
let idx = self.screen.phys_row(self.cursor.y);
|
||||
self.screen.line_mut(idx).set_single_width();
|
||||
}
|
||||
|
||||
Esc::Code(EscCode::DecScreenAlignmentDisplay) => {
|
||||
// This one is just to make vttest happy;
|
||||
// its original purpose was for aligning the CRT.
|
||||
|
||||
@@ -85,6 +85,15 @@ pub enum EscCode {
|
||||
/// https://vt100.net/docs/vt510-rm/DECALN.html
|
||||
DecScreenAlignmentDisplay = esc!('#', '8'),
|
||||
|
||||
/// DECDHL - DEC double-height line, top half
|
||||
DecDoubleHeightTopHalfLine = esc!('#', '3'),
|
||||
/// DECDHL - DEC double-height line, bottom half
|
||||
DecDoubleHeightBottomHalfLine = esc!('#', '4'),
|
||||
/// DECSWL - DEC single-width line
|
||||
DecSingleWidthLine = esc!('#', '5'),
|
||||
/// DECDWL - DEC double-width line
|
||||
DecDoubleWidthLine = esc!('#', '6'),
|
||||
|
||||
/// These are typically sent by the terminal when keys are pressed
|
||||
ApplicationModeArrowUpPress = esc!('O', 'A'),
|
||||
ApplicationModeArrowDownPress = esc!('O', 'B'),
|
||||
|
||||
@@ -26,6 +26,19 @@ bitflags! {
|
||||
/// true if this line should be displayed with
|
||||
/// foreground/background colors reversed
|
||||
const REVERSE = 1<<4;
|
||||
|
||||
/// true if this line should be displayed with
|
||||
/// in double-width
|
||||
const DOUBLE_WIDTH = 1<<5;
|
||||
|
||||
/// true if this line should be displayed
|
||||
/// as double-height top-half
|
||||
const DOUBLE_HEIGHT_TOP = 1<<6;
|
||||
|
||||
/// true if this line should be displayed
|
||||
/// as double-height bottom-half
|
||||
const DOUBLE_HEIGHT_BOTTOM = 1<<7;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,6 +190,78 @@ impl Line {
|
||||
self.bits |= LineBits::DIRTY;
|
||||
}
|
||||
|
||||
/// Check whether the line is single-width.
|
||||
#[inline]
|
||||
pub fn is_single_width(&self) -> bool {
|
||||
((self.bits & LineBits::DOUBLE_WIDTH) != LineBits::DOUBLE_WIDTH)
|
||||
&& ((self.bits & LineBits::DOUBLE_HEIGHT_TOP) != LineBits::DOUBLE_HEIGHT_TOP)
|
||||
&& ((self.bits & LineBits::DOUBLE_HEIGHT_BOTTOM) != LineBits::DOUBLE_HEIGHT_BOTTOM)
|
||||
}
|
||||
|
||||
/// Force single-width. This also implicitly sets
|
||||
/// double-height-(top/bottom) and dirty.
|
||||
#[inline]
|
||||
pub fn set_single_width(&mut self) {
|
||||
self.bits &= !LineBits::DOUBLE_WIDTH;
|
||||
self.bits &= !LineBits::DOUBLE_HEIGHT_TOP;
|
||||
self.bits &= !LineBits::DOUBLE_HEIGHT_BOTTOM;
|
||||
self.bits |= LineBits::DIRTY;
|
||||
}
|
||||
|
||||
/// Check whether the line is double-width and not double-height.
|
||||
#[inline]
|
||||
pub fn is_double_width(&self) -> bool {
|
||||
((self.bits & LineBits::DOUBLE_WIDTH) == LineBits::DOUBLE_WIDTH)
|
||||
&& ((self.bits & LineBits::DOUBLE_HEIGHT_TOP) != LineBits::DOUBLE_HEIGHT_TOP)
|
||||
&& ((self.bits & LineBits::DOUBLE_HEIGHT_BOTTOM) != LineBits::DOUBLE_HEIGHT_BOTTOM)
|
||||
}
|
||||
|
||||
/// Force double-width. This also implicitly sets
|
||||
/// double-height-(top/bottom) and dirty.
|
||||
#[inline]
|
||||
pub fn set_double_width(&mut self) {
|
||||
self.bits |= LineBits::DOUBLE_WIDTH;
|
||||
self.bits &= !LineBits::DOUBLE_HEIGHT_TOP;
|
||||
self.bits &= !LineBits::DOUBLE_HEIGHT_BOTTOM;
|
||||
self.bits |= LineBits::DIRTY;
|
||||
}
|
||||
|
||||
/// Check whether the line is double-height-top.
|
||||
#[inline]
|
||||
pub fn is_double_height_top(&self) -> bool {
|
||||
((self.bits & LineBits::DOUBLE_WIDTH) == LineBits::DOUBLE_WIDTH)
|
||||
&& ((self.bits & LineBits::DOUBLE_HEIGHT_TOP) == LineBits::DOUBLE_HEIGHT_TOP)
|
||||
&& ((self.bits & LineBits::DOUBLE_HEIGHT_BOTTOM) != LineBits::DOUBLE_HEIGHT_BOTTOM)
|
||||
}
|
||||
|
||||
/// Force double-height top-half. This also implicitly sets
|
||||
/// double-width and dirty.
|
||||
#[inline]
|
||||
pub fn set_double_height_top(&mut self) {
|
||||
self.bits |= LineBits::DOUBLE_WIDTH;
|
||||
self.bits |= LineBits::DOUBLE_HEIGHT_TOP;
|
||||
self.bits &= !LineBits::DOUBLE_HEIGHT_BOTTOM;
|
||||
self.bits |= LineBits::DIRTY;
|
||||
}
|
||||
|
||||
/// Check whether the line is double-height-bottom.
|
||||
#[inline]
|
||||
pub fn is_double_height_bottom(&self) -> bool {
|
||||
((self.bits & LineBits::DOUBLE_WIDTH) == LineBits::DOUBLE_WIDTH)
|
||||
&& ((self.bits & LineBits::DOUBLE_HEIGHT_TOP) != LineBits::DOUBLE_HEIGHT_TOP)
|
||||
&& ((self.bits & LineBits::DOUBLE_HEIGHT_BOTTOM) == LineBits::DOUBLE_HEIGHT_BOTTOM)
|
||||
}
|
||||
|
||||
/// Force double-height bottom-half. This also implicitly sets
|
||||
/// double-width and dirty.
|
||||
#[inline]
|
||||
pub fn set_double_height_bottom(&mut self) {
|
||||
self.bits |= LineBits::DOUBLE_WIDTH;
|
||||
self.bits &= !LineBits::DOUBLE_HEIGHT_TOP;
|
||||
self.bits |= LineBits::DOUBLE_HEIGHT_BOTTOM;
|
||||
self.bits |= LineBits::DIRTY;
|
||||
}
|
||||
|
||||
/// If we have any cells with an implicit hyperlink, remove the hyperlink
|
||||
/// from the cell attributes but leave the remainder of the attributes alone.
|
||||
pub fn invalidate_implicit_hyperlinks(&mut self) {
|
||||
|
||||
Reference in new issue
Block a user