From: http://blog.csdn.net/aylixuan/article/details/6066126

1.记事本录入以下文字:

/*  * 代替SourceInsight原有的Backspace功能(希望如此)  * 增加了对双字节汉字的支持,在删除汉字的时候也能同时删除汉字的高字节而缓解半个汉字问题  * 能够对光标在汉字中间的情况进行自动修正  *  * 安装:  * ① 复制入SourceInsight安装目录;  * ② Project→Open Project,打开Base项目;  * ③ 将复制过去的SuperBackspace.em添加入Base项目;  * ④ 重启SourceInsight;  * ⑤ Options→Key Assignments,将Marco: SuperBackspace绑定到BackSpace键;  * ⑥ Enjoy!!  *  * This program is free software; you can redistribute it and/or modify  * it under the terms of the GNU General Public License as published by  * the Free Software Foundation; either version 2 of the License, or  * (at your option) any later version.  *  * This program is distributed in the hope that it will be useful,  * but WITHOUT ANY WARRANTY; without even the implied warranty of  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  * GNU General Public License for more details.  *  * You should have received a copy of the GNU General Public License  * along with this program; if not, write to the Free Software  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  */
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;
}
/*参考上面以及SourceInsight中的chm帮助文档;  有缺点:(1)移动箭头也会记录到历史操作步骤,应该能够避免这些操作被记录;(2)函数没有整理,有冗余;  2、删除键——SuperDelete.em  */
macro SuperDelete()
{  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 " "  SuperDelete(1);  stop;  }  // copy current line  text = GetBufLine(hbuf, ln);  // get string length  len = strlen(text);  if (ipos == len || len == 0) {  totalLn = GetBufLineCount (hbuf);  lastText = GetBufLine(hBuf, totalLn-1);  lastLen = strlen(lastText);  if (ipos == lastLen)// end of file  stop;  ln = ln + 1;    // do not use "ln--" for compatibility with older versions  nextline = GetBufLine(hbuf, ln);  nextlen = strlen(nextline);  // combine two lines  text = cat(text, nextline);  // del two lines  DelBufLine(hbuf, ln-1);  DelBufLine(hbuf, ln-1);  // insert the combined one  InsBufLine(hbuf, ln-1, text);  // set the cursor position  SetBufIns(hbuf, ln-1, len);  stop;  }  num = 1; // del one char  if (ipos > 0) {  // 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) || count == 0) && (ipos < len-1))  ipos = ipos + 1;    // adjust cursor position  }  // keeping safe  if (ipos - num < 0)  num = ipos;  }  else {  i = ipos;  count = 0;  while(AsciiFromChar(text[i]) >= 160) {  i = i + 1;  count = count + 1;  if(i == len-1)  break;  }  if(count > 0) {  num = 2;  }  }  text = cat(strmid(text, 0, ipos), strmid(text, ipos+num, len));  DelBufLine(hbuf, ln);  InsBufLine(hbuf, ln, text);  SetBufIns(hbuf, ln, ipos);  stop;
}
//3、左移键——SuperCursorLeft.em
macro IsComplexCharacter()
{  hwnd = GetCurrentWnd();  hbuf = GetCurrentBuf();  if (hbuf == 0)  return 0;  //当前位置  pos = GetWndSelIchFirst(hwnd);  //当前行数  ln = GetBufLnCur(hbuf);  //得到当前行  text = GetBufLine(hbuf, ln);  //得到当前行长度  len = strlen(text);  //从头计算汉字字符的个数  if(pos > 0)  {  i=pos;  count=0;  while(AsciiFromChar(text[i-1]) >= 160)  {    i = i - 1;  count = count+1;  if(i == 0)    break;  }  if((count/2)*2==count|| count==0)  return 0;  else  return 1;  }  return 0;
}
macro moveleft()
{  hwnd = GetCurrentWnd();  hbuf = GetCurrentBuf();  if (hbuf == 0)  stop;   // empty buffer  ln = GetBufLnCur(hbuf);  ipos = GetWndSelIchFirst(hwnd);  if(GetBufSelText(hbuf) != "" || (ipos == 0 && ln == 0))   // 第0行或者是选中文字,则不移动  {  SetBufIns(hbuf, ln, ipos);  stop;  }  if(ipos == 0)  {  preLine = GetBufLine(hbuf, ln-1);  SetBufIns(hBuf, ln-1, strlen(preLine)-1);  }  else  {  SetBufIns(hBuf, ln, ipos-1);  }
}
macro SuperCursorLeft()
{  moveleft();  if(IsComplexCharacter())  moveleft();
}
//  4、右移键——SuperCursorRight.em
macro moveRight()
{  hwnd = GetCurrentWnd();  hbuf = GetCurrentBuf();  if (hbuf == 0)  stop;   // empty buffer  ln = GetBufLnCur(hbuf);  ipos = GetWndSelIchFirst(hwnd);  totalLn = GetBufLineCount(hbuf);  text = GetBufLine(hbuf, ln);    if(GetBufSelText(hbuf) != "")   //选中文字  {  ipos = GetWndSelIchLim(hwnd);  ln = GetWndSelLnLast(hwnd);  SetBufIns(hbuf, ln, ipos);  stop;  }  if(ipos == strlen(text)-1 && ln == totalLn-1) // 末行  stop;        if(ipos == strlen(text))  {  SetBufIns(hBuf, ln+1, 0);  }  else  {  SetBufIns(hBuf, ln, ipos+1);  }
}
macro SuperCursorRight()
{  moveRight();  if(IsComplexCharacter()) // defined in SuperCursorLeft.em  moveRight();
}
//  5、shift+右移键——ShiftCursorRight.em
macro IsShiftRightComplexCharacter()
{  hwnd = GetCurrentWnd();  hbuf = GetCurrentBuf();  if (hbuf == 0)  return 0;  selRec = GetWndSel(hwnd);  pos = selRec.ichLim;  ln = selRec.lnLast;  text = GetBufLine(hbuf, ln);  len = strlen(text);  if(len == 0 || len < pos)  return 1;  //Msg("@len@;@pos@;");  if(pos > 0)  {  i=pos;  count=0;    while(AsciiFromChar(text[i-1]) >= 160)  {    i = i - 1;  count = count+1;     if(i == 0)    break;      }  if((count/2)*2==count|| count==0)  return 0;  else  return 1;  }  return 0;
}
macro shiftMoveRight()
{  hwnd = GetCurrentWnd();  hbuf = GetCurrentBuf();  if (hbuf == 0)  stop;    ln = GetBufLnCur(hbuf);  ipos = GetWndSelIchFirst(hwnd);  totalLn = GetBufLineCount(hbuf);  text = GetBufLine(hbuf, ln);    selRec = GetWndSel(hwnd);     curLen = GetBufLineLength(hbuf, selRec.lnLast);  if(selRec.ichLim == curLen+1 || curLen == 0)  {    if(selRec.lnLast == totalLn -1)  stop;  selRec.lnLast = selRec.lnLast + 1;    selRec.ichLim = 1;  SetWndSel(hwnd, selRec);  if(IsShiftRightComplexCharacter())  shiftMoveRight();  stop;  }  selRec.ichLim = selRec.ichLim+1;  SetWndSel(hwnd, selRec);
}
macro SuperShiftCursorRight()
{         if(IsComplexCharacter())  SuperCursorRight();  shiftMoveRight();  if(IsShiftRightComplexCharacter())  shiftMoveRight();
}  6、shift+左移键——ShiftCursorLeft.em
macro IsShiftLeftComplexCharacter()
{  hwnd = GetCurrentWnd();  hbuf = GetCurrentBuf();  if (hbuf == 0)  return 0;  selRec = GetWndSel(hwnd);  pos = selRec.ichFirst;  ln = selRec.lnFirst;  text = GetBufLine(hbuf, ln);  len = strlen(text);  if(len == 0 || len < pos)  return 1;  //Msg("@len@;@pos@;");  if(pos > 0)  {  i=pos;  count=0;    while(AsciiFromChar(text[i-1]) >= 160)  {    i = i - 1;  count = count+1;     if(i == 0)    break;      }  if((count/2)*2==count|| count==0)  return 0;  else  return 1;  }  return 0;
}
macro shiftMoveLeft()
{  hwnd = GetCurrentWnd();  hbuf = GetCurrentBuf();  if (hbuf == 0)  stop;    ln = GetBufLnCur(hbuf);  ipos = GetWndSelIchFirst(hwnd);  totalLn = GetBufLineCount(hbuf);  text = GetBufLine(hbuf, ln);    selRec = GetWndSel(hwnd);     //curLen = GetBufLineLength(hbuf, selRec.lnFirst);  //Msg("@curLen@;@selRec@");  if(selRec.ichFirst == 0)  {    if(selRec.lnFirst == 0)  stop;  selRec.lnFirst = selRec.lnFirst - 1;  selRec.ichFirst = GetBufLineLength(hbuf, selRec.lnFirst)-1;  SetWndSel(hwnd, selRec);  if(IsShiftLeftComplexCharacter())  shiftMoveLeft();  stop;  }  selRec.ichFirst = selRec.ichFirst-1;  SetWndSel(hwnd, selRec);
}
macro SuperShiftCursorLeft()
{  if(IsComplexCharacter())  SuperCursorLeft();  shiftMoveLeft();  if(IsShiftLeftComplexCharacter())  shiftMoveLeft();
}

