熟悉工具的使用能在一定程度上提高工作效率,但工具永远只是工具,大家要把重点放在内功的修炼上。

符号导航

  符号(变量、宏定义、结构定义、枚举、函数等等)在SI 中的检索非常方便。Ctrl+鼠标左键或Ctrl+=可以立即转到符号的定义处,Alt+/可以打开一个窗口查看符号的定义。F7 浏览或查找工程的全局变量和函数,F8 浏览查找当前文件的全局变量和函数。Ctrl+/打开 Lookup Reference 窗口用于搜索符号在工程中的索引,所有搜索结果在搜索窗口中显示,点击搜索结果左边的红色源链接即可打开其所在位置。Lookup Reference 是在整个工程文件中进行搜索,要只在当前文件或特定的目录下进行搜索,使用 Ctrl+H 或Ctrl+Shfit+H 进行搜索,F3 和 F4 是上一个、下一个搜索结果的快捷键。

  使用Shift+F8 可以让当前的符号在整个工程文件中高亮显示。

参数设置

  SI 有很自由的自定义功能,几乎所有的窗口都可以自定义字体、颜色,可以轻松地把各种类型关键字、变量、标志符、函数、宏、注释等定义为不同的颜色和显示方式(正体或斜体、加粗或正常、加下划线、放大显示等),可以随意的增加修改删除菜单项和快捷键。更重要的是,可以通过自定义命令执行外部程序,也可以通过 SI 自己的宏语言,自己写一段程序实现特定的功能,这些可以提高我们工作的效率,从重复繁琐的工作中解脱出来。

字体选择

  在 SI 中样式是可以被继承,如果要从根本上改变字体,最简单的方式就是直接修改根样式中的字体,因为其它样式都会由此继承而来。选择 Options/Document Options 页面内的 Font Options 中的Screen Fonts 字体,即可改变根样式中的字体。

  SI 中的默认配置为Verdana 字体,是一种非等宽字体,为了使编写的代码在各种编辑器中看起来都有良好的对齐效果,强烈建议使用等宽字体,Courier、New Courier 和宋体等都是较好的选择。

背景色设置

  Options->preference->color->windows background设置背景色(护眼色:85,90,205)

缩进设置

  选择 Options/Document Options 页面,点击其内的Auto Indent 按钮,在弹出的Auto Indenting 窗口中,Auto Indent Type 选择 Smart,取消勾选Smart Indent Options 中的两个可选项。同时 Options->Document Options 中,Tab Width 输入4,取消Expand tabs 复选框。

Edit Condition

  当中代码中有大量的预编译定义,在阅读这样的代码时最痛苦的是不能简单判断程序实际执行的代码分支。大量分支同时存在,常常会混淆我们的视听。比如对于下面的代码:

#ifdef DEV1
……
#else
……
#endif

  如果确定我们当前分析的是 DEV1 的执行情况,那么可以选择上下文件菜单的Edit Condition 选项,在弹出的 Conditional Parsing 窗口中把DEV1 的值设置为True,那么#ifdef DEV1 就等价于#if 1 了,相当注释掉了#else 分枝的代码。反之,设置为 Flase 时,则注释掉#ifdef DEV1 分枝的代码。

中文间距过大问题

  默认情况下,往Source Insight 里输入中文,字间距相当的大。是因为字体设置的原因,进行如下设置如下可解决:
  1. Options->Style Properties,打开样式对话框;

  2. 在左边 Style Name 下找到Comment Multi Line 和 Comment.在其右边对应的 Font 属性框下的Font Name 中选“Pick...” 设置为宋体、常规、小四。确定,退回Style Properties 界面,Size 设为 10。

Smart Rename

  在上下文件菜单中选 Smart Rename 或按Ctrl+'组合键,即可弹出Smart Rename 窗口。它有很强大的功能,但最便捷的使用方式是更改函数内局部变量的名字,操作只作用于函数内部,速度非常快。

恢复 Ctrl+A 的全选功能

  利用自定义快捷键,把功能定义成熟悉的按键。比如一般的编辑器,按下 Ctrl+A 是全选功能,但默认是 SI 的全选没有快捷键,Ctrl+A 默认是保存全部的操作。在 Custom Key 对话框中,通过关键词save 找到save all,更改为Ctrl+Shift+A,通过关键词select 找到select all,更改为Ctrl+A。

添加文件类型

  用户可以定义自己的类型,Options->Document Options->add type,定义文件类型名以及文件名后缀。 勾选 include when adding to projects 在添加目录下文件到工程时该类文件就会添加进 SI 的工程。如果需要将所有文件添加进 SI 的工程,可以定义一种文件类型*.*。

列操作

  先按下Alt 键,接着鼠标左键拖动鼠标进行列选择,然后就可以删除指定的列。

添加自定义功能

  在 SI 中可以自定义命令,方便的调用外部程序。举个例子:
  1. Options->Custom Commands...->Add...,New Command name 随便填入命令的名字;

  2. Run 中写入: ShellExecute open explorer /e,/select,%f;

    意思是打开资源管理器并选中当前文件。%f 为文件名。

  3. 还是同一个对话框里面,选择 Keys->Assign New Key...->按下执行该命令的快捷键下面是一些关于TortoiseSVN 的常用自定义功能(需要更改相应的TSVN 安装目录):

    查看修改(diff): "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:diff /path:%f /notempfile/closeonend

    提交(check in): "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:%f /notempfile/closeonend

    更新(update):"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:update /path:%f /notempfile/closeonend

宏语言使用

  大家可能很少用到SI的宏语言(Source Insight macro language),这是一种功能强大的编程语言,几乎可以实现在编程过程可能使用到的各种功能。这里不准备对如何使用宏语言进行编程作介绍(可参阅SI帮助文档中的“Macro Language Guide”部分。),只介绍如何使用已编好的程序。更多的宏文件在http://www.sourceinsight.com/public/macros/下载。

宏文件导入与使用

  宏文件,以.em 为后缀使用宏语言编写的文件,源文件中的每个“macro 宏名()”定义一个宏函数(功能),为宏名定义菜单或快捷键即可使用该功能。宏文件的使用方法如下:
  1. Project->Open Project

  打开 Base 工程(该工程一般在"我的文档/Source Insight/Projects/Base"中);

  2. Project->Add and Remove Project Files

  加入宏文件;

  3. Options->Menu Assignments(或者把该宏功能定义为快捷键)

  打开 Menu Assignments 窗口,在Command 中输入Macro,选中要使用的宏,添加到合适的菜单中。或者打开 Key Assignment 窗口,选中要使用的宏,点Assigned New Key,选择要使用的快捷键。设置完后,选择对应的菜单项或按快捷键,即可实现宏函数功能。

参考资料

  首选SI 自带的帮助文档(按F1 启动),有非常详细的说明。

