欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 搞定SourceInsight的半個漢字的問題 [打印本頁]

作者: xiaoniu    時間: 2014-12-27 23:25
標題: 搞定SourceInsight的半個漢字的問題
    近日發現一款支持語法高亮,代碼自動完成的通用代碼編輯器《Source Insight》,試用了一下,貌似還不錯,但是跟許多國外軟件一樣,都存在半個漢字的問題,就是按BACKSPACK鍵刪除漢字字符時,一次只能刪除半個漢字,剩下的那半個就顯示為?,比較的不方便。
    還好這款軟件有漢化版的,漢化版還附帶了一個解決方案,但是作者的說明不是很清楚,這里我把我自己操作過程寫一下,以免以后忘記了。
    它其實是利用了SourceInsight的鍵映射到宏的功能。
    1。解決方案里附帶了一個宏文件“SuperBackspace.em”,用記事本打開這個文件,將內容復制到剪貼板備用,
    2。選擇菜單“項目->打開項目”,打開Base項目,再打開右側文件列表里的“Utils.em"文件,將剛才的代碼粘貼到文檔里,保存。
    3。選擇菜單“選項->自定義命令”,添加一個“Marco: SuperBackspace()”,保存。
    4。選擇菜單“鍵關聯”,在命令列表里選中剛才新建的自定義命令“Marco: SuperBackspace()”,點擊分配新鍵,按彈出窗口提示,按下BACKSPACE鍵,確認。
    5。重啟Source Insight。
    要注意的是Source Insight默認的復制粘貼鍵是alt-c alt-v,可以自行修改成ctrl-c ctrl-v,另外在win7下運行Source Insight是需要管理員權限的,在啟動文件Insight3上“右鍵->屬性->兼容性”,勾選以“管理員身份運行此程序”即可
下面是這個宏的源代碼
/**
*       ╭︿︿︿╮
*       {/ . .\}
*       (  (oo)  )
*        ︶︶︶︶
*      豬 哥  作 品
*
* 2006 丁兆杰 Ding Zhaojie
*
* SuperBackspace Version 0.1beta
*
* 代替SourceInsight原有的Backspace功能(希望如此)
* 增加了對雙字節漢字的支持,在刪除漢字的時候也能同時刪除漢字的高字節而緩解半個漢字問題
* 能夠對光標在漢字中間的情況進行自動修正
*
* 安裝:
* ① 復制入SourceInsight安裝目錄;
* ② Project→Open Project,打開Base項目;
* ③ 將復制過去的SuperBackspace.em添加入Base項目;
* ④ 重啟SourceInsight;
* ⑤ Options→Key Assignments,將Marco: SuperBackspace綁定到BackSpace鍵;
* ⑥ Enjoy!!
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
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;
}






歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1