2.保存为uperBackspace.em按说明进行操作

3.欣赏效果

PS:改变comment字体,可以使中文紧凑显示.

让source insight更好的支持中文相关推荐

  1. Source insight 4.0安装详情(中文)

    Source insight 是一个强大的编译器,提供了快速和革新的访问源代码和源信息的能力.与众多其它编辑器产品不同.另一方面,在碰到巨大的项目下确实是个神器. 1.通过网盘链接下载压缩包,如果无效 ...

  2. Source Insight乱码的解决方案,SI不支持UTF-8字符编码乱码

    最近使用source insight查看一些开源代码,显示中文就乱码,据说是因为source insight不支持utf-8编码,默认编码方式为ANSI码.所以需要将utf-8等非ANSI码的文件转换 ...

  3. Android Studio NDK 代码 Source Insight调试 (NDK 目前开发方案 | NDK 编译 | 导入 so 库 | 项目编码转换)

    作者 : 韩曙亮 转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/52088039 最近在移植一个 JNI 项目, 比较纠结, A ...

  4. Source Insight乱码解决方案

    [原因]:SI不支持UTF-8字符编码乱码 最近使用source insight查看一些开源代码,显示中文就乱码,因为source insight不支持utf-8编码,默认编码方式为ANSI码.所以需 ...

  5. 创建source insight (.PR文件)工程

    创建一个source insight 工程 启动source insight之后,默认支持的文件类型中没有.S汇编文件 单击Options -> Document Options ,在File ...

  6. 让Source Insight完美支持中文注释 (转)

    如何让source insight支持中文注释,解决回车删除,移动光标出现乱码的问题?下面是解决方案: -------Source Insight3 中文操作(左右键.删除和后退键)支持宏------ ...

  7. 解决了 source insight 设置为 微软雅黑后 中文字体重影

    换了win7 64位. 重新设置source insight 字体大小,因为这个18寸的屏幕,看在19寸上合适的字体,显得太大,每次看混乱的代码都窝火.. 我的眼睛啊,我的审美啊.. 红色字的方法解决 ...

  8. source insight删除保存路径为中文的project工程项目报错的解决办法

    http://blog.csdn.net/yixilee/archive/2010/09/01/5855663.aspx source insight删除已加载的project工程项目报错的解决办法 ...

  9. 错误: -source 1.6 中不支持 diamond 运算符 (请使用 -source 7 或更高版本以启用 diamond 运算符)

    今天晚上在AS上运行校长项目时,报错如下: Error:(71, 35) 错误: -source 1.6 中不支持 diamond 运算符(请使用 -source 7 或更高版本以启用 diamond ...

最新文章

  1. 【快速上手mac必备】常用优质mac软件推荐(音视频、办公、软件开发、辅助工具、系统管理、云存储)
  2. 使用SQLite删除Mac OS X 中launchpad里的快捷方式
  3. PS5穿越云层3D文字
  4. 机器学习的数学,从入门到不放弃(文末彩蛋)
  5. 数据库面试题【十八、优化关联查询优化子查询优化LIMIT分页优化UNION查询优化WHERE子句】
  6. Razor Templating Engine
  7. python gui button回调函数运行完成后弹出窗口_嵌入式设备GUI开发之GTK+入门(一)...
  8. Win8 Metro(C#)数字图像处理--2.40二值图像轮廓提取算法
  9. leetcode python3 简单题160. Intersection of Two Linked Lists
  10. Tcl与Design Compiler (八)——DC的逻辑综合与优化
  11. sqlalchemy mysql配置中怎么设置utf8_python – 使用SQLAlchemy和pymysql,如何设置连接以使用utf8mb4?...
  12. Navicat Premium 12.1.21 最新版激活工具及方法
  13. 基于PLC四层电梯模型控制系统课程设计
  14. Day530.图灵学院之面试题④ -面经
  15. OSEK直接网络管理软件开发
  16. 费雪MOGAFX方程式是什么?(三)
  17. 计算机毕业设计谢辞怎么写,计算机论文致谢范文计算机专业本科毕业设计论文致谢写...
  18. 经典C语言算法题之快乐数
  19. 孝经白话:诸侯章第三
  20. Android开机向导启动流程分析

热门文章

  1. 制作 Windows8   to Go
  2. sunspot 查询语法
  3. 关于使用pdf.js预览pdf的一些问题
  4. 理解Java里面的必检异常和非必检异常
  5. Python中的If,Elif和Else语句
  6. react vs 2017_我在React Europe 2017上学到了什么
  7. C# 动态创建数据库三(MySQL)
  8. BZOJ3453 XLkxc(拉格朗日插值)
  9. ViewPager中Fragment的重复创建、复用问题
  10. 【bzoj4399】魔法少女LJJ 并查集+权值线段树合并