If you are looking for software to use, go to Huajun Software Park! software release

How Source Insight annotates multiple lines of code - Source Insight annotates multiple lines of code method

Author: Ai Xiaomo Date: 2021-12-08

Source Insight
Source Insight-4.0.137.0 latest version

programming tools Storage size: 22.8 MB Time: 2022-03-25

Software introduction: Source Insight is a program editor and code browser for project development, which can support multiple languages ​​such as C/C++ or Java, and...

Download now

Many people don’t know how Source Insight annotates multiple lines of code? The article brought to you today is Source If you still don’t know how Insight comments multiple lines of code, let’s learn it with the editor.

The first step: First we open Source Insight, [Project]---[Open Project], open the base project (as shown in the picture).



Step 2: Then add the following code to the utils.em code:

macro MultiLineComment() { hwnd = GetCurrentWnd() selection = GetWndSel(hwnd) LnFirst = GetWndSelLnFirst(hwnd) //Get the first line number LnLast = GetWndSelLnLast(hwnd) //Get the last line number hbuf = GetCurrentBuf() if(GetBufLine(hbuf, 0) == "//magic-number:tph85666031"){ stop } Ln = Lnfirst buf = GetBufLine(hbuf, Ln) len = strlen(buf) while(Ln <= Lnlast) { buf = GetBufLine(hbuf, Ln) //Get the line corresponding to Ln if(buf == ""){ //Skip empty lines Ln = Ln + 1 continue } if(StrMid(buf, 0, 1) == "/") { //Need to uncomment to prevent lines with only single characters if(StrMid(buf, 1, 2) == "/"){ PutBufLine(hbuf, Ln, StrMid(buf, 2, Strlen(buf))) } } if(StrMid(buf,0,1) != "/"){ //Need to add comments PutBufLine(hbuf, Ln, Cat("//", buf)) } Ln = Ln + 1 } SetWndSel(hwnd, selection) }

Step 3: Then click [Options]---[Menu Assignment], and select the macro you just added in the command bar MultiLineComment, just select the menu that is convenient for you to operate in the menu bar. Generally, select Work and click Insert (as shown in the picture).


Step 4: After clicking OK, the work menu will be displayed in the menu bar, and it will be available in the work menu drop-down list. When using MultiLineComment in the future, select the line to be commented and click the label to comment it out (as shown in the figure).


The above is the entire content of how Source Insight annotates multiple lines of code brought to you by the editor. I hope it can help you.

Related articles