Source insight notes ___ batch comments, remove spaces between Chinese comments

Source: Internet
Author: User

Bytes --------------------------------------------------------------------------------------------------------------------------

Source insight adds recognition of PC files, and syntax highlighting of other types of files in source insight

Options ---> preferences --> C Language --> Doc types --> file filter adds a. PC

Bytes -------------------------------------------------------------------------------------------------------------------------

Source insight contains garbled characters when copying Chinese characters and copying Chinese characters:

Solution: Switch the input method to Chinese during copy.

Bytes -------------------------------------------------------------------------------------------------------------------------

 

(1) Remove spaces between Chinese comments

There is a space between Chinese comments and words

 

Options-> style Properties


Comment

...

Comment to do


Set Font-> font name to "" or other Chinese fonts!

 

(2) Batch comment on source insight

When using source insight, we found that this feature was not available. So I searched the internet, and the multi-line annotations in source insight can be implemented using macros.

The following is the macro code that implements multi-line annotation (copied from other websites, tested, and still useful ):

Macro multilinecomment () {hwnd = getcurrentwnd () Selection = getwndsel (hwnd) lnfirst = getwndsellnfirst (hwnd) // obtain the first line number lnlast = getwndsellnlast (hwnd) // obtain the row 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) // obtain the row if (BUF = "") {// skip the empty row Ln = ln + 1 contin UE} If (strmid (BUF, 0, 1) = "/") {// you need to cancel comments to prevent single-character rows if (strmid (BUF, 1, 2) = "/") {putbufline (hbuf, LN, strmid (BUF, 2, strlen (BUF)} If (strmid (BUF, 0, 1 )! = "/") {// Note putbufline (hbuf, LN, CAT ("//", Buf)} ln = ln + 1} setwndsel (hwnd, selection )}

 

Save the above Code as XXX. em file, open source insight, add the file to the project, and then you can see the macro in options-> key assignments. The macro name is multilinecomments, then we can assign the shortcut key "Ctrl +/" for it, and then we can.

Here is a macro code that adds "# ifdef 0" and "# endif:

Macro addm1_comment () {hwnd = getcurrentwnd () SEL = getwndsel (hwnd) lnfirst = getwndsellnfirst (hwnd) lnlast = Signature (hwnd) hbuf = getcurrentbuf () if (lnfirst = 0) {szifstart = ""} else {szifstart = getbufline (hbuf, LnFirst-1)} szifend = getbufline (hbuf, lnlast + 1) if (szifstart = "# If 0" & szifend = "# endif") {delbufline (hbuf, lnlast + 1) delbufline (hbuf, lnFirst-1) SEL. lnfirst = SEL. lnfirst-1 SEL. lnlast = SEL. lnlast-1} else {insbufline (hbuf, lnfirst, "# If 0") insbufline (hbuf, lnlast + 2, "# endif") SEL. lnfirst = SEL. lnfirst + 1 SEL. lnlast = SEL. lnlast + 1} setwndsel (hwnd, Sel)} This macro code can comment out the rows displayed by the cursor: 123456789 macro commentsingleline () {hbuf = getcurrentbuf () ln = getbuflncur (hbuf) STR = getbufline (hbuf, LN) STR = CAT ("/*", STR) STR = CAT (STR, "*/") putbufline (hbuf, ln, STR)} comment out the selected part of the row with the mouse: 123456789 macro commentselstr () {hbuf = getcurrentbuf () Ln = getbuflncur (hbuf) STR = getbufseltext (hbuf) STR = CAT ("/*", STR) STR = CAT (STR, "*/") setbufseltext (hbuf, STR )}

 

Original: http://www.2eggs.org /? P = 147


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.