From b3b6f23320d9ad8b8891a71d1ff289ccaf329edf Mon Sep 17 00:00:00 2001 From: Vovodroid Date: Sat, 7 Oct 2023 04:03:02 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Tweak=20an?= =?UTF-8?q?=20'if'=20block=20(#26300)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/menu/menu_media.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_media.cpp b/Marlin/src/lcd/menu/menu_media.cpp index 26f7a0517d..daa396601f 100644 --- a/Marlin/src/lcd/menu/menu_media.cpp +++ b/Marlin/src/lcd/menu/menu_media.cpp @@ -126,16 +126,18 @@ void menu_media_filelist() { else if (card.isMounted()) ACTION_ITEM_F(F(LCD_STR_FOLDER " .."), lcd_sd_updir); - if (ui.should_draw()) for (int16_t i = 0; i < fileCnt; i++) { - if (_menuLineNr == _thisItemNr) { - card.selectFileByIndexSorted(i); - if (card.flag.filenameIsDir) - MENU_ITEM(sdfolder, MSG_MEDIA_MENU, card); - else - MENU_ITEM(sdfile, MSG_MEDIA_MENU, card); + if (ui.should_draw()) { + for (int16_t i = 0; i < fileCnt; i++) { + if (_menuLineNr != _thisItemNr) + SKIP_ITEM(); + else { + card.selectFileByIndexSorted(i); + if (card.flag.filenameIsDir) + MENU_ITEM(sdfolder, MSG_MEDIA_MENU, card); + else + MENU_ITEM(sdfile, MSG_MEDIA_MENU, card); + } } - else - SKIP_ITEM(); } END_MENU(); }