如何自定义折叠起点

15 views
Skip to first unread message

YuNt

unread,
Aug 20, 2009, 7:28:26 AM8/20/09
to SciTE研究 - 中文小组
在Scintilla Documentation 中提到:
Generally, the fold points of a document are based on the hierarchical
structure of the document contents. In Python, the hierarchy is
determined by indentation and in C++ by brace characters.
而对于tex这样的程序语言来说,折叠点(fold points)是取决于像\begin{} \end 这样的字符的 ,那么该如何去定义?

后来想到的一个方法是扫描文档,将这样的关键字所在行取出来,并将表示折叠段开始(S)的和结束(E)的配对到一起,形成一个数组Group。当响应折
叠点击的时候:
1.取得点击位置所在行 DLine,执行2
2.搜寻Group 的S 元素中看是否有DLine值,如果存在,执行3,反之执行4
3.使用SCI_TOGGLEFOLD(...)等函数将该S与对应的E之间的行折叠起来
4.响应结束

问题是,在foldMargin不能显示出那个折叠符号("+" 、"-"那个)...

综上,该如何直接定义一个语言的折叠点--这样既可以显示折叠符号又可以实现折叠,又或如何在FoldMargin区域显示折叠符号?

大家有什么看法吗?

codex

unread,
Sep 24, 2009, 8:11:51 PM9/24/09
to SciTE研究 - 中文小组
参考scite原码,尤其是各语法扫描部分
Reply all
Reply to author
Forward
0 new messages