Skip to content

Commit

Permalink
fix csv columns breaking when not contiguous (#3690)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamllama authored Jan 13, 2025
1 parent b6afddd commit afd7fca
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions rslib/src/import_export/text/csv/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,23 @@ impl NoteContext {
}

fn deck_column(&self) -> Option<usize> {
self.with_deck
.then(|| 1 + self.notetype_column().unwrap_or_default())
self.with_deck.then(|| {
1 + self
.notetype_column()
.or_else(|| self.guid_column())
.unwrap_or_default()
})
}

fn tags_column(&self) -> Option<usize> {
self.with_tags
.then(|| 1 + self.deck_column().unwrap_or_default() + self.field_columns)
self.with_tags.then(|| {
1 + self
.deck_column()
.or_else(|| self.notetype_column())
.or_else(|| self.guid_column())
.unwrap_or_default()
+ self.field_columns
})
}

fn record<'c, 's: 'c, 'n: 'c>(&'s self, note: &'n Note) -> impl Iterator<Item = Cow<'c, [u8]>> {
Expand Down

0 comments on commit afd7fca

Please sign in to comment.