-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial text annotations support
Currently supports putting annotations at EOL and overlaying.
- Loading branch information
1 parent
ebccc96
commit 4fe1e11
Showing
4 changed files
with
94 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use crate::graphics::Style; | ||
|
||
#[derive(Clone, Copy, PartialEq)] | ||
pub enum TextAnnotationType { | ||
/// Add to end of line | ||
Eol, | ||
/// Replace actual text or arbitary cells with annotations | ||
Overlay, | ||
} | ||
|
||
impl TextAnnotationType { | ||
pub fn is_eol(&self) -> bool { | ||
*self == Self::Eol | ||
} | ||
|
||
pub fn is_overlay(&self) -> bool { | ||
*self == Self::Overlay | ||
} | ||
} | ||
|
||
pub struct TextAnnotation { | ||
/// String used to namespace and identify similar annotations | ||
pub scope: String, | ||
pub text: String, | ||
pub style: Style, | ||
pub line: usize, | ||
/// Render at this column, None for Eol | ||
pub offset: Option<usize>, | ||
pub text_type: TextAnnotationType, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters