The cool thing is that a lot of things are done programmatically through the Scintilla APIs. Thanks to that, the script can be scanned on demand without the user noticing. As well, it becomes trivial to go to a specific line programmatically.
Note: Only works with Scintilla editors. The ones I know of are Notepad++, Notepad2, SciTE and SciTE4AutoHotkey.
The settings are preconfigured for those editors, but you just have to change sActiveWindow to the title of your editor's window to make it work with other Scintilla editors.
Important note for SciTE/SciTE4AutoHotkey users: the values of check.if.already.open and title.full.path (found in the file SciTEGlobal.properties) must be set to 1 if you wish to use the #Include file scanning feature. In SciTE4AutoHotkey, that is the default value. But not in SciTE.
Important note for Notepad2 users: the setting Window Title Display must be set to Full Pathname. This setting can be found in the Settings menu.
![Posted Image](http://img17.imageshack.us/img17/3961/tillagoto.png)
Features:
[*:oe94ynni] Simply middle click a function/label to go to its definition!
[*:oe94ynni] Capable of listing and opening functions in #Include files and libraries
[*:oe94ynni] Go back and forth between the lines you jumped to using the mouse or keyboard
[*:oe94ynni] Compatible with all AutoHotkey versions (ANSI/Unicode & 32/64-bit).
[*:oe94ynni] Instant refresh. The script is scanned on call.
[*:oe94ynni] Incremental search
[*:oe94ynni] Match-anywhere searches also available (see script)
[*:oe94ynni] Cool fade-in effect!
[*:oe94ynni] Custom transparency
[*:oe94ynni] Customizable hotkey (default is F1 - see script to change)
[*:oe94ynni] Customizable appearance (width and height)
[*:oe94ynni] Works with any editor that uses Scintilla (eg. Notepad++, SciTE, SciTE4AutoHotkey)
[*:oe94ynni] Seemless integration with the editor (programmatically scans the script and goes to specified line)
[*:oe94ynni] Works with any bracing style (OTB or not).
[*:oe94ynni] Selecting a function name or label and pressing the hotkey will automatically bring you to the definition line. In fact, selecting any text which would yield only one answer in the incremental search will automatically redirect you to the matching line upon hotkey press.Usage:
[*:oe94ynni] You can customize the appearance of the GUI by changing the values of iGUIWidth (default is 230), iGUIHeight (default is 12 rows), iMargin (default is 2), bPosLeft (default is False), bWideView (default is True), iTransparency (default is 255), bTrayIcon (default is True), iAlignFilenames (default is False), iControlFontSize (default is 8), and fControlFont (default is Courier New). See the script for more details.
[*:oe94ynni] If the default colours don't match your lexing/theme, you may change the background of the GUI and the controls and the text colour by changing the values of cGUIBG, cControlBG, and cControlFG.
[*:oe94ynni] For extremely large scripts (> 5000 lines, especially with a lot of comments), performance may be enhanced by turning comment filtering off through bFilterComments (default is True). On the same note, you may turn the flag off anyways to improve performance if you're confident your comments do not contain function/label/hotkey-looking text that might get picked up during script analysis.
[*:oe94ynni] Because large blocks of comments are the most intensive to scan, if you know a comment block does not contain labels/hotkeys/functions look-alikes, you can exclude it from comment filtering by adding an exclamation mark (ie. "!") in the starting line of the block (ie. "/*!")
[*:oe94ynni] The variable iIncludeMode (default is 0x10100101) allows you to customize how TillaGoto should scan #Include files and library functions. See the script for the full list of options available. Note that if this feature is used, the variable sPathMatching should be properly set for TillaGoto to extract the path from the window title (default is set for Notepad++ and SciTE4AutoHotkey). Using the #Include file scanning feature reduces performance and should be turned off (or at least comment filtering) if lag is experienced. If you use SciTE/SciTE4AutoHotkey or Notepad2, see the important note above for the #Include file scanning feature to work properly.
[*:oe94ynni] You can change the behaviour of TillaGoto on a per script basis by using directives. See the bDirectives setting for more details.
[*:oe94ynni] If using the #Include file scanning feature, it is strongly recommended to enable file caching, by setting bCacheFiles to True (default value). This will allow TillaGoto to be much faster on subsequent scans of the same include files.Using the keyboard[*:oe94ynni] You can use TillaGoto in two ways, depending on the value of bQuickMode. When bQuickMode is False (default), TillaGoto will monitor the active window for the editor you specified in sActiveWindow and open the GUI everytime you press the hotkey specified by uHotkey. If bQuickMode is True, running the script will automatically open the GUI, assuming the active window upon execution matches sActiveWindow.
[*:oe94ynni] Pressing the hotkey again while the GUI is open will either:[*:oe94ynni] go to the selected item, [*:oe94ynni] or, if the GUI doesn't have focus, put focus back on the search textbox (and update it with any text that was selected).[*:oe94ynni] When the GUI is open, you can type in the TextBox in order to narrow down your search by filtering the list of functions/labels/hotkeys. If bMatchEverywhere is False, typing anything in the TextBox will filter out all the functions/labels/hotkeys that do not begin with the text you typed. If bMatchEverywhere is True (default), typing in the TextBox will filter out all the functions/labels/hotkeys that do not contain all the words you typed. For example, typing "() func" will filter out all the functions/labels/hotkeys that do not contain the strings "()" and "func". You can also exclude items containing a certain string by preceding the string with an exclamation mark (ie. "!"). For example, typing "!() MyLabel" will filter out all the functions/labels/hotkeys that do not contain "MyLabel" as well as those that do contain "()".
[*:oe94ynni] You can go back and forth between the points you recently jumped to by pressing the hotkeys specified in uGoBack and uGoForward (default is Alt+Left and Alt+Right)
[*:oe94ynni] You can go to the definition line of the function/label on which the caret is located by pressing the hotkeys specified in uGotoDef (default is Shift+Enter). It is the keyboard equivalent of middleclicking on a function/label name.[/list]Using the mouse[*:oe94ynni] If bUseMButton is True (it is by default), you can use the middle mouse button to open the GUI, as well as to go to a function/label definition line simply by middle-clicking on its name.
[*:oe94ynni] Upon opening the GUI (or anytime the TextBox has focus), you can move the selection by using the mouse wheel. After selecting the function you want, simply click the middle mouse button or press the hotkey again to go to the selected item. This is useful for when you see the function in the list. You can then quickly scroll to it.
[*:oe94ynni] If you'd like to close the GUI using the mouse, you can depress the middle mouse button for the time duration specified in iCancelWait (default is 300 ms).
[*:oe94ynni] You can go back and forth between the points you recently jumped to by doing Shift + Mouse wheelThanks to majkinetor for his Remote Buffer library, which helped me understand how to use those functions in TillaGoto.
This script also uses heresy's EmptyMem() function, included in the script (thanks heresy!)
This script also uses a function based on Lazslo's code (which itself is based on Shimanov's code) found here.
And finally, it uses code largely based on Lazslo's CRC32() and MCode() functions.
Download
Requires AutoHotkey version 1.0.48+
Suggestions, comments always welcome! :D
Changelog
December 30, 2010
- Added support for 64-bit and Unicode AHK
- Large performance increase by tweaking comment filtering and regexes
- Added library file support for ScanFile directive
- Added user library scanning
- Removed the dependency on RemoteBuf (functions have been inlined)
- Added iAlignFilenames (and removed bAlignFilenames which was unreliable)
- Improved reliability of middle-clicking on functions/labels
- Improved reliability of line history
- Improved caching system reliability and performance
October 23, 2010
- Fixed bugs with files only using CR or LF.
- Fixed small middle clicking bug.
- Fixed comment filtering bug.
- Minor improvements.
March 2, 2010
- Fixed a small bug causing middle clicking not to work if the GUI has never been summoned.
February 25, 2010
- Added sMustExist and bQuitWithEditor
- Added bAlignFilenames
- Fixed include directive scanning not following working directory changes
- Fixed #Include lines at the end of the script causing TillaGoto to stick in a loop
- Improved Include regex to support IncludeAgain and the *i option
- Improved label and hotkey scanning to include all valid labels and hotkeys
- Improved main loop and hotkey implementation
- Improved accuracy of various regexes
- Improved configuration documentation
- Improved bQuickMode implementation
- Improved filename alignment implementation
- Minor fixes and improvements
- Changed symbols when appending names of include files ("\") and library files ("|") because the previous symbol was too common in hotkeys
February 13, 2010
Major changes:
- Added ScanFile directive
- Added ability to differentiate identically named functions/labels/hotkeys from different #Include/library files
- Aligned appended filenames to the right
- TGcache files are deleted even if last instance didn't exit properly
- Fixed bug where TillaGoto would stop showing when called
- Fixed line history not working across multiple scripts
Minor changes:
- Improved bWideView implementation (and fixed hscrollbar showing up under certain conditions)
- Improved middle click implementation
- Changed hotkey focusing behaviour
- Different symbols when appending names of include files ("#") and library files ("\")
- Added bTrayIcon (default True)
- Added iControlFontSize (default 8)
- Added fControlFont (default Courier New)
- Changed default value of bCacheFiles to True
- Changed default value of iIncludeMode to 0x10100101 (scan include files for functions and append name)
- Minor fixes and improvements
May 4, 2009
- Added the ability to cache files (see Usage and script for details)
- Middleclicking will also move the caret to the position clicked before going to the clicked function/label/hotkey
- Simplified GUIInteract() and cleaned up HID stuff
April 6, 2009
- Added full support for Notepad2 (see important note above)
- Added cGUIBG, cControlBG, and cControlFG (see usage)
- The position of the GUI now takes into account the presence of a vertical scrollbar
- Simplified and improved compatibility of the external file launching routine
- Fixed End key and Home key being sent to the listbox instead of the textbox. Now, doing Ctrl+End and Ctrl+Home while focused on the textbox will send End and Home (respectively) to the listbox
- Fixed matching ending character in regexes to support files with no CR characters
Mar 29, 2009
- Fixed bug causing line history not to record current line when using the GUI.
- Fixed bug causing scripts that only use LF (instead of CRLF) as line delimiter wouldn't get scanned.
Mar 28, 2009
- Added bWideView (see script)
- Improved respect to iGUIHeight so that the number of items shown is always the same, even with a hscrollbar
Mar 22, 2009
- Added uGotoDef (see keyboard usage)
- Added a few tweaks to reduce listbox flickering during typing
- Changing selection now keeps focus on the textbox
- Simplified the directives system
- Fixed small bug in line history feature
Mar 20, 2009
- Added the ability to exclude words (see in keyboard usage)
- The directive TillaGoto.bFilterComments is now also valid for #Include files (it will override the default setting)
- Added the ability to exclude comment blocks from scanning (see in general usage)
- The line history feature now remembers the line history across different opened script (by comparing the script path). As a side-effect, resaving (ie. "Save As...") the same script as another file will erase the line history.
- sPathMatching is now mandatory (line history relies on it)
Mar 18, 2009
- Added bDirectives for TillaGoto directives
- Fixed sPathMatching failing to match for modified Notepad++ documents
- Changed LShift to Shift in general for line history feature
- Fixed bug where the next line of comments wouldn't get commented out
Mar 16, 2009
- Largely improved the Line History feature. It now behaves much more intuitively.
Mar 15, 2009
- Changed AbsolutePath() to use APIs (much more reliable)
Mar 14, 2009
- Fixed sPathMatching (it was missing a closing parenthesis)
- Fixed sEditorPath for Quick Mode (thanks HotKeyIt)
- Added the ability to middle-click on external functions and labels (thanks fincs)
- Fixed external file opening for labels and hotkeys (thanks HotKeyIt!)
- Added a line history feature allowing you to quickly go back and forth between recent jumps
- Fixed AbsolutePath() to be more accurate
- Fixed middleclick not working when appending name of file to external functions (thanks fincs!)
- Changed the external file launching procedure so that the requested line is at the top!
- Fixed library files being scanned for things other than functions
- Fixed the possibility of having the same file scanned multiple times
- Fixed file name being trimmed only if it ends with ".ahk" (thanks HotKeyIt)
Mar 13, 2009
- Added iIncludeMode and sPathMatching for #Include file scanning and library files scanning (and opening)
- Removed MsgBoxes in HID_GetInputInfo() which would rarely occur
- Fixed a possible error for when WM_INPUT's handle expired
- Fixed default value of sPathMatching and sActiveWindow so that it better matches SciTE/SciTE4AutoHotkey
Mar 08, 2009
- Added bFilterComments
- Added SetBatchLines -1 to the algorithm to make it faster
- Improved even more the comment filtering algorithm to make it even faster (noticeable difference for big scripts)
Mar 07, 2009
- Greatly improved analysis speed for large scripts with a lot of comments
- Added bPosLeft (feature suggested by HotKeyIt)
- Added iMargin
- Made the default size a little wider and taller
- Changed default value of sActiveWindow to match both Notepad++ and SciTE4AutoHotkey
- Added the SciTE4AutoHotkey fix by HotKeyIt
Mar 06, 2009
- Added bUseMButton (see usage and script for details)
- Added EmptyMem() by heresy to keep memory usage to a minimum
- Added iCancelWait (see usage and script for details)
Mar 05, 2009
- You can now click the middle mouse button for selection using the mouse wheel
- Fixed bug where commented hotkeys would show up in the list
Mar 04, 2009
- Added bQuickMode
- Changed location of GUI: it now shows up right beside the scrollbar
- Fixed script scanning so that line comments don't conflict with scanning (thanks HotKeyIt for reporting it!)
- Fixed bug where single-character hotkeys wouldn't show up (thanks HotKeyIt for reporting it!)
- Fixed possible endless loop if the hotkey is on the last line
- Added mouse wheel support for quick selection (see usage)
Mar 03, 2009
- Fixed a bug where If() and While() would be added (thanks fincs!)
- Added the ability to match anywhere, and match multiple words (see script)
- Made the GUI a little skinnier by reducing the margin
- GUI now closes upon selecting another window
- Added the ability to select transparency (see iTransparency in script)
- GUI now shows up in the corner of the window. Let me know what you think.
- Made the script 1024x768 friendly (ie. cut long lines in shorter ones)
- Added support for hotkey scanning as well!
- Restructured script to be more organized
- Added support for clone mode in Notepad++
- Made minor optimizations