From afd7fca4cb9f461f50469d6c9eb154d7481694b8 Mon Sep 17 00:00:00 2001 From: llama <100429699+iamllama@users.noreply.github.com> Date: Mon, 13 Jan 2025 10:42:31 +0800 Subject: [PATCH] fix csv columns breaking when not contiguous (#3690) --- rslib/src/import_export/text/csv/export.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/rslib/src/import_export/text/csv/export.rs b/rslib/src/import_export/text/csv/export.rs index edf3d3ca1..885035b7e 100644 --- a/rslib/src/import_export/text/csv/export.rs +++ b/rslib/src/import_export/text/csv/export.rs @@ -222,13 +222,23 @@ impl NoteContext { } fn deck_column(&self) -> Option { - 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 { - 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> {