Fix missing indent level for nested lists

This commit is contained in:
jpirnay
2026-05-15 23:07:57 +02:00
parent ef70d1d8c8
commit c5ad8c7049
3 changed files with 13 additions and 5 deletions
@@ -1054,6 +1054,12 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
blockStyle.alignment = cssStyle.textAlign;
blockStyle.textAlignDefined = true;
}
// For <li> 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<int>(std::min(self->listStack.size(), size_t(3)));
blockStyle.marginLeft = static_cast<int16_t>(emSize * 1.5f * depth);
}
self->startNewTextBlock(blockStyle);
self->updateEffectiveInlineStyle();
@@ -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));
}
+1 -1
View File
@@ -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;