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

符号导航

  符号(变量、宏定义、结构定义、枚举、函数等等)在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. MySQL一个语句查出各种整形占用字节数及最大最小值

    直接上码: as min_num union , union , union , union , union ,) union ,) union ,) union ,) union ,); +---- ...

  2. C语言分割字符串

    最近在做一道C语言题目的时候需要用到分割字符串,本来想自己手写的,也不会很麻烦,但想到其他语言都有分割字符串的库函数,C语言怎么会没有呢?所以,在网上搜了一搜,果然有这样的函数,还是很好用的,在此总结 ...

  3. MS SQL Server 数据库分离-SQL语句

    前言 今天在在清理数据库,是MS SQL Server,其中用到分离数据库文件.在这过程中,出现了一个小小的问题:误将数据库日志文件删除了,然后数据就打不开了,除了脱机,其他操作都报错. 数据库分离 ...

  4. Java 批量插入数据(Oracle)

    //批量添加20000条数据用时8秒. try {    String url = "jdbc:oracle:thin:@IP:1521:orcl"; // orcl为数据库的SI ...

  5. linux系统下make & make install

    make,make install都是典型的使用GNU的AUTOCONF和AUTOMAKE产生的程序的安装步骤. make是用来编译的,在命令行输入make命令之后,系统会在当前目录下搜索Makefi ...

  6. Codeforces Round #376A (div2)

    Night at the Museum 题意: 有一个转盘,26个英文字母均匀分布在转盘边缘,转针初始位置在字母a,每次只能转动到相邻的字母,然后输入一个由26个字母组成的字符串(最长100),不复位 ...

  7. Hibernate 表映射 主键生成策略与复合主键

    主要分析三点: 一.数据表和Java类的映射 : 二.单一主键映射和主键的生成策略 : 三.复合主键的表映射 : 一.数据表和Java类的映射  Hibernate封装了数据库DDL语句,只需要将数据 ...

  8. Python中三目计算符的正确用法及短路逻辑

    今天在看别人代码时看到这样一种写法, 感觉是个挺容易踩到的坑, 搞清楚后写出来备忘. 短路逻辑 Python中进行逻辑运算的时候, 默认采用的是一种叫做短路逻辑的运算规则. 名字是很形象的, 下面直接 ...

  9. REST服务介绍二

           之前一篇文章写过REST服务介绍, 今天再次来自回顾一下. REST是一种架构风格. 首次出现在2000年Roy Fielding的博士论文中,Roy Fielding是 HTTP 规范 ...

  10. 源映射(Source Map)详解

    一.什么是源映射 为了提高性能,很多站点都会先压缩 JavaScript 代码然后上线, 但如果代码运行时出现错误,浏览器只会显示在已压缩的代码中的位置,很难确定真正的源码错误位置. 这时源映射就登场 ...