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

符号导航

  符号(变量、宏定义、结构定义、枚举、函数等等)在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. Asp.Net Core 通过中间件防止图片盗链

    一.原理 要实现防盗链,我们就必须先理解盗链的实现原理,提到防盗链的实现原理就不得不从HTTP协议说起,在HTTP协议中,有一个表头字段叫referer,采用URL的格式来表示从哪儿链接到当前的网页或 ...

  2. 在Mac上开发使用yeoman构建Asp.net core项目并且实现分层引用

    1.Yeoman? yeoman是一个自动化脚手架工具.它提供很多generator,generator相当于VisualStudio的模板,用来初始化项目.更多的就不多说了,写一遍都写不完,自己看吧 ...

  3. let与const的区别

    let与const都是只在声明所在的块级作用域内有效. let声明的变量可以改变,值和类型都可以改变,没有限制. const声明的变量不得改变值,这意味着,const一旦声明变量,就必须立即初始化,不 ...

  4. 从 AJAX 到 JSONP的基础学习

    目录索引: 一.AJAX的概念二.POST && GET三.原生实现AJAX简单示例 3.1 实现代码 3.2 重点说明四.框架隐藏域 4.1 基本概念 4.2 后台写入脚本 4.3 ...

  5. Thinking in Java——笔记(19)

    Enumerated Types Basic enum features When you create an enum, an associated class is produced for yo ...

  6. java protected 的细节

    1. java的权限控制--大部分人都被错误洗脑了. 一个重大的坑,或者一个重大的误区,或者说一个洗脑了成千上万java编程者的错误概念就是: public private protected 是基于 ...

  7. powershell脚本,命令行参数传值,并绑定变量的例子

    这是小技巧文章,所以文章不长.但原创唯一,非常重要.我搜了下,还真没有人发 powershell怎样 [命令行 参数 绑定],所以我决定写成博客. 搜索关键字如下: powershell 命令行 参数 ...

  8. python之协程与IO操作

    协程 协程,又称微线程,纤程.英文名Coroutine. 协程的概念很早就提出来了,但直到最近几年才在某些语言(如Lua)中得到广泛应用. 子程序,或者称为函数,在所有语言中都是层级调用,比如A调用B ...

  9. springmvc+mybatis+spring 整合源码项目

    A集成代码生成器 [正反双向(单表.主表.明细表.树形表,开发利器)+快速构建表单; freemaker模版技术 ,0个代码不用写,生成完整的一个模块,带页面.建表sql脚本,处理类,service等 ...

  10. GIT 基本操作

    git 流程:1.查看自己所在分支 git branch 2.切换到开发分支 git checkout develop3.把代码拉下来 git fetch4.合并到自己本地 git merge5.切换 ...