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

📄 ingkcpos.js

📁 是一个很好的编辑器
💻 JS
字号:
/*	
	Provided under the MIT License
	Copyright (c) July 2007 Damion Hankejh, d@ingk.com
	---
	FILE:			ingkcpos.js
	VERSION:		0.5
	WEB:			www.sf.net/projects/ingkcpos

	DESCRIP:		PSPad Editor Extension to enhance 
					CTRL+(SHIFT)+RIGHT/LEFT cursor behavior.

					Compatible/tested with PSPad versions:
					-	(full version) 4.5.2 (2240) - Windows XP/SP2 
					-	(beta release) 4.5.3 (2262) - Windows XP/SP2
					-	(beta release) 4.5.3 (2265) - Windows XP/SP2

	INSTALL:		1.	If a previous version has been installed, uninstall 
						it by deleting these files:
						
						~\PSPad editor\Script\JScript\CTRL+SHIFT+RIGHT.js
						~\PSPad editor\Script\JScript\CTRL+SHIFT+LEFT.js
						~\PSPad editor\Script\JScript\CTRL+RIGHT.js
						~\PSPad editor\Script\JScript\CTRL+LEFT.js

					2.	Exit PSPad

					3.	Place the this script (ingkcpos.js) in:
						~\PSPad editor\Script\JScript

					4.	Start PSPad


	USE:			[ CTRL+RIGHT ] and [ CTRL+LEFT ] move the cursor to 
					the next right/left-context cursor stop.

					[ CTRL+SHIFT+RIGHT/LEFT ] selects text with each
					cursor move.

	AUTHORS:		Original:	Damion Hankejh, d@ingk.com
					Updates:		AndyBridges, Michal Caplygin

	LICENSE:		MIT License
					www.opensource.org/licenses/mit-license.php

	---
	NOTES:		Behavior

					-	Native positioning in PSPad yields cursor stops 
						indicated by "|" in:

							Key combo				Cursor stops (PSPad)
							---						---
							Original text			if (isSet($error) && $error != '') $text_block.= '<p>'.$error.'</p>';			
							CTRL+(SHIFT)+RIGHT	if (|isSet($|error) && $|error != '') $|text_block.= '<|p>'.$|error.'</|p>';|
							CTRL+(SHIFT)+LEFT		|if (|isSet($|error) && $|error != '') $|text_block.= '<|p>'.$|error.'</|p>';		

					-	Enhanced positioning enabled with the ingkcpos 
						PSPad extension yields:

							Key combo				Cursor stops (ingkcpos)
							---						---
							Original text			if (isSet($error) && $error != '') $text_block.= '<p>'.$error.'</p>';
							CTRL+(SHIFT)+RIGHT	if |(|isSet|($|error|) |&& $|error |!= |'') $|text|_|block|.= |'<|p|>'.$|error|.'</|p|>';|
							CTRL+(SHIFT)+LEFT		|if |(|isSet|(|$|error|)| |&&| |$|error |!=| |'')| |$|text|_|block|.=| |'<|p|>'.$|error|.'</|p|>';| 

	---
	TODO:			Add Settings GUI Dialog

					-	In some cases, it is useful to have cursor stops on specific characters (eg. TAB).  
						A settings GUI dialog accessible from the [Scripts > Ingkcpos] submenu would provide 
						convenient access to this as well as accepting input for additional cursor navigation
						settings.  Storing settings in the ~\PSPad editor\ directory would further improve
						a settings implementation. 

					-	Access to white, alpha and delim regular expressions could also be added to a
						settings dialog.

					Implement alternate cursor behavior models

					-	Ingkcpos cursor behavior is modeled on (most similar to) UltraEdit/TextPad.
						Implementing alternate behavior models drawn from other editors or browsers would
						further customize cursor movement:

						WinVi:			  	if |(isSet($error) |&& |$error |!= |'') |$text_block.= |'<p>'.$error.'</p>';|
						Firefox:				if |(|isSet($|error) |&& |$|error |!= |'') |$|text_|block.= |'<|p>'.$|error.'</|p>';|
						Cold fusion(R):	if (|isSet($|error) && $|error != |'') $|text_block.= |'|<p>|'.$|error|.'|</p>|';|
						Cold Fusion(K):	|if (|isSet($|error) && $|error != |'') $|text_block.= |'|<p>|'.$|error.|'|</p>|';

	---
	DONE:			Unsaved Changes

					-	Use ingkcpos to reposition the cursor causes the editor to flag the file as
						modified (indicated by a red triangle in the file tab, or by a diskette icon in the 
						status bar).  However, no changes whatsoever are made to the contents of the file.
						
						June 26, 2007 - AndyBridges killed this bug.  
						Thanks to his investigation, the "modified flag" bug appears to be related to the 
						use of 'ed.command("ecNextLineStart");' to position the cursor, so he replaced it 
						with calls to ed.caretX() and ed.caretY().
						
					Non-ASCII Character Support
					
					-	Cursor movement stops upon encountering non-ASCII characters.
					
						July 16, 2007 - Michal Caplygin
						Altered the alpha regular expression to enable cursor movement when editing files 
						containing non-ASCII characters.

*/

var module_name	= "Ingkcpos";
var module_ver		= "0.5";
var module_title	= 
	"CTRL+(SHIFT)+LEFT/RIGHT cursor navigator";
var white =	/\s/;																	// Specify whitespaces, alphanumerics and delimiters
var alpha = /[^\s\~\!\@\#\$\%\^\&\*\(\)\_\+\{\}\|\:\<\>\?\`\-\=\[\]\\\;\,\.\/\"\']/;	
var delim =	/[\~,\!,\@,\#,\$,\%,\^,\&,\*,\(,\),\_,\+,\{,\},\|,\:,\<,\>,\?,\`,\

⌨️ 快捷键说明

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