sourceinsight 中文支持 解决办法

2024-06-20 22:48

本文主要是介绍sourceinsight 中文支持 解决办法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

功能描述:

一、解决sourceinsight 中,←、 →、 del、 backspace 中文半字的问题
二、解决sourceinsight 中,中文间距过大的问题

操作步骤

一、中文半字的问题

1、用everything搜索文件:utils.em(C:\Program Files (x86)\Source Insight 3)
2、用sourceinsight打开文件:utils.em
3、在文件末尾添加下面代码
4、Options→Key Assignments,将下面宏依次与相应按键绑定:
Macro: SuperBackspace绑定到BackSpace键,
Macro: SuperCursorLeft绑定到键,
Macro: SuperCursorRight绑定到键,
Macro: SuperShiftCursorLeft绑定到Shift+
Macro: SuperShiftCursorRight绑定到shift+
Macro: SuperDelete绑定到del

/*======================================================================
1、BackSpace后退键
======================================================================*/
macro SuperBackspace()
{hwnd = GetCurrentWnd();hbuf = GetCurrentBuf();if (hbuf == 0)stop; // empty buffer// get current cursor postionipos = GetWndSelIchFirst(hwnd);// get current line numberln = GetBufLnCur(hbuf);if ((GetBufSelText(hbuf) != "") || (GetWndSelLnFirst(hwnd) != GetWndSelLnLast(hwnd))) {// sth. was selected, del selectionSetBufSelText(hbuf, " "); // stupid & buggy sourceinsight// del the " "SuperBackspace(1);stop;}// copy current linetext = GetBufLine(hbuf, ln);// get string lengthlen = strlen(text);// if the cursor is at the start of line, combine with prev lineif (ipos == 0 || len == 0) {if (ln <= 0)stop; // top of fileln = ln - 1; // do not use "ln--" for compatibility with older versionsprevline = GetBufLine(hbuf, ln);prevlen = strlen(prevline);// combine two linestext = cat(prevline, text);// del two linesDelBufLine(hbuf, ln);DelBufLine(hbuf, ln);// insert the combined oneInsBufLine(hbuf, ln, text);// set the cursor positionSetBufIns(hbuf, ln, prevlen);stop;}num = 1; // del one charif (ipos >= 1) {// process Chinese characteri = 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 characternum = 2;// This idiot does not support mod and bitwise operatorsif ((count / 2 * 2 != count) && (ipos < len))ipos = ipos + 1; // adjust cursor position}}// keeping safeif (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;
}
/*======================================================================
2、删除键——SuperDelete.em
======================================================================*/
macro SuperDelete()
{hwnd = GetCurrentWnd();hbuf = GetCurrentBuf();if (hbuf == 0)stop; // empty buffer// get current cursor postionipos = GetWndSelIchFirst(hwnd);// get current line numberln = GetBufLnCur(hbuf);if ((GetBufSelText(hbuf) != "") || (GetWndSelLnFirst(hwnd) != GetWndSelLnLast(hwnd))) {// sth. was selected, del selectionSetBufSelText(hbuf, " "); // stupid & buggy sourceinsight// del the " "SuperDelete(1);stop;}// copy current linetext = GetBufLine(hbuf, ln);// get string lengthlen = strlen(text);if (ipos == len || len == 0) {
totalLn = GetBufLineCount (hbuf);
lastText = GetBufLine(hBuf, totalLn-1);
lastLen = strlen(lastText);if (ipos == lastLen)// end of filestop;ln = ln + 1; // do not use "ln--" for compatibility with older versionsnextline = GetBufLine(hbuf, ln);nextlen = strlen(nextline);// combine two linestext = cat(text, nextline);// del two linesDelBufLine(hbuf, ln-1);DelBufLine(hbuf, ln-1);// insert the combined oneInsBufLine(hbuf, ln-1, text);// set the cursor positionSetBufIns(hbuf, ln-1, len);stop;}num = 1; // del one charif (ipos > 0) {// process Chinese characteri = 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 characternum = 2;// This idiot does not support mod and bitwise operatorsif (((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) >= 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;elsereturn 1;
}
return 0;
}
macro moveleft()
{
hwnd = GetCurrentWnd();
hbuf = GetCurrentBuf();
if (hbuf == 0)stop; // empty bufferln = 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.emmoveRight();
}
/*======================================================================
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;elsereturn 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;elsereturn 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();
}
/*---END---*/

二、间距过大的问题
1. Options->Style Properties
2. 在左边Style Name下找到Comment Multi LineComment.在其右边对应的Font属性框下的
Font Name中选“Pick...” 设置为宋体、常规、小四。确定,退回Style Properties界面,
Size设为10。最后设置Clolors框下Foreground,点“Pick...”选择一种自己喜欢的颜色就OK了。
间距修改之后的效果如下
间距修改之后

中文半字效果如下

这篇关于sourceinsight 中文支持 解决办法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1079478

