您的位置:首页 > 其它

神奇,一旦沉下心来,竟然解决了SciTE中文自动换行问题

2011-03-02 09:52 1246 查看
今天早上刚刚决心仔细阅读Scintilla源码,终于沉下心仔细看了一下SciTE的文档。此前,在网上从未找到过解决方案,竟然给自己解决了。原来,只要设置正确,Scintilla(SciTE)中文自动换行问题就能解决。

步骤如下:

1、按照网上有关处理中文的设置进行

(1)打开Global.properties,并将其内容复制到空白的User.properties中,以下操作都是对User.properties进行,以保护Global.properties。

(2)修改“Internationalisation中的配置,配置清单源码如下:

# Internationalisation

# Japanese input code page 932 and ShiftJIS character set 128

code.page=936

character.set=134

output.code.page=936

character.set=134

Unicode

code.page=65001

code.page=936

character.set=134

# Required for Unicode to work on GTK+:

#LC_CTYPE=en_US.UTF-8

if PLAT_GTK

output.code.page=65001

(以上这一步,都是根据网上有关资料,以解决SciTE中文显示和处理的基本问题)

2、解决中文自动换行的问题,修改相应部分为如下内容(注意,这种设置是根据中文写作的纯文字处理用,不是针对程序员):

# Indentation

tabsize=4

indent.size=4

use.tabs=0

indent.auto=1

#indent.automatic=1

#indent.opening=0

#indent.closing=0

tab.indents=1

#backspace.unindents=0

# Wrapping of long lines

wrap=1

wrap.style=2

cache.layout=3

output.wrap=1

output.cache.layout=3

#wrap.visual.flags=3

#wrap.visual.flags.location=3

#wrap.indent.mode=1

#wrap.visual.startindent=4

中文自动换行问题的关键之处在于:cache.layout=3。根据作者提供的文档,涉及到缓冲的范围,设置为3,在修改后会刷新整个文档,内存耗费达到文档的7倍,但同时动态缩进也将加速25倍!进行文字处理,哪怕是万把字的文档,耗费这点内存对于我们来说实在不算什么啊,速度和效果才是关键!!

英文文档如下,不难懂的(可恨我之前一直没沉下心看英文,只顾在网上找中文资料,白白浪费很多时间,气死!!)

There are four levels of caching. 0 is no caching, 1 caches the line that the caret is on, 2 caches the visible page as well as the caret, and 3 caches the whole document. The more that is cached, the greater the amount of memory used, with 3 using large amounts of memory, 7 times the size of the text in the document. However, level 3 dramatically speeds up dynamic wrapping by around 25 times on large source files so is a very good option to use when wrapping is turned on and memory is plentiful.

至此,保存设置,重新启动SciTE即可。

测试了一下,在WindowsXP中,打开一个100多K的纯中文资料,没有任何中文处理的问题了,自动换行非常漂亮!!

爽!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: