commit bb16efc07ef76246616aacea7bb40ac260b26beb Author: Daniel Ramoeller <d....@web.de> Date: Tue Apr 11 13:21:23 2023 +0200
Automatically adjust tab stop width Extend tab stops to the same indentation point instead of a fixed number of spaces. Fix for bug #12736 --- src/TextMetrics.cpp | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index f424118..068eb31 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -899,10 +899,13 @@ Row TextMetrics::tokenizeParagraph(pit_type const pit) const FontMetrics const & fm = theFontMetrics(text_->labelFont(par)); int const wid = fm.width(par.layout().labelsep); row.addMarginSpace(i, wid, *fi, par.lookupChange(i)); - } else if (c == '\t') - row.addSpace(i, theFontMetrics(*fi).width(from_ascii(" ")), + } else if (c == '\t') { + // Make tab stop size adjust automatically depending on char number + int tabStopWidth = 4; + std::string s = std::string(tabStopWidth - i % tabStopWidth, ' '); + row.addSpace(i, theFontMetrics(*fi).width(from_ascii(s)), *fi, par.lookupChange(i)); - else if (c == 0x2028 || c == 0x2029) { + } else if (c == 0x2028 || c == 0x2029) { /** * U+2028 LINE SEPARATOR * U+2029 PARAGRAPH SEPARATOR -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs