Skip to content

Commit de827e0

Browse files
author
Martin Rotter
committed
Folding respects current color theme.
1 parent 3656ad0 commit de827e0

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/libtextosaurus/saurus/gui/texteditor.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -625,16 +625,31 @@ void TextEditor::reloadLexer(const Lexer& default_lexer) {
625625
setProperty("fold.compact", "1");
626626
setMarginWidthN(MARGIN_FOLDING, MARGIN_WIDTH_FOLDING);
627627

628-
setFoldFlags(SC_FOLDFLAG_LINEAFTER_CONTRACTED);
628+
setFoldFlags(SC_FOLDFLAG_LINEAFTER_CONTRACTED | SC_FOLDFLAG_LINEBEFORE_CONTRACTED);
629629
setMarginSensitiveN(MARGIN_FOLDING, true);
630630
setMarginMaskN(MARGIN_FOLDING, SC_MASK_FOLDERS);
631+
631632
markerDefine(SC_MARKNUM_FOLDER, SC_MARK_PLUS);
632633
markerDefine(SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS);
633634
markerDefine(SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY);
634-
markerDefine(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY);
635635
markerDefine(SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY);
636-
markerDefine(SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY);
637-
markerDefine(SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY);
636+
markerDefine(SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE);
637+
markerDefine(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNER);
638+
markerDefine(SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNER);
639+
640+
auto default_thm_comp = color_theme.component(SyntaxColorTheme::StyleComponents::Default);
641+
auto paper_thm_comp = color_theme.component(SyntaxColorTheme::StyleComponents::ScintillaPaper);
642+
643+
// Frame and inner part.
644+
markerSetFore(SC_MARKNUM_FOLDER, QCOLOR_TO_SPRT(default_thm_comp.m_colorForeground));
645+
markerSetBack(SC_MARKNUM_FOLDER, QCOLOR_TO_SPRT(paper_thm_comp.m_colorBackground));
646+
markerSetFore(SC_MARKNUM_FOLDEROPEN, QCOLOR_TO_SPRT(default_thm_comp.m_colorForeground));
647+
markerSetBack(SC_MARKNUM_FOLDEROPEN, QCOLOR_TO_SPRT(paper_thm_comp.m_colorBackground));
648+
649+
// Lines.
650+
markerSetBack(SC_MARKNUM_FOLDERSUB, QCOLOR_TO_SPRT(default_thm_comp.m_colorForeground));
651+
markerSetBack(SC_MARKNUM_FOLDERMIDTAIL, QCOLOR_TO_SPRT(default_thm_comp.m_colorForeground));
652+
markerSetBack(SC_MARKNUM_FOLDERTAIL, QCOLOR_TO_SPRT(default_thm_comp.m_colorForeground));
638653

639654
if (color_theme.component(SyntaxColorTheme::StyleComponents::ScintillaCurrentLine).m_colorBackground.isValid()) {
640655
setFoldMarginHiColour(true,

0 commit comments

Comments
 (0)