[Tools] source insight

Source: Internet
Author: User
Tags bitwise operators

Not to mention, the powerful tool for reading code.

 

1. Modify the background color

Use light green to protect your eyes (just heard about it), choose "options"> "properties" from the menu, and use your favorite color. My light green RGB is 181,236,207

 

2. line number, replacement of tabs with spaces, and smart line feed

 

3. How to Solve the Chinese spacing of source insight

By default, you can enter Chinese Characters in source insight. The spacing is quite large. To solve this problem, the specific settings are as follows:

1. Options-> style Properties

2. Find comment multi line and comment under the style name on the left. select "pick... "Set to, General, and S4. OK. Return to the style properties page and set the size to 10. Finally, set foreground in the clolors box and click "Pick..." to select a color you like.

 

Iv. Solve Chinese garbled characters such as backspace, delet, and up/down keys

By default, You need to press the delete key twice to delete a Chinese character. If you click it, there will be garbled characters. The solution is to open the base project in preject, open the file utils. Em, and copy the following code to the end. In options> key assignment, assign keys to several macro instances.

 

/* ===================================================== ======================================

1. backspace backkey

========================================================== ===================================== */

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 ))){

// Something. was selected, del Selection

Setbufseltext (hbuf, ""); // stupid & buggy sourceinsight :(

// Del ""

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;

}

/* ===================================================== ======================================

2. delete key -- 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 ))){

// Something. was selected, del Selection

Setbufseltext (hbuf, ""); // stupid & buggy sourceinsight :(

// Del ""

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]) & gt; = 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. Shift left key -- supercursorleft. Em

========================================================== ===================================== */

Macro iscomplexcharacter ()

{

Hwnd = getcurrentwnd ();

Hbuf = getcurrentbuf ();

If (hbuf = 0)

Return 0;

// Current location

Pos = getwndselichfirst (hwnd );

// Current number of rows

Ln = getbuflncur (hbuf );

// Obtain the current row

TEXT = getbufline (hbuf, LN );

// Obtain the length of the current row

Len = strlen (text );

// Calculate the number of Chinese characters from the beginning

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) // if there are 0th rows or lines of selected text, do not move

{

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. Right Shift key -- 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 )! = "") // Select text

{

IPOs = getwndselichlim (hwnd );

Ln = getwndsellnlast (hwnd );

Setbufins (hbuf, LN, IPOs );

Stop;

}

If (IPOs = strlen (text)-1 & Ln = totalLn-1) // last line

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 + Right Shift key -- 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 ("@ [email protected]; @ [email protected];");

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 + Left Shift key -- 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 ("@ [email protected]; @ [email protected];");

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 ("@ [email protected]; @ [email protected]");

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 ---*/

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.