From 173493b1a8da409342cf0c58d36c6ca5ae7263be Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 31 Jul 2020 22:03:25 +0100 Subject: [PATCH] Try to store the actual sheet #, but don't store 1 for non-root sheet. Fixes https://gitlab.com/kicad/code/kicad/issues/5021 --- eeschema/files-io.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 71340e7fa4..489e6b0f2b 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -716,6 +716,13 @@ bool SCH_EDIT_FRAME::SaveProject() screen->SetFileName( tmpFn.GetFullPath() ); } + std::vector& sheets = screen->GetClientSheetPaths(); + + if( sheets.size() == 1 ) + screen->m_ScreenNumber = sheets[0].GetPageNumber(); + else + screen->m_ScreenNumber = 0; // multiple uses; no way to store the real sheet # + success &= SaveEEFile( screens.GetSheet( i ) ); }