Normalize entry parsing and display order
This commit is contained in:
1 parent
2a8c941a65
commit
d21f5bd467
6 files changed
+262
-74
No files matched your search
@@ -25,7 +25,7 @@ pub enum FieldNavigation {
|
||||
|
||||
impl EntryEditor {
|
||||
pub fn new(document: EntryDocument) -> Self {
|
||||
let focused = document.fields().first().map(EntryField::id);
|
||||
let focused = document.display_fields().first().map(|field| field.id());
|
||||
let multiline = document
|
||||
.fields()
|
||||
.iter()
|
||||
@@ -86,7 +86,7 @@ impl EntryEditor {
|
||||
}
|
||||
|
||||
pub fn focused_ratio(&self) -> f32 {
|
||||
let fields = self.document.fields();
|
||||
let fields = self.document.display_fields();
|
||||
self.focused
|
||||
.and_then(|id| fields.iter().position(|field| field.id() == id))
|
||||
.map_or(0.0, |index| {
|
||||
@@ -128,7 +128,7 @@ impl EntryEditor {
|
||||
}
|
||||
|
||||
pub fn navigate(&mut self, navigation: FieldNavigation) {
|
||||
let fields = self.document.fields();
|
||||
let fields = self.document.display_fields();
|
||||
if fields.is_empty() {
|
||||
self.focused = None;
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user