Hierarchical sheet creation logic does not apply to filename field editing
# Description Look at the videos and steps to reproduce. # Steps to reproduce 1. Open standalone eeschema, create root sheet, save it; 2. Create 1st subsheet, add contents to it "sheet 1 cont", do not save nothing; 2. Make a duplicate of 1st subsheet; 3. Rename the new 2nd subsheet by editing filename field the sheet **(BUG 1 here)**; 4. Browse both sheets; ![4700w](/uploads/aafd37ee296327255a04d4a6ae9208b8/4700w.mp4) At this point, it is expected to have three different sheets in the memory: a) Root sheet; b) Initial 1st subsheet with content of "sheet 1 cont"; c) 2nd subsheet, with different filename, but with contents, copied from "sheet 1 cont". Have three sheets with non linked contents between them; ------- I reality, only root sheet and initial subsheet coexists in the memory, there is no 3rd sheet (2nd subsheet). 5. Look at filesystem. Only root kicad_sch exists in the filesystem (probably this is ok); 6. Click save. Look at filesystem now; 7. Only 1st subsheet is created (visible only root and 1st subsheet in filesystem). ![4859f](/uploads/81f6a7bc2d624f51b1a0ea139fdb3c67/4859f.mp4) It is expected to have three sheets, as described in step c). One can browse non existing 2nd subsheet, having different filename and title (**BUG 1a here**), which is definitely a bug. It is expected for "edit hierarchical filename field" action to act as "Save this hierarchical sheet as new sheet", silently, in the background. # Workaround 8. Close eeschema, relaunch; 9. Error about 2nd subsheet not found is thrown; 10. Navigate into 2nd subsheet (empty document is shown); 11. Click save; 12. Only now 2nd subsheet is created on the filesystem. # KiCad Version ``` Application: KiCad Schematic Editor (64-bit) Version: (5.99.0-11043-g1a35d8ba5d), release build Libraries: wxWidgets 3.1.5 libcurl/7.74.0-DEV Schannel zlib/1.2.11 Platform: Windows 10 (build 19042), 64-bit edition, 64 bit, Little endian, wxMSW Build Info: Date: Jun 15 2021 21:01:02 wxWidgets: 3.1.5 (wchar_t,STL containers) Boost: 1.75.0 OCC: 7.5.0 Curl: 7.74.0-DEV ngspice: 34 Compiler: Visual C++ 1928 without C++ ABI Build settings: KICAD_USE_OCC=ON KICAD_SPICE=ON ```
issue