source insight刪除中文時會出現亂碼,加載此文件來解決。
1.記事本錄入以下文字:
* * 代替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; } 參考上面以及SourceInsight中的chm幫助文檔; 有缺點:(1)移動箭頭也會記錄到歷史操作步驟,應該能夠避免這些操作被記錄;(2)函數沒有整理,有冗餘; 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[i]) >= 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(); }
2.保存爲uperBackspace.em按說明進行操作
3.欣賞效果
PS:改變comment字體,可以使中文緊湊顯示.
一、說明 在平常工作中,我們使用top命令查看一臺linux服務器的cpu使用情況時,會發現某個進程的cpu使用率會超過100%,這是爲什麼? 二、舉例 實驗環境爲 CentOS7.6 + Python2.7 1. 多線程、多進程在操作系統
一、概述 安裝某些數據庫的時候使用圖像化還是比較方便的,但是由於服務器一般不提供圖形化界面。之前一直都是使用Xmanager去導出圖形,但是Xmanager是收費的,公司不讓用,所以找了一款可以完美替代的產品Xming,本文將介紹xming
一、說明 同事問我數據庫的時區是客戶端屬性還是服務端屬性,我覺得這個問題十分有意思,之前沒怎麼留意,自己來做下實驗。 首先介紹幾個術語。 GMT(Greenwich Mean Time),格林尼治平均時間。 UTC(Coordinated
一. 找出表test1中tflag字段連續出現3次及以上爲1的行 思路:1. 對行進行編號,2. 對相鄰三行進行求和算出值作爲sumflag,3. 如果值爲3,則該行以及接下來的2行都輸出出來,通過自關聯解決。 WITH tmp AS (
數據結構 數據庫的表和索引缺一不可 表 特點: 無序,插入速度快,查找速度慢 索引(B+Tree) 特點:有序,插入速度慢,查找速度快 查找的效率比較,如果按照讀取的數據塊來計算? 測試數據 TABLE_OWNER TABLE
介紹:我有兩臺數據庫,分別稱爲200和203,200和203的服務器性能配置相當,203的配置甚至還要好一點。都是安裝的centos7.7,oracle 19C,均已開日誌歸檔,這兩臺服務器在同一個機房,同一個網段。當我在本地使用JDBC去
1.使用系統的root賬戶 2.切換到 /use/local 目錄下 3.下載mysql 根據自己需要安裝的版本下載。 wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysq
本篇參考: https://help.salesforce.com/s/articleView?id=release-notes.rn_lab_conditional_visibiliy_tab.htm&release=250&type=
示例demo: DECLARE @table IdTableType INSERT INTO @table SELECT Id FROM dbo.t_pl_test DECLARE @SearchSQL NVARCHAR(MAX) SE
在大數據計算裏面,計算引擎是處於承上啓下的作用,對上承接數據源,對下承接各種各種數據庫,比如mysql、oracle。對於任何數據計算來說要想精確消費一次,就需要支持事務或者冪等,我們最常見的支持事務的就是單點的oracle、mysql數
LiveCharts2 LiveCharts2是一個.NET開源(MIT License)、簡單、靈活、交互式且功能強大的.NET圖表、地圖和儀表,現在幾乎可以在任何地方運行如:Maui、Uno Platform、Blazor-wasm、W
前言 在之前的 面試官:來說說vue3是怎麼處理內置的v-for、v-model等指令? 文章中講了transform階段處理完v-for、v-model等指令後,會生成一棵javascript AST抽象語法樹。這篇文章我們來接着講gen
標題一 標題二 標題三 標題四 標題五 標題六 hr 加粗字體 b 斜體字體 i 引用內容 code 超鏈接 a blockquote ol > li 有序列表 ul > li 無須列表 pre 代碼塊 p 表格標
ue生成VS工程報錯 右鍵 - uproject ,Generating VisualStudio project files ,報錯信息如下:就是我安裝的msvc版本太舊 Running C:/Program Files/Epic Ga
因網絡中斷或其他原因,有時候服務器上留下較多無用的vscode-server進程,佔用內存資源 可以採用如下命令kill進程 ps uxa | grep .vscode-server | awk '{print $2}' | xargs k