source insigt支持中文不完美,删除键实现
来源:互联网 发布:淘宝体提示语 编辑:程序博客网 时间:2024/05/15 14:40
source insigt支持中文不完美,这里定义了演示如何定义一个宏来实现:
1.先创建一个宏
用Source Insight阅读代码过程中,有时需要添加注释或其他功能宏定义,但是Source Insight中没有这样的快捷键,需要自己先一个宏;两种方法添加:
1).编辑Source Insight程序目录下的utils.em文件(软件自带的一些宏程序代码) 或者 自己创建一个".em"文件.
2).使用记事本或其他编辑器打开,输入代码
macro SuperBackspace()
{
hwnd = GetCurrentWnd();
hbuf = GetCurrentBuf();
if (hbuf == 0)
stop; // empty buffer
// get current cursor postion
ipos = GetWndSelIchFirst(hwnd);
// get current line number
ln = GetBufLnCur(hbuf);
if ((GetBufSelText(hbuf) != "") || (GetWndSelLnFirst(hwnd) != GetWndSelLnLast(hwnd))) {
// sth. was selected, del selection
SetBufSelText(hbuf, " "); // stupid & buggy sourceinsight :(
// del the " "
SuperBackspace(1);
stop;
}
// copy current line
text = GetBufLine(hbuf, ln);
// get string length
len = strlen(text);
// if the cursor is at the start of line, combine with prev line
if (ipos == 0 || len == 0) {
if (ln <= 0)
stop; // top of file
ln = ln - 1; // do not use "ln--" for compatibility with older versions
prevline = GetBufLine(hbuf, ln);
prevlen = strlen(prevline);
// combine two lines
text = cat(prevline, text);
// del two lines
DelBufLine(hbuf, ln);
DelBufLine(hbuf, ln);
// insert the combined one
InsBufLine(hbuf, ln, text);
// set the cursor position
SetBufIns(hbuf, ln, prevlen);
stop;
}
num = 1; // del one char
if (ipos >= 1) {
// process Chinese character
i = ipos;
count = 0;
while (AsciiFromChar(text[i - 1]) >= 160) {
i = i - 1;
count = count + 1;
if (i == 0)
break;
}
if (count > 0) {
// I think it might be a two-byte character
num = 2;
// This idiot does not support mod and bitwise operators
if ((count / 2 * 2 != count) && (ipos < len))
ipos = ipos + 1; // adjust cursor position
}
}
// keeping safe
if (ipos - num < 0)
num = ipos;
// del char(s)
text = cat(strmid(text, 0, ipos - num), strmid(text, ipos, len));
DelBufLine(hbuf, ln);
InsBufLine(hbuf, ln, text);
SetBufIns(hbuf, ln, ipos - num);
stop;
}
Note:
SuperBackspace 为宏名称,注意宏名称不能是中文
3.在Base项目中加入我们修改或是你自己创建的".em"文件,这时在项目符号列表中就会显示我们创建的宏的名称。下面为该宏添加快捷键,选择菜单中"选项-->键分配",在左侧下拉菜单中选择"宏:宏名称",然后点击"分配新键",然后在键盘上按出自己定义的按键(如该热键已定义,软件会提示),最后确定即可。若不在Base项目中添加宏,则也可以在其他项目中添加,但是这个宏在其他项目中不会起作用!
4.完成上面三项,我们已经可以使用快捷键执行我们的宏命令,若是需要将宏命令加入到菜单项中,则选择菜单栏中"选项-->菜单分配",在右侧下拉菜单选择宏命令,在中间上方选择菜单类型即可。
5. 文件来自:
* 2006 丁兆杰 Ding Zhaojie
* 代替SourceInsight原有的Backspace功能(希望如此)
* 增加了对双字节汉字的支持,在删除汉字的时候也能同时删除汉字的高字节而缓解半个汉字问题
* 能够对光标在汉字中间的情况进行自动修正
*
* 安装:
* ① 复制入SourceInsight安装目录;
* ② Project→Open Project,打开Base项目;
* ③ 将复制过去的SuperBackspace.em添加入Base项目;
* ④ 重启SourceInsight;
* ⑤ Options→Key Assignments,将Marco: SuperBackspace绑定到BackSpace键;
* ⑥ Enjoy!!
- source insigt支持中文不完美,删除键实现
- 让Source Insight完美支持中文注释
- 让Source Insight完美支持中文注释
- 让Source Insight完美支持中文注释
- 让Source Insight完美支持中文注释
- 让Source Insight完美支持中文注释
- 让Source Insight完美支持中文注释
- 让Source Insight完美支持中文注释
- 让Source Insight完美支持中文注释
- Source Insight4.0破解,完美支持中文
- source insight 完美支持中文(解决中文乱码)
- source insigt 的 有用配置
- 让Source Insight完美支持中文注释、中文搜索(转)
- Source Insight3 中文操作(左右键、删除和后退键)支持宏
- 让Basicexcel完美支持中文且不改变原有接口
- 让Basicexcel完美支持中文且不改变原有接口
- sourceinsight - 完美支持中文注释
- 完美解决Source Insight 4.0中文乱码
- oracle 数据库 导入导出命令
- 黑马程序员_散列表
- php即点即改实现
- clock and time - C++11, 14 of n
- oracle显示中文乱码,修改字符集
- source insigt支持中文不完美,删除键实现
- MySQL之锁及事务管理
- SilverLight 第一章
- python学习笔记: 一些有用的文件操作函数
- c#中ComboBox 控件默认值的设置
- 英语练习32 Poor Amy
- Oracle SQL建立有效索引减少回表
- Flex与Google Iframe弹出框被Iframe遮盖问题解决办法
- 运用gSoap完成企业级数据存储运用