一、解决汉字乱码的问题。要解决这个问题,就是要调整字体为宋体。方法如下
选择【Options】→【Styles Properties...】,打开设置对话框,在左边栏找到【Comment】,设置【Font Name】的值为"宋体"即可。Szie的值根据实际需要自由设置。
设置后之后再注释中就可以正常输入中文了,字距也显示正常。
二、解决按"Backspace"键是,只能删除半个汉字的问题。通过定义一个宏文件实现。
先关闭当前项目,选择【project】→【Open project...】,打开项目对话框,选择"Base"工程并打开。新建一个SuperBackSpace.em的宏定义文件内容如下,这个宏定义文件的内容是网友提供的。
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; }
把SuperBackSpace.em文件复制到Base工程的工程目录下。选择【Project】→【Add and Remove Project Files...】打开对话框,加入SuperBackSpace.em文件。
选择【Options】→【Key Assigments...】打开按键分配对话框,找到宏定义中的"Macro:SuperBackSpace"并用鼠标单击选中,按下【Assign New Key...】按钮,在弹出了一个新的对话框后按照提示,在键盘上按下"←Backspace"键即可。
此时再按一下退格键,可以成功删除一个汉字了。但是用数遍选择注释中的汉字时,仍然可以选中半个汉字,此时显示为乱码。而用左右箭头键移动光标时,仍然可以移动到一个汉字的半中间,就是说移动光标仍然是半个汉字为单位。
另外。在base 项目中选中 SuperBackspace.em 本身,在下面的Context窗口中可以看到该文件的内容,这个文件开头的部分是中文注释,显示为乱码,在Context中右键单击,改变字体为宋体,仍然会显示乱码,汉字有的能正常显示,有的则不能。所以经过以上努力,Source Insight对汉字的支持有所改进,但是还是不太如人意。
三、在Souce Insight加入".S"汇编文件。
在【Options】→【Document Options...】里面,点左上的【Document Type】下拉菜单,选择【x86 Asm Source File】,然后在右边的【File filter】里*.asm;*.inc;的后面加上*.s;*.S 接着CLOSE就可以了。这样就可以ADD TREE时把这些汇编加到PROJECT里面。
在【Options】→【Document Options...】里面,点左上的【Document Type】下拉菜单,选择【C Source File】,然后在右边的File filter里补上*.s,*.S就可以像看C一样看汇编,显示高亮了。
在【Options】→【Document Options...】里面,点左上的【Document Type】下拉菜单,选择【C Source File】,然后在右边的File filter里补上*.s,*.S就可以像看C一样看汇编,显示高亮了。