-
-
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
5654909
commit 89385bf
Showing
4 changed files
with
99 additions
and
7 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,29 @@ | ||
use crate::graphics::Style; | ||
|
||
#[derive(Clone, Copy, PartialEq)] | ||
pub enum TextAnnotationKind { | ||
/// Add to end of line | ||
Eol, | ||
/// Replace actual text or arbitary cells with annotations. | ||
/// Specifies an offset from the 0th column. | ||
Overlay(usize), | ||
} | ||
|
||
impl TextAnnotationKind { | ||
pub fn is_eol(&self) -> bool { | ||
*self == Self::Eol | ||
} | ||
|
||
pub fn is_overlay(&self) -> bool { | ||
matches!(*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, | ||
pub kind: TextAnnotationKind, | ||
} |
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