日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

让Source Insight完美支持中文注释 (转)

發布時間:2025/5/22 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 让Source Insight完美支持中文注释 (转) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
如何讓source insight支持中文注釋,解決回車刪除,移動光標出現亂碼的問題?下面是解決方案: -------Source Insight3 中文操作(左右鍵、刪除和后退鍵)支持宏------- 感謝丁兆杰(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 ------------解決source insight 中文間距的方法:----------------- 默認情況下,往Source Insight里輸入中文,字間距相當的大,要解決這個問題,具體設置如下: 1. Options->Style Properties 2. 在左邊Style Name下找到Comment Multi Line和Comment.在其右邊對應的Font屬性框下的 Font Name中選“Pick...” 設置為宋體、常規、小四。確定,退回Style Properties界面, Size設為10。最后設置Clolors框下Foreground,點“Pick...”選擇一種自己喜歡的顏色就OK了。 代碼:
  • /*======================================================================
  • 1、BackSpace后退鍵
  • ======================================================================*/
  • macro SuperBackspace()
  • {
  • ????hwnd?=?GetCurrentWnd();
  • ????hbuf?=?GetCurrentBuf();
  • ????if?(hbuf?==?0)
  • ????????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(1);
  • ????????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?==?0?||?len?==?0)?{
  • ????????if?(ln?<=?0)
  • ????????????stop;?//?top of file
  • ????????ln?=?ln?-?1;?//?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?=?1;?//?del one?char
  • ????if?(ipos?>=?1)?{
  • ????????//?process Chinese character
  • ????????i?=?ipos;
  • ????????count?=?0;
  • ????????while?(AsciiFromChar(text[i?-?1])?>=?160)?{
  • ????????????i?=?i?-?1;
  • ????????????count?=?count?+?1;
  • ????????????if?(i?==?0)
  • ????????????????break;
  • ????????}
  • ????????if?(count?>?0)?{
  • ????????????//?I think it might be a two-byte?character
  • ????????????num?=?2;
  • ????????????//?This idiot does?not?support?mod?and?bitwise operators
  • ????????????if?((count?/?2?*?2?!=?count)?&&?(ipos?<?len))
  • ????????????????ipos?=?ipos?+?1;?//?adjust cursor position
  • ????????}
  • ????}
  • ????//?keeping safe
  • ????if?(ipos?-?num?<?0)
  • ????????num?=?ipos;
  • ????//?del?char(s)
  • ????text?=?cat(strmid(text,?0,?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?==?0)
  • ????????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(1);
  • ????????stop;
  • ????}
  • ????//?copy current line
  • ????text?=?GetBufLine(hbuf,?ln);
  • ????//?get?string?length
  • ????len?=?strlen(text);
  • ????if?(ipos?==?len?||?len?==?0)?{
  • totalLn?=?GetBufLineCount?(hbuf);
  • lastText?=?GetBufLine(hBuf,?totalLn-1);
  • lastLen?=?strlen(lastText);
  • ????????if?(ipos?==?lastLen)//?end?of file
  • ???stop;
  • ????????ln?=?ln?+?1;?//?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-1);
  • ????????DelBufLine(hbuf,?ln-1);
  • ????????//?insert the combined one
  • ????????InsBufLine(hbuf,?ln-1,?text);
  • ????????//?set?the cursor position
  • ????????SetBufIns(hbuf,?ln-1,?len);
  • ????????stop;
  • ????}
  • ????num?=?1;?//?del one?char
  • ????if?(ipos?>?0)?{
  • ????????//?process Chinese character
  • ????????i?=?ipos;
  • ????????count?=?0;
  • ??????while?(AsciiFromChar(text[i-1])?>=?160)?{
  • ????????????i?=?i?-?1;
  • ????????????count?=?count?+?1;
  • ????????????if?(i?==?0)
  • ????????????????break;
  • ????????}
  • ????????if?(count?>?0)?{
  • ????????????//?I think it might be a two-byte?character
  • ????????????num?=?2;
  • ????????????//?This idiot does?not?support?mod?and?bitwise operators
  • ????????????if?(((count?/?2?*?2?!=?count)?||?count?==?0)?&&?(ipos?<?len-1))
  • ????????????????ipos?=?ipos?+?1;?//?adjust cursor position
  • ????????}
  • //?keeping safe
  • if?(ipos?-?num?<?0)
  • ????????????num?=?ipos;
  • ????}
  • ????else?{
  • i?=?ipos;
  • count?=?0;
  • while(AsciiFromChar(text)?>=?160)?{
  • ?????i?=?i?+?1;
  • ?????count?=?count?+?1;
  • ?????if(i?==?len-1)
  • ???break;
  • }
  • if(count?>?0)?{
  • ?????num?=?2;
  • }
  • ????}
  • ????text?=?cat(strmid(text,?0,?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?==?0)
  • ???return?0;
  • //當前位置
  • pos?=?GetWndSelIchFirst(hwnd);
  • //當前行數
  • ln?=?GetBufLnCur(hbuf);
  • //得到當前行
  • text?=?GetBufLine(hbuf,?ln);
  • //得到當前行長度
  • len?=?strlen(text);
  • //從頭計算漢字字符的個數
  • if(pos?>?0)
  • {
  • ???i=pos;
  • ???count=0;
  • ???while(AsciiFromChar(text[i-1])?>=?160)
  • ???{
  • ????i?=?i?-?1;
  • ????count?=?count+1;
  • ????if(i?==?0)
  • ?????break;
  • ???}
  • ???if((count/2)*2==count||?count==0)
  • ????return?0;
  • ???else
  • ????return?1;
  • }
  • return?0;
  • }
  • macro moveleft()
  • {
  • hwnd?=?GetCurrentWnd();
  • hbuf?=?GetCurrentBuf();
  • if?(hbuf?==?0)
  • ????????stop;?//?empty buffer
  • ln?=?GetBufLnCur(hbuf);
  • ipos?=?GetWndSelIchFirst(hwnd);
  • if(GetBufSelText(hbuf)?!=?""?||?(ipos?==?0?&&?ln?==?0))?//?第0行或者是選中文字,則不移動
  • {
  • ???SetBufIns(hbuf,?ln,?ipos);
  • ???stop;
  • }
  • if(ipos?==?0)
  • {
  • ???preLine?=?GetBufLine(hbuf,?ln-1);
  • ???SetBufIns(hBuf,?ln-1,?strlen(preLine)-1);
  • }
  • else
  • {
  • ???SetBufIns(hBuf,?ln,?ipos-1);
  • }
  • }
  • macro SuperCursorLeft()
  • {
  • moveleft();
  • if(IsComplexCharacter())
  • ???moveleft();
  • }
  • /*======================================================================
  • 4、右移鍵——SuperCursorRight.em
  • ======================================================================*/
  • macro moveRight()
  • {
  • hwnd?=?GetCurrentWnd();
  • hbuf?=?GetCurrentBuf();
  • if?(hbuf?==?0)
  • ????????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)-1?&&?ln?==?totalLn-1)?//?末行
  • ???stop;
  • if(ipos?==?strlen(text))
  • {
  • ???SetBufIns(hBuf,?ln+1,?0);
  • }
  • else
  • {
  • ???SetBufIns(hBuf,?ln,?ipos+1);
  • }
  • }
  • macro SuperCursorRight()
  • {
  • moveRight();
  • if(IsComplexCharacter())?//?defined?in?SuperCursorLeft.em
  • ???moveRight();
  • }
  • /*======================================================================
  • 5、shift+右移鍵——ShiftCursorRight.em
  • ======================================================================*/
  • macro IsShiftRightComplexCharacter()
  • {
  • hwnd?=?GetCurrentWnd();
  • hbuf?=?GetCurrentBuf();
  • if?(hbuf?==?0)
  • ???return?0;
  • selRec?=?GetWndSel(hwnd);
  • pos?=?selRec.ichLim;
  • ln?=?selRec.lnLast;
  • text?=?GetBufLine(hbuf,?ln);
  • len?=?strlen(text);
  • if(len?==?0?||?len?<?pos)
  • return?1;
  • //Msg("@len@;@pos@;");
  • if(pos?>?0)
  • {
  • ???i=pos;
  • ???count=0;
  • ???while(AsciiFromChar(text[i-1])?>=?160)
  • ???{
  • ????i?=?i?-?1;
  • ????count?=?count+1;
  • ????if(i?==?0)
  • ?????break;
  • ???}
  • ???if((count/2)*2==count||?count==0)
  • ????return?0;
  • ???else
  • ????return?1;
  • }
  • return?0;
  • }
  • macro shiftMoveRight()
  • {
  • hwnd?=?GetCurrentWnd();
  • hbuf?=?GetCurrentBuf();
  • if?(hbuf?==?0)
  • ????????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+1?||?curLen?==?0)
  • {
  • ???if(selRec.lnLast?==?totalLn?-1)
  • ????stop;
  • ???selRec.lnLast?=?selRec.lnLast?+?1;
  • ???selRec.ichLim?=?1;
  • ???SetWndSel(hwnd,?selRec);
  • ???if(IsShiftRightComplexCharacter())
  • ????shiftMoveRight();
  • ???stop;
  • }
  • selRec.ichLim?=?selRec.ichLim+1;
  • SetWndSel(hwnd,?selRec);
  • }
  • macro SuperShiftCursorRight()
  • {
  • if(IsComplexCharacter())
  • ???SuperCursorRight();
  • shiftMoveRight();
  • if(IsShiftRightComplexCharacter())
  • ???shiftMoveRight();
  • }
  • /*======================================================================
  • 6、shift+左移鍵——ShiftCursorLeft.em
  • ======================================================================*/
  • macro IsShiftLeftComplexCharacter()
  • {
  • hwnd?=?GetCurrentWnd();
  • hbuf?=?GetCurrentBuf();
  • if?(hbuf?==?0)
  • ???return?0;
  • selRec?=?GetWndSel(hwnd);
  • pos?=?selRec.ichFirst;
  • ln?=?selRec.lnFirst;
  • text?=?GetBufLine(hbuf,?ln);
  • len?=?strlen(text);
  • if(len?==?0?||?len?<?pos)
  • ???return?1;
  • //Msg("@len@;@pos@;");
  • if(pos?>?0)
  • {
  • ???i=pos;
  • ???count=0;
  • ???while(AsciiFromChar(text[i-1])?>=?160)
  • ???{
  • ????i?=?i?-?1;
  • ????count?=?count+1;
  • ????if(i?==?0)
  • ?????break;
  • ???}
  • ???if((count/2)*2==count||?count==0)
  • ????return?0;
  • ???else
  • ????return?1;
  • }
  • return?0;
  • }
  • macro shiftMoveLeft()
  • {
  • hwnd?=?GetCurrentWnd();
  • hbuf?=?GetCurrentBuf();
  • if?(hbuf?==?0)
  • ????????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?==?0)
  • {
  • ???if(selRec.lnFirst?==?0)
  • ????stop;
  • ???selRec.lnFirst?=?selRec.lnFirst?-?1;
  • ???selRec.ichFirst?=?GetBufLineLength(hbuf,?selRec.lnFirst)-1;
  • ???SetWndSel(hwnd,?selRec);
  • ???if(IsShiftLeftComplexCharacter())
  • ????shiftMoveLeft();
  • ???stop;
  • }
  • selRec.ichFirst?=?selRec.ichFirst-1;
  • SetWndSel(hwnd,?selRec);
  • }
  • macro SuperShiftCursorLeft()
  • {
  • if(IsComplexCharacter())
  • ???SuperCursorLeft();
  • shiftMoveLeft();
  • if(IsShiftLeftComplexCharacter())
  • ???shiftMoveLeft();
  • }
  • /*---END---*/
  • 轉自:http://blog.chinaunix.net/uid-10540984-id-3214137.html

    轉載于:https://www.cnblogs.com/suiying/p/4631759.html

    總結

    以上是生活随笔為你收集整理的让Source Insight完美支持中文注释 (转)的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

    主站蜘蛛池模板: 日本一区视频在线观看 | 日韩欧美一区二区三区在线 | 香蕉久久网 | 99色在线视频| 日韩成人综合网 | 草草影院av | 欧美精品日韩精品 | 操校花视频 | 操碰91| 人操人操 | 中文字幕无码精品亚洲 | 成人精品久久 | 日韩a在线 | 综合久久久久综合 | 最新av网址在线观看 | 日韩中文字幕免费观看 | 午夜精品久久久久久毛片 | 免费av电影网址 | 综合五月婷 | 亚洲黄v | 瑟瑟视频免费看 | 色播在线视频 | 调教小屁屁白丝丨vk | 国产91在线免费观看 | 每日av更新 | 中文久久乱码一区二区 | 日本女人性视频 | 香蕉视频影院 | 日韩专区av | 在线亚洲网站 | 欧美精品乱码久久久久久 | 在线观看一区二区视频 | 国产精品麻豆一区二区三区 | 激情无遮挡| 久久久久成人精品免费播放动漫 | 公侵犯人妻一区二区 | 成年人免费网址 | 亚洲深夜福利视频 | 亚洲红桃视频 | xxxxx黄色| 国产精品老牛影院99av | 手机在线一区 | 一级特黄妇女高潮2 | 91久久超碰 | 亚洲一区二区av在线 | 国产一区日本 | 小泽玛利亚一区二区三区 | 中文字幕99页| 天天综合色网 | 国产黄色自拍视频 | 深夜福利av | av高清在线免费观看 | 国产一区视频在线播放 | 免费黄视频网站 | 精品麻豆av | 国产91久久婷婷一区二区 | 日本成人免费观看 | 欧美一区二区不卡视频 | 天天做天天看 | proumb性欧美在线观看 | 日本女优黄色 | 午夜18视频在线观看 | 少妇激情四射 | 91成人看| 青青草原亚洲 | 可以直接在线观看的av | 一区精品视频在线观看 | 亚洲成人基地 | 四川话毛片少妇免费看 | 日韩精品字幕 | 专业操老外 | 给我看免费高清在线观看 | 天天爽夜夜爽夜夜爽精品视频 | 天堂av在线中文 | 亚洲av日韩精品久久久久久久 | 国产精品第三页 | 尤物国产在线 | 伊人久久大香线蕉成人综合网 | 一区二区三区高清不卡 | 欧美人妻精品一区二区三区 | 亚洲播放 | 亚洲h视频在线观看 | 亚洲激情av | 狼人狠狠干 | 在线观看国产黄 | 日本精品中文字幕 | 夜夜骚网站 | 日韩综合一区二区三区 | 日韩欧美在线视频观看 | 91色爱| 岛国av免费看 | 初尝黑人巨炮波多野结衣 | 日韩成人免费视频 | 欧美黄色片免费看 | 极品少妇在线观看 | 波多野结衣在线观看一区 | 四虎网站在线播放 | 国产精品久久久久久久久久久免费看 | 久久久久一区 |