Source Insight 多行注释

2025-09-28 04:28:02

1、打开Source Insight,【项目】---【打开项目】,打开base项目;

Source Insight 多行注释

Source Insight 多行注释

2、在utils.em代码当中添加如下代码:

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          }             if(StrMid(buf, 0, 1) == "/") {       //需要取消注释,防止只有单字符的行              if(StrMid(buf, 1, 2) == "/"){                  PutBufLine(hbuf, Ln, StrMid(buf, 2, Strlen(buf)))              }          }             if(StrMid(buf,0,1) != "/"){          //需要添加注释              PutBufLine(hbuf, Ln, Cat("//", buf))          }          Ln = Ln + 1      }         SetWndSel(hwnd, selection)  }  

3、【选项】---【菜单分配】,命令栏选择刚才加入的宏 MultiLineComment,menu栏选择你方便操作的菜单就行,一般选择工作,点击插入;

Source Insight 多行注释

4、点击确定后,会在菜单栏显示工作菜单,在工作菜单下拉列表中就有 MultiLineComment,今后使用时,选中要注释的行,点击这个标签就注释掉了。

Source Insight 多行注释

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