macro InsFileHeader()
{
szMyName = "XXX" /* Enter your name */ /* Get current time */
szTime = GetSysTime()
Day = szTime.Day
Month = szTime.Month
Year = szTime.Year
if (Day < )
szDay = "0@Day@"
else
szDay = Day
if (Month < )
szMonth = "0@Month@"
else
szMonth = Month; szFileName = Ask("Enter file name and its extention, for example, \"main.c\": "); /* promote the description of the file*/
szDescription = Ask("Enter the description of file:") hBuf = GetCurrentBuf()
hbuf = GetCurrentBuf()
InsBufLine(hbuf, , "/*")
InsBufLine(hbuf, , " *")
InsBufLine(hbuf, , " *")
InsBufLine(hbuf, , " *\\file @szfileName@")
InsBufLine(hbuf, , " *\\brief @szDescription@.")
InsBufLine(hbuf, , " *")
InsBufLine(hbuf, , " *\\author @szMyName@")
InsBufLine(hbuf, , " *\\version 1.0.0")
InsBufLine(hbuf, , " *\\date @szMonth@\/@szDay@\/@Year@")
InsBufLine(hbuf, , " *")
InsBufLine(hbuf, , " *\\history \\arg 1.0.0 @szMonth@\/@szDay@\/@Year@, @szMyName@, Create file.")
InsBufLine(hbuf, , " */")
} macro InsFunHeader()
{
// Get a handle to the current file buffer and the name
// and location of the current symbol where the cursor is.
hbuf = GetCurrentBuf()
szFunc = GetCurSymbol()
ln = GetSymbolLine(szFunc) szDescription = Ask("Enter the description of function:") // begin assembling the title string
InsBufLine(hbuf, ln + , "/*!")
InsBufLine(hbuf, ln + , " *\\fn @szFunc@()")
InsBufLine(hbuf, ln + , " *\\brief @szDescription@.")
InsBufLine(hbuf, ln + , " *\\details ")
InsBufLine(hbuf, ln + , " * ")
InsBufLine(hbuf, ln + , " *\\param[in] N\/A.")
InsBufLine(hbuf, ln + , " *\\param[out] N\/A.")
InsBufLine(hbuf, ln + , " * ")
InsBufLine(hbuf, ln + , " *\\return N\/A.")
InsBufLine(hbuf, ln + , " *\\retval N\/A.")
InsBufLine(hbuf, ln + , " * ")
InsBufLine(hbuf, ln + , " *\\note")
InsBufLine(hbuf, ln + , " */")
} macro InsVarComments()
{
hwnd = GetCurrentWnd()
ln = GetWndSelLnFirst(hwnd) szDef = Ask("Enter the name of the variable:")
szDescription = Ask("Enter the description of Varaables:") hbuf = GetCurrentBuf()
InsBufLine(hbuf, ln + , "/*!")
InsBufLine(hbuf, ln + , " *\\def @szDef@")
InsBufLine(hbuf, ln + , " *\\brief @szDescription@")
InsBufLine(hbuf, ln + , " */")
} macro addNameTime()
{
szMyName = "XXX" /* Enter your name */ hwnd = GetCurrentWnd()
se = getwndsel(hwnd)
ln = GetWndSelLnFirst(hwnd)
hbuf = GetCurrentBuf()
str = GetBufSelText(hbuf) /* Get current time */
szTime = GetSysTime()
Day = szTime.Day
Month = szTime.Month
Year = szTime.Year
if (Day < )
szDay = "0@Day@"
else
szDay = Day
if (Month < )
szMonth = "0@Month@"
else
szMonth = Month;
hbuf = GetCurrentBuf() if (se.fExtended)
{
str = "/*!<" #str# "*/"
SetBufSelText(hbuf, str)
}
else
{
str = "/*!< @szMyName@ : @szMonth@/@szDay@/@Year@*/"
se.ichFirst = se.iChFirst +
se.ichLim = se.ichLim +
SetBufSelText(hbuf, str)
SetBufIns (hbuf, ln, se.iChFirst)
SetWndSel(hwnd, se)
}
} macro preventIncludeRepeatly()
{
hwnd = GetCurrentWnd()
lnFirst = GetWndSelLnFirst(hwnd)
lnLast = GetWndSelLnLast(hwnd) /* get file name */
szFileName = Ask("Enter name of header file:")
szFileName = toupper(szFileName)
szFileName = cat("__", szFileName)
szFileName = cat(szFileName, "_H__") hbuf = GetCurrentBuf()
InsBufLine(hbuf, lnFirst, "#ifndef @szFileName@")
InsBufLine(hbuf, lnFirst +, "#define @szFileName@")
InsBufLine(hbuf, lnFirst +, "")
InsBufLine(hbuf, lnLast +, "")
InsBufLine(hbuf, lnLast +, "#endif /* @szFileName@ */")
} macro InsertCPlusPlus()
{
hwnd = GetCurrentWnd()
lnFirst = GetWndSelLnFirst(hwnd)
lnLast = GetWndSelLnLast(hwnd) hbuf = GetCurrentBuf()
InsBufLine(hbuf, lnFirst, "#ifdef __cplusplus")
InsBufLine(hbuf, lnFirst +, "extern \"C\" {")
InsBufLine(hbuf, lnFirst +, "#endif")
InsBufLine(hbuf, lnFirst +, "") InsBufLine(hbuf, lnLast +, "")
InsBufLine(hbuf, lnLast +, "#ifdef __cplusplus")
InsBufLine(hbuf, lnLast +, "}")
InsBufLine(hbuf, lnLast +, "#endif")
} macro addComment()
{
hwnd = GetCurrentWnd()
se = getwndsel(hwnd)
ln = GetWndSelLnFirst(hwnd)
hbuf = GetCurrentBuf()
str = GetBufSelText(hbuf) if (se.fExtended)
{
str = "/*!<" #str# "*/"
SetBufSelText(hbuf, str)
}
else
{
str = "/*!< */"
se.ichFirst = se.iChFirst +
se.ichLim = se.ichLim +
SetBufSelText(hbuf, str)
SetBufIns (hbuf, ln, se.iChFirst)
SetWndSel(hwnd, se)
} } macro addFileInformation()
{
addGlobalFunctions()
addPublicFunctions()
addLocalFunctions()
addLocalPrototypes()
addExternPrototypes()
addFunctions()
addVariables()
addTypes()
addDefines()
addIncludeFiles()
addConfigrations()
} macro addConfigrations()
{
hwnd = GetCurrentWnd()
ln = GetWndSelLnFirst(hwnd) hbuf = GetCurrentBuf()
InsBufLine(hbuf, ln, "/**********************************************************************/")
InsBufLine(hbuf, ln +, "/* CONFIGURATIONS */")
InsBufLine(hbuf, ln +, "/**********************************************************************/")
} macro addIncludeFiles()
{
hwnd = GetCurrentWnd()
ln = GetWndSelLnFirst(hwnd) hbuf = GetCurrentBuf()
InsBufLine(hbuf, ln, "/**********************************************************************/")
InsBufLine(hbuf, ln +, "/* INCLUDE_FILES */")
InsBufLine(hbuf, ln +, "/**********************************************************************/") } macro addDefines()
{
hwnd = GetCurrentWnd()
ln = GetWndSelLnFirst(hwnd) hbuf = GetCurrentBuf()
InsBufLine(hbuf, ln, "/**********************************************************************/")
InsBufLine(hbuf, ln +, "/* DEFINES */")
InsBufLine(hbuf, ln +, "/**********************************************************************/") } macro addTypes()
{
hwnd = GetCurrentWnd()
ln = GetWndSelLnFirst(hwnd) hbuf = GetCurrentBuf()
InsBufLine(hbuf, ln, "/**********************************************************************/")
InsBufLine(hbuf, ln +, "/* TYPES */")
InsBufLine(hbuf, ln +, "/**********************************************************************/") } macro addVariables()
{
hwnd = GetCurrentWnd()
ln = GetWndSelLnFirst(hwnd) hbuf = GetCurrentBuf()
InsBufLine(hbuf, ln, "/**********************************************************************/")
InsBufLine(hbuf, ln +, "/* VARIABLES */")
InsBufLine(hbuf, ln +, "/**********************************************************************/") } macro addFunctions()
{
hwnd = GetCurrentWnd()
ln = GetWndSelLnFirst(hwnd) hbuf = GetCurrentBuf()
InsBufLine(hbuf, ln, "/**********************************************************************/")
InsBufLine(hbuf, ln +, "/* FUNCTIONS */")
InsBufLine(hbuf, ln +, "/**********************************************************************/") } macro addExternPrototypes()
{
hwnd = GetCurrentWnd()
ln = GetWndSelLnFirst(hwnd) hbuf = GetCurrentBuf()
InsBufLine(hbuf, ln, "/**********************************************************************/")
InsBufLine(hbuf, ln +, "/* EXTERN_PROTOTYPES */")
InsBufLine(hbuf, ln +, "/**********************************************************************/") } macro addLocalPrototypes()
{
hwnd = GetCurrentWnd()
ln = GetWndSelLnFirst(hwnd) hbuf = GetCurrentBuf()
InsBufLine(hbuf, ln, "/**********************************************************************/")
InsBufLine(hbuf, ln +, "/* LOCAL_PROTOTYPES */")
InsBufLine(hbuf, ln +, "/**********************************************************************/") } macro addLocalFunctions()
{
hwnd = GetCurrentWnd()
ln = GetWndSelLnFirst(hwnd) hbuf = GetCurrentBuf()
InsBufLine(hbuf, ln, "/**********************************************************************/")
InsBufLine(hbuf, ln +, "/* LOCAL_FUNCTIONS */")
InsBufLine(hbuf, ln +, "/**********************************************************************/") } macro addPublicFunctions()
{
hwnd = GetCurrentWnd()
ln = GetWndSelLnFirst(hwnd) hbuf = GetCurrentBuf()
InsBufLine(hbuf, ln, "/**********************************************************************/")
InsBufLine(hbuf, ln +, "/* PUBLIC_FUNCTIONS */")
InsBufLine(hbuf, ln +, "/**********************************************************************/") } macro addGlobalFunctions()
{
hwnd = GetCurrentWnd()
ln = GetWndSelLnFirst(hwnd) hbuf = GetCurrentBuf()
InsBufLine(hbuf, ln, "/**********************************************************************/")
InsBufLine(hbuf, ln +, "/* GLOBAL_FUNCTIONS */")
InsBufLine(hbuf, ln +, "/**********************************************************************/") }
/*======================================================================
* -------Source Insight3 中文操作(左右键、删除和后退键)支持宏-------
* 用原来作者提供的方法使用工程中有的问题,于是换了种方式试了一下,测试OK,
* 现在只需按照下面的说明①--③应用即可,已经测试OK
* 感谢丁兆杰(zhaojie.ding@gmail.com)及互联网上辛勤耕耘的朋友们!!!
* Evan: sdcw@163.com
*
* ① Project→Open Project,打开Base项目,将本文中的所有内容函数复制到utils.em文件的最后
* ② 重启SourceInsight;
* ③ Options→Key Assignments,将下面宏依次与相应按键绑定:
Marco: SuperBackspace绑定到BackSpace键;
Marco: SuperCursorLeft绑定到<-键,
Marco: SuperCursorRight绑定到->键,
Marco: SuperShiftCursorLeft绑定到Shift+<-,
Macro: SuperShiftCursorRight绑定到shift+->,
Macro: SuperDelete绑定到del。
* ④ Enjoy ======================================================================*/
/*======================================================================
1、BackSpace后退键
======================================================================*/
macro SuperBackspace()
{
hwnd = GetCurrentWnd();
hbuf = GetCurrentBuf();
if (hbuf == )
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();
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 == || len == ) {
if (ln <= )
stop; // top of file
ln = ln - ; // 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 = ; // del one char
if (ipos >= ) {
// process Chinese character
i = ipos;
count = ;
while (AsciiFromChar(text[i - ]) >= ) {
i = i - ;
count = count + ;
if (i == )
break;
}
if (count > ) {
// I think it might be a two-byte character
num = ;
// This idiot does not support mod and bitwise operators
if ((count / * != count) && (ipos < len))
ipos = ipos + ; // adjust cursor position
}
}
// keeping safe
if (ipos - num < )
num = ipos;
// del char(s)
text = cat(strmid(text, , ipos - num), strmid(text, ipos, len));
DelBufLine(hbuf, ln);
InsBufLine(hbuf, ln, text);
SetBufIns(hbuf, ln, ipos - num);
stop;
}
/*======================================================================
2、删除键——SuperDelete.em
======================================================================*/
macro SuperDelete()
{
hwnd = GetCurrentWnd();
hbuf = GetCurrentBuf();
if (hbuf == )
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();
stop;
}
// copy current line
text = GetBufLine(hbuf, ln);
// get string length
len = strlen(text); if (ipos == len || len == ) {
totalLn = GetBufLineCount (hbuf);
lastText = GetBufLine(hBuf, totalLn-);
lastLen = strlen(lastText);
if (ipos == lastLen)// end of file
stop;
ln = ln + ; // 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-);
DelBufLine(hbuf, ln-);
// insert the combined one
InsBufLine(hbuf, ln-, text);
// set the cursor position
SetBufIns(hbuf, ln-, len);
stop;
}
num = ; // del one char
if (ipos > ) {
// process Chinese character
i = ipos;
count = ;
while (AsciiFromChar(text[i-]) >= ) {
i = i - ;
count = count + ;
if (i == )
break;
}
if (count > ) {
// I think it might be a two-byte character
num = ;
// This idiot does not support mod and bitwise operators
if (((count / * != count) || count == ) && (ipos < len-))
ipos = ipos + ; // adjust cursor position
}
// keeping safe
if (ipos - num < )
num = ipos;
}
else {
i = ipos;
count = ;
while(AsciiFromChar(text) >= ) {
i = i + ;
count = count + ;
if(i == len-)
break;
}
if(count > ) {
num = ;
}
} text = cat(strmid(text, , 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 == )
return ;
//当前位置
pos = GetWndSelIchFirst(hwnd);
//当前行数
ln = GetBufLnCur(hbuf);
//得到当前行
text = GetBufLine(hbuf, ln);
//得到当前行长度
len = strlen(text);
//从头计算汉字字符的个数
if(pos > )
{
i=pos;
count=;
while(AsciiFromChar(text[i-]) >= )
{
i = i - ;
count = count+;
if(i == )
break;
}
if((count/)*==count|| count==)
return ;
else
return ;
}
return ;
}
macro moveleft()
{
hwnd = GetCurrentWnd();
hbuf = GetCurrentBuf();
if (hbuf == )
stop; // empty buffer ln = GetBufLnCur(hbuf);
ipos = GetWndSelIchFirst(hwnd);
if(GetBufSelText(hbuf) != "" || (ipos == && ln == )) // 第0行或者是选中文字,则不移动
{
SetBufIns(hbuf, ln, ipos);
stop;
}
if(ipos == )
{
preLine = GetBufLine(hbuf, ln-);
SetBufIns(hBuf, ln-, strlen(preLine)-);
}
else
{
SetBufIns(hBuf, ln, ipos-);
}
}
macro SuperCursorLeft()
{
moveleft();
if(IsComplexCharacter())
moveleft();
}
/*======================================================================
4、右移键——SuperCursorRight.em
======================================================================*/
macro moveRight()
{
hwnd = GetCurrentWnd();
hbuf = GetCurrentBuf();
if (hbuf == )
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)- && ln == totalLn-) // 末行
stop;
if(ipos == strlen(text))
{
SetBufIns(hBuf, ln+, );
}
else
{
SetBufIns(hBuf, ln, ipos+);
}
}
macro SuperCursorRight()
{
moveRight();
if(IsComplexCharacter()) // defined in SuperCursorLeft.em
moveRight();
}
/*======================================================================
5、shift+右移键——ShiftCursorRight.em
======================================================================*/
macro IsShiftRightComplexCharacter()
{
hwnd = GetCurrentWnd();
hbuf = GetCurrentBuf();
if (hbuf == )
return ;
selRec = GetWndSel(hwnd);
pos = selRec.ichLim;
ln = selRec.lnLast;
text = GetBufLine(hbuf, ln);
len = strlen(text);
if(len == || len < pos)
return ;
//Msg("@len@;@pos@;");
if(pos > )
{
i=pos;
count=;
while(AsciiFromChar(text[i-]) >= )
{
i = i - ;
count = count+;
if(i == )
break;
}
if((count/)*==count|| count==)
return ;
else
return ;
}
return ;
}
macro shiftMoveRight()
{
hwnd = GetCurrentWnd();
hbuf = GetCurrentBuf();
if (hbuf == )
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+ || curLen == )
{
if(selRec.lnLast == totalLn -)
stop;
selRec.lnLast = selRec.lnLast + ;
selRec.ichLim = ;
SetWndSel(hwnd, selRec);
if(IsShiftRightComplexCharacter())
shiftMoveRight();
stop;
}
selRec.ichLim = selRec.ichLim+;
SetWndSel(hwnd, selRec);
}
macro SuperShiftCursorRight()
{
if(IsComplexCharacter())
SuperCursorRight();
shiftMoveRight();
if(IsShiftRightComplexCharacter())
shiftMoveRight();
}
/*======================================================================
6、shift+左移键——ShiftCursorLeft.em
======================================================================*/
macro IsShiftLeftComplexCharacter()
{
hwnd = GetCurrentWnd();
hbuf = GetCurrentBuf();
if (hbuf == )
return ;
selRec = GetWndSel(hwnd);
pos = selRec.ichFirst;
ln = selRec.lnFirst;
text = GetBufLine(hbuf, ln);
len = strlen(text);
if(len == || len < pos)
return ;
//Msg("@len@;@pos@;");
if(pos > )
{
i=pos;
count=;
while(AsciiFromChar(text[i-]) >= )
{
i = i - ;
count = count+;
if(i == )
break;
}
if((count/)*==count|| count==)
return ;
else
return ;
}
return ;
}
macro shiftMoveLeft()
{
hwnd = GetCurrentWnd();
hbuf = GetCurrentBuf();
if (hbuf == )
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 == )
{
if(selRec.lnFirst == )
stop;
selRec.lnFirst = selRec.lnFirst - ;
selRec.ichFirst = GetBufLineLength(hbuf, selRec.lnFirst)-;
SetWndSel(hwnd, selRec);
if(IsShiftLeftComplexCharacter())
shiftMoveLeft();
stop;
}
selRec.ichFirst = selRec.ichFirst-;
SetWndSel(hwnd, selRec);
}
macro SuperShiftCursorLeft()
{
if(IsComplexCharacter())
SuperCursorLeft();
shiftMoveLeft();
if(IsShiftLeftComplexCharacter())
shiftMoveLeft();
}

Source Insight常用功能设置的更多相关文章

  1. Source Insight 常用设置

    1.背景色选择 要改变背景色Options->preference->windows background->color设置背景色2.解决字符等宽对齐问题    SIS默认字体是VE ...

  2. Source Insight 常用设置和快捷键大全

    Source Insight 常用设置和快捷键大全 退出程序 : Alt+F4 重画屏幕 : Ctrl+Alt+Space 完成语法 : Ctrl+E 复制一行 : Ctrl+K 恰好复制该位置右边的 ...

  3. TeeChart控件的安装与常用 功能设置

    TeeChart控件的安装 TeeChart 7.0 With Source在Delphi 7.0中的安装 一.删除Delphi7自带TeeChart  1.Component -> insta ...

  4. Source Insight常用快捷键及注释快捷键设置

    转:http://blog.csdn.net/tlaff/article/details/6536610 在使用SI过程中,我根据自己的使用习惯修改了它的默认快捷键,并且在配置文件中添加了一些人性化功 ...

  5. Source Insight中文字体设置

    Source Insight是一个面向项目开发的程序编辑器和代码阅读工具,它拥有内置的对C/C++, C#和Java等程序的分析,分析你的源代 码并在你工作的同时动态维护它自己的符号数据库,并自动为你 ...

  6. source insight常用设置问题

    http://www.cnblogs.com/bluestorm/archive/2012/10/28/2743792.html

  7. Android Activity 常用功能设置(全屏、横竖屏等)

    Activity全屏设置 方式1:AndroidManifest.xml <activity android:name="myAcitivty"  android:theme ...

  8. 最新JetBrains PyCharm 使用教程--常用功能设置(三)

    选择代码路径和Python解释器版本 ​ 设置Pycharm菜单字体的大小 ​ 设置编辑器里面字体大小 ​ 设置文件编码 ​ 设置背景颜色 ​ 设置tab键为4个空格 ​ 设置代码内容和关键字颜色 ​ ...

  9. source tree常用功能

    参考地址: https://blog.csdn.net/weixin_39568744/article/details/81413198

随机推荐

  1. VMware Workstation 10.0 正式版官方简体中文下载(附序列号)

    虚拟机界数一数二的王者软件VMWare Workstation 今日推出了最新的VMware Workstation 10.0 版本.该版本最大的更新是加入了简体中文语言,这意味着未来神马汉化包.中文 ...

  2. 基于MVC4+EasyUI的Web开发框架经验总结(16)--使用云打印控件C-Lodop打印页面或套打报关运单信息

    在最新的MVC4+EasyUI的Web开发框架里面,我整合了关于网购运单处理的一个模块,其中整合了客户导单.运单合并.到货扫描.扣仓.出仓.查询等各个模块的操作,里面涉及到一些运单套打的操作,不过由于 ...

  3. authorization与URL授权

    利用Web.config中的authorization标签设置授权属于URL授权. 使用 URL 授权 通过 URL 授权,您可以显式允许或拒绝某个用户名或角色对特定目录的访问权限.为此,请在该目录的 ...

  4. 为什么volatile不能保证原子性而Atomic可以?

    在上篇<非阻塞同步算法与CAS(Compare and Swap)无锁算法>中讲到在Java中long赋值不是原子操作,因为先写32位,再写后32位,分两步操作,而AtomicLong赋值 ...

  5. Netbeans 8.2关于PHP的新特性

    Netbeans 8.2在这个国庆期间终于发布了,其与PHP相关的新特性主要有: 支持PHP 7 详见前面翻译的一篇文章:Netbeans 8.2将支持PHP 7 编辑器功能增强 文档好像没有明确说明 ...

  6. win7下 VirtualBox虚拟机开机后台自启动

    win7下安装个linux虚拟机,学习下非常好. 但是每次使用linux的时候,都是打开virtualBox-->启动安装的linux系统-->再用远程桌面(SSH等)连接 每次手动打开比 ...

  7. C++笔记 之 基础回顾(一)

    1  exe 程序

  8. Java--通过Spring AOP进行事务管理

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  9. java正则表达式入门

    http://www.cnblogs.com/jingmoxukong/p/6026474.html 这篇文章写的不错

  10. PHP7新增 功能

    php7发布已有半月,最近有时间了解一下php7的新特性,当然,这个版本最大的特点是性能的提升.在下并非高手,欢迎大家指出错误,同时期待共同交流 1.在use语句增加了group支持use FooLi ...