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

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 10040|回復(fù): 0
收起左側(cè)

搞定SourceInsight的半個(gè)漢字的問題

[復(fù)制鏈接]
ID:71235 發(fā)表于 2014-12-27 23:25 | 顯示全部樓層 |閱讀模式
    近日發(fā)現(xiàn)一款支持語法高亮,代碼自動(dòng)完成的通用代碼編輯器《Source Insight》,試用了一下,貌似還不錯(cuò),但是跟許多國(guó)外軟件一樣,都存在半個(gè)漢字的問題,就是按BACKSPACK鍵刪除漢字字符時(shí),一次只能刪除半個(gè)漢字,剩下的那半個(gè)就顯示為?,比較的不方便。
    還好這款軟件有漢化版的,漢化版還附帶了一個(gè)解決方案,但是作者的說明不是很清楚,這里我把我自己操作過程寫一下,以免以后忘記了。
    它其實(shí)是利用了SourceInsight的鍵映射到宏的功能。
    1。解決方案里附帶了一個(gè)宏文件“SuperBackspace.em”,用記事本打開這個(gè)文件,將內(nèi)容復(fù)制到剪貼板備用,
    2。選擇菜單“項(xiàng)目->打開項(xiàng)目”,打開Base項(xiàng)目,再打開右側(cè)文件列表里的“Utils.em"文件,將剛才的代碼粘貼到文檔里,保存。
    3。選擇菜單“選項(xiàng)->自定義命令”,添加一個(gè)“Marco: SuperBackspace()”,保存。
    4。選擇菜單“鍵關(guān)聯(lián)”,在命令列表里選中剛才新建的自定義命令“Marco: SuperBackspace()”,點(diǎn)擊分配新鍵,按彈出窗口提示,按下BACKSPACE鍵,確認(rèn)。
    5。重啟Source Insight。
    要注意的是Source Insight默認(rèn)的復(fù)制粘貼鍵是alt-c alt-v,可以自行修改成ctrl-c ctrl-v,另外在win7下運(yùn)行Source Insight是需要管理員權(quán)限的,在啟動(dòng)文件Insight3上“右鍵->屬性->兼容性”,勾選以“管理員身份運(yùn)行此程序”即可
下面是這個(gè)宏的源代碼
/**
*       ╭︿︿︿╮
*       {/ . .\}
*       (  (oo)  )
*        ︶︶︶︶
*      豬 哥  作 品
*
* 2006 丁兆杰 Ding Zhaojie
*
* SuperBackspace Version 0.1beta
*
* 代替SourceInsight原有的Backspace功能(希望如此)
* 增加了對(duì)雙字節(jié)漢字的支持,在刪除漢字的時(shí)候也能同時(shí)刪除漢字的高字節(jié)而緩解半個(gè)漢字問題
* 能夠?qū)鈽?biāo)在漢字中間的情況進(jìn)行自動(dòng)修正
*
* 安裝:
* ① 復(fù)制入SourceInsight安裝目錄;
* ② Project→Open Project,打開Base項(xiàng)目;
* ③ 將復(fù)制過去的SuperBackspace.em添加入Base項(xiàng)目;
* ④ 重啟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;
}

回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 成人一区二区三区 | 日韩精品一区二区三区免费观看 | 夜夜精品浪潮av一区二区三区 | 久久黄视频 | 国产乱码高清区二区三区在线 | 亚洲精品久久久久avwww潮水 | 精产国产伦理一二三区 | 粉嫩av久久一区二区三区 | 国产精品福利一区二区三区 | 亚洲一区二区三区视频 | 成人网av| 亚洲一区二区久久 | 日韩一区二区三区在线视频 | 成人中文网 | 成人精品久久久 | 亚洲精品久久久一区二区三区 | 欧美极品在线观看 | 免费网站在线 | 国产午夜影院 | 天堂综合 | 日韩精品在线网站 | 99热精品在线观看 | 久久精品国产亚洲 | 国产小视频在线 | 久久久久久久电影 | 国产乱人伦精品一区二区 | 欧美久久久| 久久久久久蜜桃一区二区 | 色综合久| 国产激情视频在线 | 久草青青草 | 欧美不卡一区二区 | 成人教育av | 午夜国产| 国产精品99久久久久久久vr | 狠狠干天天干 | 91久色 | 99一区二区 | 欧美午夜激情在线 | 国产高清精品一区二区三区 | av影音 |