⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 progressivesearch.em

📁 source insight的EM文件 可以扩展SI的宏功能
💻 EM
字号:
/*
	Macro command that performs a progressive search as the user types.
	
	As with other macros, to use this:
		1. Add this macro file to your project.
		2. Run the Options->Key Assignments command.
		3. Find and select the macro command name in the command list
		4. Press 'Add' to bind a key to the macro.
		Now you can run the macro command
*/


macro ProgressiveSearch()
{
	/* This does a progressive search as the user types characters
	   Pressing Enter or Escape will cancel the search 
	*/

    hbuf = GetCurrentBuf()
    hwnd = GetCurrentWnd()
    key = 0
    char = 1 // needs to start with any non-zero value
    SearchFor = ""
    sel = GetWndSel(hwnd)
    
	while (char != 0)
	{
		key = GetKey()
		char = CharFromKey(key)
		if (char != 0)
		{
		    
			if (key == 13) //Enter searches current string again
				sel.ichFirst = sel.ichFirst + 1
			else if (key == 8) // backspace
			{
				if (strlen(SearchFor) > 0)
					SearchFor = strtrunc (SearchFor, strlen(SearchFor) - 1)
			}
			else
				SearchFor = cat(SearchFor, char)
			sel = SearchInBuf(hbuf, SearchFor, sel.lnFirst, sel.ichFirst, 0, 0, 0)
			if (sel == "")
			{
				sel = GetWndSel(hwnd)
				if (key == 13)
				{
					sel.fExtended = 0
					sel.ichLim = sel.ichFirst
					SetWndSel(hwnd, sel)
					char = 0
					Beep()
				}
				else  
					if (strlen(SearchFor) > 0)
						SearchFor = strtrunc (SearchFor, strlen(SearchFor) - 1)
			}
			else
			{
        		ScrollWndToLine(hwnd, sel.lnFirst)
        		SetWndSel(hwnd, sel)
                LoadSearchPattern(SearchFor, 0, 0, 0)
        	}
        }
	}
}
	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -