Reuse verified native suffixes after settled output routines
This commit is contained in:
1 parent
f387b1db61
commit
0117449023
30 files changed
+791
-77
No files matched your search
@@ -3,7 +3,7 @@ use std::sync::Arc;
|
||||
|
||||
use super::xe_encoding::{Character, Encoding};
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
struct XePhysical {
|
||||
encoding: Encoding,
|
||||
autodetected: Option<(Encoding, usize)>,
|
||||
@@ -267,14 +267,14 @@ mod tests {
|
||||
assert_eq!(chars, "é界 B C ");
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Copy)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
enum LineState {
|
||||
New,
|
||||
Middle,
|
||||
Skip,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
enum LineBreaks {
|
||||
Physical,
|
||||
Generated(Option<char>),
|
||||
@@ -297,6 +297,21 @@ pub(super) struct Mouth {
|
||||
}
|
||||
|
||||
impl Mouth {
|
||||
pub(super) fn same_unread_input(&self, other: &Self) -> bool {
|
||||
self.source == other.source
|
||||
&& self.profile == other.profile
|
||||
&& self.offset == other.offset
|
||||
&& self.line == other.line
|
||||
&& self.cursor == other.cursor
|
||||
&& self.state == other.state
|
||||
&& self.end_after_line == other.end_after_line
|
||||
&& self.line_breaks == other.line_breaks
|
||||
&& self.line_number == other.line_number
|
||||
&& self.xe == other.xe
|
||||
&& self.invalid_utf8 == other.invalid_utf8
|
||||
&& self.data[self.offset..] == other.data[other.offset..]
|
||||
}
|
||||
|
||||
pub(super) fn physical_frontier(&self) -> Option<usize> {
|
||||
(matches!(self.line_breaks, LineBreaks::Physical) && !self.end_after_line && self.offset > 0)
|
||||
.then_some(self.offset)
|
||||
|
||||
Reference in new issue
Block a user