相关文章

中文分词jieba库的使用与实景应用(一)

知识星球:https://articles.zsxq.com/id_fxvgc803qmr2.html 目录 一.定义: 精确模式(默认模式): 全模式: 搜索引擎模式: paddle 模式(基于深度学习的分词模式): 二 自定义词典 三.文本解析   调整词出现的频率 四. 关键词提取 A. 基于TF-IDF算法的关键词提取 B. 基于TextRank算法的关键词提取

vscode中文乱码问题,注释,终端,调试乱码一劳永逸版

忘记咋回事突然出现了乱码问题,很多方法都试了,注释乱码解决了,终端又乱码,调试窗口也乱码,最后经过本人不懈努力,终于全部解决了,现在分享给大家我的方法。 乱码的原因是各个地方用的编码格式不统一,所以把他们设成统一的utf8. 1.电脑的编码格式 开始-设置-时间和语言-语言和区域 管理语言设置-更改系统区域设置-勾选Bata版:使用utf8-确定-然后按指示重启 2.vscode

Solr 使用Facet分组过程中与分词的矛盾解决办法

对于一般查询而言  ,  分词和存储都是必要的  .  比如  CPU  类型  ”Intel  酷睿  2  双核  P7570”,  拆分成  ”Intel”,”  酷睿  ”,”P7570”  这样一些关键字并分别索引  ,  可能提供更好的搜索体验  .  但是如果将  CPU  作为 Facet  字段  ,  最好不进行分词  .  这样就造成了矛盾  ,  解决方法

ORACLE 11g 创建数据库时 Enterprise Manager配置失败的解决办法 无法打开OEM的解决办法

在win7 64位系统下安装oracle11g,在使用Database configuration Assistant创建数据库时,在创建到85%的时候报错,错误如下: 解决办法: 在listener.ora中增加对BlueAeri-PC或ip地址的侦听,具体步骤如下: 1.启动Net Manager,在“监听程序”--Listener下添加一个地址,主机名写计

Anaconda 中遇到CondaHTTPError: HTTP 404 NOT FOUND for url的问题及解决办法

最近在跑一个开源项目遇到了以下问题,查了很多资料都大(抄)同(来)小(抄)异(去)的,解决不了根本问题,费了很大的劲终于得以解决,记录如下: 1、问题及过程: (myenv) D:\Workspace\python\XXXXX>conda install python=3.6.13 Solving environment: done.....Proceed ([y]/n)? yDownloa

解决Office Word不能切换中文输入

我们在使用WORD的时可能会经常碰到WORD中无法输入中文的情况。因为,虽然我们安装了搜狗输入法,但是到我们在WORD中使用搜狗的输入法的切换中英文的按键的时候会发现根本没有效果,无法将输入法切换成中文的。下面我就介绍一下如何在WORD中把搜狗输入法切换到中文。

Golang支持平滑升级的HTTP服务

前段时间用Golang在做一个HTTP的接口,因编译型语言的特性,修改了代码需要重新编译可执行文件,关闭正在运行的老程序,并启动新程序。对于访问量较大的面向用户的产品,关闭、重启的过程中势必会出现无法访问的情况,从而影响用户体验。 使用Golang的系统包开发HTTP服务,是无法支持平滑升级(优雅重启)的,本文将探讨如何解决该问题。 一、平滑升级(优雅重启)的一般思路 一般情况下,要实现平滑

sqlite不支持中文排序,采用java排序

方式一 不支持含有重复字段进行排序 /*** sqlite不支持中文排序,改用java排序* 根据指定的对象属性字段,排序对象集合,顺序* @param list* @param field* @return*/public static List sortListByField(List<?> list,String field){List temp = new ArrayList(

一款支持同一个屏幕界面同时播放多个视频的视频播放软件

GridPlayer 是一款基于 VLC 的免费开源跨平台多视频同步播放工具,支持在一块屏幕上同时播放多个视频。其主要功能包括: 多视频播放:用户可以在一个窗口中同时播放任意数量的视频,数量仅受硬件性能限制。支持多种格式和流媒体:GridPlayer 支持所有由 VLC 支持的视频格式以及流媒体 URL(如 m3u8 链接)。自定义网格布局:用户可以配置播放器的网格布局,以适应不同的观看需求。硬

Science Robotics 首尔国立大学研究团队推出BBEX外骨骼,实现多维力量支持!

重复性举起物体可能会对脊柱和背部肌肉造成损伤,由此引发的腰椎损伤是工业环境等工作场所中一个普遍且令人关注的问题。为了减轻这类伤害,有研究人员已经研发出在举起任务中为工人提供辅助的背部支撑装置。然而,现有的这类装置通常无法在非对称性的举重过程中提供多维度的力量支持。此外,针对整个人体脊柱的设备安全性验证也一直是一个缺失的环节。 据探索前沿科技边界,传递前沿科技成果的X-robot投稿,来自首尔国立