From 141a96e2213a2de0ac042616b04e2a8adfb551dc Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 31 Jul 2021 18:30:50 +1000 Subject: [PATCH] fix inability to map fields from larger to smaller notetype We were using the new item count instead of the old one. https://forums.ankiweb.net/t/issue-changing-note-type-on-2-1-45/11822 --- ts/change-notetype/lib.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ts/change-notetype/lib.ts b/ts/change-notetype/lib.ts index 84661db38..5c612049d 100644 --- a/ts/change-notetype/lib.ts +++ b/ts/change-notetype/lib.ts @@ -178,7 +178,8 @@ export class ChangeNotetypeState { setOldIndex(ctx: MapContext, newIdx: number, oldIdx: number): void { const list = this.info_.mapForContext(ctx); - const realOldIdx = oldIdx < list.length ? oldIdx : null; + const oldNames = this.info_.getOldNames(ctx); + const realOldIdx = oldIdx < oldNames.length ? oldIdx : null; const allowDupes = ctx == MapContext.Field; // remove any existing references?