From c5ad8c704990781863c100d8fa7a9b41a05cbb7c Mon Sep 17 00:00:00 2001 From: jpirnay Date: Fri, 15 May 2026 23:07:57 +0200 Subject: [PATCH] Fix missing indent level for nested lists --- lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp | 6 ++++++ src/activities/reader/EpubReaderMenuActivity.cpp | 10 ++++++---- src/activities/reader/MdReaderActivity.cpp | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp b/lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp index 4b11f6e3..3aefbc0f 100644 --- a/lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp +++ b/lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp @@ -1054,6 +1054,12 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char* blockStyle.alignment = cssStyle.textAlign; blockStyle.textAlignDefined = true; } + // For
  • with no CSS margin, apply depth-based indent so nested lists are visually + // distinguishable. listStack.size() == 1 for top-level, 2 for first nested, etc. + if (strcmp(name, "li") == 0 && !cssStyle.hasMarginLeft() && !self->listStack.empty()) { + const int depth = static_cast(std::min(self->listStack.size(), size_t(3))); + blockStyle.marginLeft = static_cast(emSize * 1.5f * depth); + } self->startNewTextBlock(blockStyle); self->updateEffectiveInlineStyle(); diff --git a/src/activities/reader/EpubReaderMenuActivity.cpp b/src/activities/reader/EpubReaderMenuActivity.cpp index 7633e66f..676e07b7 100644 --- a/src/activities/reader/EpubReaderMenuActivity.cpp +++ b/src/activities/reader/EpubReaderMenuActivity.cpp @@ -252,15 +252,17 @@ void EpubReaderMenuActivity::buildMenuItems(bool hasFootnotes, bool hasStarredPa // --- Tools --- menuItems.push_back(SettingInfo::Separator(StrId::STR_READER_TOOLS)); - menuItems.push_back( - SettingInfo::Action(StrId::STR_SCREENSHOT_BUTTON, SettingAction::None).withSubmenu(StrId::STR_READER_TOOLS)); - menuItems.push_back( - SettingInfo::Action(StrId::STR_DISPLAY_QR, SettingAction::None).withSubmenu(StrId::STR_READER_TOOLS)); menuItems.push_back( SettingInfo::Action(StrId::STR_MARK_AS_READ, SettingAction::None).withSubmenu(StrId::STR_READER_TOOLS)); menuItems.push_back( SettingInfo::Action(StrId::STR_DELETE_CACHE, SettingAction::None).withSubmenu(StrId::STR_READER_TOOLS)); + menuItems.push_back(SettingInfo::Separator(StrId::STR_NONE_OPT).withSubmenu(StrId::STR_READER_TOOLS)); + menuItems.push_back( + SettingInfo::Action(StrId::STR_SCREENSHOT_BUTTON, SettingAction::None).withSubmenu(StrId::STR_READER_TOOLS)); + menuItems.push_back( + SettingInfo::Action(StrId::STR_DISPLAY_QR, SettingAction::None).withSubmenu(StrId::STR_READER_TOOLS)); menuItems.push_back(SettingInfo::Action(StrId::STR_GO_HOME_BUTTON, SettingAction::None)); + menuItems.push_back(SettingInfo::Separator(StrId::STR_NONE_OPT).withSubmenu(StrId::STR_READER_TOOLS)); menuItems.push_back( SettingInfo::Action(StrId::STR_RENDER_BENCHMARK, SettingAction::None).withSubmenu(StrId::STR_READER_TOOLS)); } diff --git a/src/activities/reader/MdReaderActivity.cpp b/src/activities/reader/MdReaderActivity.cpp index ed7b9267..91bf9c86 100644 --- a/src/activities/reader/MdReaderActivity.cpp +++ b/src/activities/reader/MdReaderActivity.cpp @@ -647,7 +647,7 @@ bool MdReaderActivity::loadPageAtOffset(size_t offset, bool startInCodeBlock, st switch (parsed.blockType) { case MdParser::BlockType::UnorderedList: case MdParser::BlockType::OrderedList: - indent = LIST_INDENT + parsed.indentLevel * LIST_INDENT; + indent = LIST_INDENT + std::min((int)parsed.indentLevel, 2) * LIST_INDENT; break; case MdParser::BlockType::Blockquote: indent = BLOCKQUOTE_INDENT;