Source Insight 小工具
来源:互联网 发布:如何查找网络打印机 编辑:程序博客网 时间:2024/05/22 10:46
主要解决与光标所在行对齐的问题
代码:
/*-----------------------------------------------函 数 名 : InsertPRINTF功 能 : 插入常用打印 快捷键: Crt+p修 改 者 : dtcwyp日 期 : 2016/05/03-------------------------------------------------*/macro InsertPRINTF()//插入常用的打印{ hwnd = GetCurrentWnd() selection = GetWndSel(hwnd) LnFirst =GetWndSelLnFirst(hwnd) //取首行行号 hbuf = GetCurrentBuf() buf = GetBufLine(hbuf, LnFirst) index = 0 while(index <= strlen(buf)) { if(strlen(buf) == 0) { PutBufLine(hbuf, LnFirst, "printf(\"dtc[%s][%d]\\n\",__FUNCTION__,__LINE__);") } else if(index == strlen(buf)) { PutBufLine(hbuf, LnFirst, cat(StrMid(buf,0,index),"printf(\"dtc[%s][%d]\\n\",__FUNCTION__,__LINE__);")) break } else if(((StrMid(buf, index, index+1) != " ")&&(StrMid(buf, index, index+1) != "\t")) { InsBufLine(hbuf, LnFirst, cat(StrMid(buf,0,index),"printf(\"dtc[%s][%d]\\n\",__FUNCTION__,__LINE__);")) break } index++ } SetWndSel(hwnd, selection)}
主要解决多行注释只在每行的行首:(缺点:要注意每行是否有“//”)
/*-----------------------------------------------函 数 名 : MultiLineComment功 能 : 多 行 注 释 快捷键: Ctrl+/修 改 者 : dtcwyp日 期 : 2017/01/05-------------------------------------------------*/macro MultiLineComment(){ hwnd = GetCurrentWnd() selection = GetWndSel(hwnd) LnFirst =GetWndSelLnFirst(hwnd) //取首行行号 LnLast =GetWndSelLnLast(hwnd) //取末行行号 hbuf = GetCurrentBuf() if(GetBufLine(hbuf, 0) =="//magic-number:tph85666031"){stop} Ln = Lnfirst buf = GetBufLine(hbuf, Ln) len = strlen(buf) while(Ln <= Lnlast) { buf = GetBufLine(hbuf, Ln) //取Ln对应的行 if(buf ==""){ //跳过空行 Ln = Ln + 1 continue } index = 0 while(index < strlen(buf)) { if(((StrMid(buf, index, index+1) != " ")&&(StrMid(buf, index, index+1) != "\t")) { if(strlen(StrMid(buf, index, Strlen(buf))) > 1) { if((StrMid(buf, index, index+1) == "/")&&(StrMid(buf,index+ 1, index+2) == "/")) {//需要取消注释,防止只有单字符的行 PutBufLine(hbuf, Ln, cat(StrMid(buf,0,index),StrMid(buf, index+2, Strlen(buf)))) break } } if(StrMid(buf,index,index+1) !="/") {//需要添加注释 PutBufLine(hbuf, Ln, cat(StrMid(buf,0,index),Cat("//", StrMid(buf, index, Strlen(buf))))) break } } index++ } Ln = Ln + 1 } SetWndSel(hwnd, selection)}
0 0
- Source Insight 小工具
- 小工具
- 小工具
- 小工具
- 小工具
- 小工具
- 小工具
- 小工具
- 小工具
- 小工具
- 小工具
- 小工具
- 小工具
- 小工具
- 小工具
- Source Insight
- Source Insight
- source insight
- android实现下拉框(spinner),自定义大小颜色背景位置
- 自定义View起步:自定义View分类和构造函数
- MongoDB Java Driver 源码分析(3):com.mongodb.DBCollection
- Node.js全局安全位置修改
- 批处理FINDSTR正则表达式用法实例分析
- Source Insight 小工具
- 百度地图集成骑行导航和驾车导航
- SVN忽略文件夹
- 2017百度校园招聘编程题 删除字符构造最长回文字符串(求最长公共子序列的变种)
- mysql 启动失败
- 斐波那契算法的java实现
- dubbo源码解析(一): 扩展点加载(ExtensionLoader)
- 《将博客搬至51CTO》
- Android studio Apk signature scheme v2扫盲