久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 10184|回復: 0
收起左側

搞定SourceInsight的半個漢字的問題

[復制鏈接]
ID:71235 發表于 2014-12-27 23:25 | 顯示全部樓層 |閱讀模式
    近日發現一款支持語法高亮,代碼自動完成的通用代碼編輯器《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;
}

回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 中文字幕在线观看精品 | 黄色大片毛片 | 亚洲精品电影网在线观看 | 九九免费观看视频 | 国产视频一区二区 | 国产毛片毛片 | 日本不卡一二三 | 国产精品久久7777777 | 少妇一级淫片aaaaaaaaa | 精品国产一区久久 | h视频在线看 | 日韩另类视频 | 欧美日韩一卡二卡 | 黄色大片免费观看 | 日韩精品在线一区 | 国产精品久久久亚洲 | 久久网国产 | 国精日本亚洲欧州国产中文久久 | 亚洲精品国产成人 | 中文字幕av网 | 九九热免费看 | 奇米四色影视 | 搞av.com| 91国自产 | 99视频免费在线观看 | 久久成人亚洲 | 欧美福利 | 国产精品免费一区二区三区 | 亚洲视频免费在线 | 国产精品中文字幕在线播放 | 国产成人综合在线 | 国产日韩精品久久 | 久久久久久综合 | 久久丝袜 | 成人一区在线观看 | 成人影院在线视频 | 五月婷婷激情网 | 欧美一级在线观看 | 成人免费在线视频 | 精品欧美一区二区三区久久久 | 国产精品久久 |