Download
(9Kb)
Download
Updated: 02-22-07 01:13 AM
Pictures
File Info
Updated:02-22-07 01:13 AM
Created:unknown
Downloads:3,997
Favorites:56
MD5:

For All Indents And Purposes

Version: 17
by: krka [More]

What is this?
This is an addon that hooks into existing editboxes and adds Lua syntax highlighting and indentation to them. The screenshots should be all the clarification you need. This is useful for all you Lua developers that like to test Lua code ingame. For the rest of you... you probably won't need this.

This is both a standalone addon and an embedded library.
The standalone addon is simply the embedded part + a set of default hookings.

Description for users
Unzip the addon into your AddOns directory and it'll Just Work(tm).

Description for developers
It's easy to add embed this into your own addon and hook it into your own editboxes. This won't add any dependencies to your addon (Yay!). See inside indent.lua for more details.

Default hookings
This addon automatically hooks the following addons to get syntax highlighting:
* LuaPad
* TinyPad
* LuaSlinger
* Phoenix
* Inspector
* FuncBook

It's extremely easy to add more addons to this list. Just take a look inside defaulthooks.lua and add the addon to the table using the same format as the others. Let me know if you want me to add builtin support for some other editor.

Changelog
Revision 13 - Fixed bug that occured when setting text to nil.
Revision 14 - Fixed bug that made it impossible to write ~=
Revision 15 - Added myDebug support
Revision 16 - Now indents and highlights for Lua 5.1 syntax. Lua 5.0 syntax is NOT supported. This mostly affects nested comments. Also updated to work with WoW 2.0

Revision 17 - major release:
* internal parser / highlighter / indenter system unchanged
* major rewrite of wow interfacing code, including disabling / enabling
* fixed broken caching mechanism
* fixed problem with MaxLetters and MaxBytes causing text disappearing
* fixed bug with lots of newlines appended when typing an unfinished lua string
* stopped recoloring upon text change - instead, it gets done in an OnUpdate-loop, if the text has been recently changed.
This should significantly improve performance when pasting text. Now the editbox only gets recolored after 0.2 seconds of inactivity

* deprecated, but still working:
- lib.addSmartCode -- replaced by lib.enable

* new functions:
- lib.enable(editbox [, colorTable [, tabWidth]])
- lib.disable(editbox)

* Useful properties to set. Note that after a change, you need to manually call lib.indentEditbox or lib.colorCodeEditbox
for changes to take effect:
- editbox.faiap_colorTable
- editbox.faiap_tabWidth

Optional Files (0)


Post A Reply Comment Options
Unread 10-04-20, 05:29 AM  
spiralofhope
A Deviate Faerie Dragon
 
spiralofhope's Avatar

Forum posts: 13
File comments: 276
Uploads: 0
This is still in live use in _DevPad.GUI. I hope it doesn't break!
__________________
spiralofhope.com
Report comment to moderator  
Reply With Quote
Unread 11-18-18, 04:59 PM  
Shaun Dreclin
A Kobold Labourer

Forum posts: 0
File comments: 9
Uploads: 0
Re: Embedding FAIAP with a WOWACE multilineeditbox

@TimothyLuke

I'm getting the same error just trying to get this to work with TinyPad, something that it's supposed to support by default. I think EditBox:GetMaxBytes() has been removed somewhere along the line, would explain why trying to call it is throwing errors like that
Report comment to moderator  
Reply With Quote
Unread 08-09-16, 10:24 PM  
TimothyLuke
A Fallenroot Satyr
 
TimothyLuke's Avatar
AddOn Author - Click to view AddOns

Forum posts: 24
File comments: 136
Uploads: 5
Embedding FAIAP with a WOWACE multilineeditbox

I know this hasn't been looked at in the last few years but I am trying to embed this into an editor that I am writing.

Wrongly or rightly I wrote my UI with ACEGUI. All the examples of people embedding this havent done that but WeakAuras has. I have followed the example of how WeakAuras implemented FAIAP and am using the same version that they are using as well as the same ACEGUI libs but I am getting a weird error. I know its not a 7.0.3 error as its working for other mods.

Whenever I try to
Code:
IndentationLib:enable(premacrobox.editBox, nil, 2)
I get errors from within that on all the internal methods - GetMaxBytes, SetMaxBytes, GetMaxLetters, SetMaxLetters, and the Hook functions. Its like all the methods become nil once it is passed to FAIAP. I can do a /script premacrobox.editBox:SetMaxBytes(10) and a /dump premacrobox.editBox:GetMaxBytes() will return 10 but if i go into the enable() and try to do a print editBox:GetMaxBytes() it throws a nil at GetMaxByes()

The stacktrace it gives me is

Code:
Message: ...quenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:1171: attempt to call method 'GetMaxBytes' (a nil value)
Time: 08/09/16 17:24:38
Count: 1
Stack: ...quenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:1171: in function `enable'
Interface\AddOns\GS-SequenceEditor\editor-core.lua:209: in main chunk

Locals: editbox = <table> {
 colorCodeEditbox = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:999
 stripWowColors = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:895
 encode = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:960
 faiap_tabWidth = <table> {
 }
 tokenIndentation = <table> {
 }
 tokens = <table> {
 }
 indentCode = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:662
 decode = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:952
 enable = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:1145
 linebreakCharacters = <table> {
 }
 revision = 19
 padWithLinebreaks = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:977
 stripWowColorsWithPos = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:967
 addSmartCode = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:1145
 keywords = <table> {
 }
 faiap_colorTable = MultiLineEditBox4Edit {
 }
 colorCodeCode = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:556
 stringdelete = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:60
 stringinsert = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:55
 indentEditbox = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:1043
 specialCharacters = <table> {
 }
 whitespaceCharacters = <table> {
 }
 defaultColorTable = <table> {
 }
 bytes = <table> {
 }
 disable = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:1189
}
colorTable = MultiLineEditBox4Edit {
 0 = <userdata>
 obj = <table> {
 }
}
tabWidth = <table> {
 1 = ""
 0 = ""
 string = ""
 tostring = ""
 print = ""
 8 = ""
 10 = ""
 unpack = ""
 gsub = ""
 format = ""
 20 = ""
 24 = ""
 strconcat = ""
 32 = ""
 pairs = ""
 next = ""
 max = ""
 assert = ""
 tonumber = ""
 tostringall = ""
 33 = ""
 wipe = ""
 strtrim = ""
 21 = ""
 tinsert = ""
 sort = ""
 coroutine = ""
 tremove = ""
 strmatch = ""
 strsub = ""
 strsplit = ""
 strrev = ""
 strrep = ""
 strlower = ""
 9 = ""
 11 = ""
 strchar = ""
 math = ""
 strjoin = ""
 pcall = ""
 abs = ""
 strbyte = ""
 type = ""
 strupper = ""
 floor = ""
 select = ""
 ceil = ""
 strfind = ""
 table = ""
 min = ""
 5 = ""
 bit = ""
 22 = ""
 23 = ""
 12 = ""
 error = ""
 ipairs = ""
}
modified = true
(*temporary) = nil
(*temporary) = <table> {
 colorCodeEditbox = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:999
 stripWowColors = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:895
 encode = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:960
 faiap_tabWidth = <table> {
 }
 tokenIndentation = <table> {
 }
 tokens = <table> {
 }
 indentCode = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:662
 decode = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\ForAllIndentsAndPurposes\indent.lua:952
 enable = <function> defined @Interface\AddOns\GS-SequenceEditor\lib\Fo
My FAIAP file is here: https://github.com/TimothyLuke/Gnome...ses/indent.lua

The Page where I am trying to call it from is https://github.com/TimothyLuke/Gnome...ditor-core.lua

If anyone knows anything.....
__________________
BattleNet: TimothyLuke#1860
WowLazyMacros/Curse/GitHub/WowInterface: TimothyLuke

Most Commonly Played Characters:
Huldrych@Dath'Remar
Draik@Nagrand
Report comment to moderator  
Reply With Quote
Unread 07-22-11, 08:23 PM  
spiralofhope
A Deviate Faerie Dragon
 
spiralofhope's Avatar

Forum posts: 13
File comments: 276
Uploads: 0
This was embedded in _DevPad and is working perfectly.

However, the one in _DevPad has been updated and is newer than what's found here .. maybe. Perhaps it's just embedded with some changes to variables.
__________________
spiralofhope.com
Last edited by spiralofhope : 07-25-11 at 01:06 PM.
Report comment to moderator  
Reply With Quote
Unread 05-17-09, 07:08 PM  
nrpieper
A Defias Bandit
 
nrpieper's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 27
Uploads: 2
Some of the best Lua add-on code I've seen.

I should have thought to use your method to track the cursor position while removing and inserting color tags. Nicely done.
__________________
-Nate
(Bowtonate on Whisperwind)
------------------------------------------------
Author of Misspelled, the Wow chat spell-checker
Last edited by nrpieper : 05-17-09 at 07:09 PM.
Report comment to moderator  
Reply With Quote
Unread 07-30-08, 03:52 PM  
Nexuapex
A Fallenroot Satyr
AddOn Author - Click to view AddOns

Forum posts: 25
File comments: 9
Uploads: 1
A++. Would optionally depend upon again.
Report comment to moderator  
Reply With Quote
Unread 02-22-07, 05:22 PM  
Fin
An Aku'mai Servant
 
Fin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 34
File comments: 74
Uploads: 3
Hooray!

krka rides again! We don't deserve you krka, really!
Report comment to moderator  
Reply With Quote
Unread 02-22-07, 12:30 PM  
break19
A Flamescale Wyrmkin
AddOn Author - Click to view AddOns

Forum posts: 116
File comments: 99
Uploads: 3
Originally posted by krka
Revision 17 is currently pending, and it should fix your bug (and a few others).
Sorry it took so long to fix!

(In my defense i dont play WoW any more :-))
HERETIC!!
Quick! Call the Spanish Inquisition! *NOOOOOBody expects the spanish inquisition*
Report comment to moderator  
Reply With Quote
Unread 02-22-07, 01:48 AM  
krka
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 12
File comments: 7
Uploads: 2
Originally posted by dracula
Nice idea, but it's entirely impossible to paste multi-line code into a LuaSlinger editbox with this addon active. Probably because it keeps changing and highlighting the code while it is still being added, and that heavily truncates the pasted code.
Revision 17 is currently pending, and it should fix your bug (and a few others).
Sorry it took so long to fix!

(In my defense i dont play WoW any more :-))
Report comment to moderator  
Reply With Quote
Unread 12-30-06, 10:52 PM  
dracula
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 7
File comments: 70
Uploads: 2
Nice idea, but it's entirely impossible to paste multi-line code into a LuaSlinger editbox with this addon active. Probably because it keeps changing and highlighting the code while it is still being added, and that heavily truncates the pasted code.
Report comment to moderator  
Reply With Quote
Unread 06-25-06, 08:43 AM  
qweqq
A Defias Bandit

Forum posts: 3
File comments: 1
Uploads: 0
this addon is awesome ! so cool and simple ! great work !
Report comment to moderator  
Reply With Quote
Unread 04-26-06, 01:07 PM  
krka
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 12
File comments: 7
Uploads: 2
Thanks

Thanks for all the friendly feedback!

Undo-button is a good idea, but i think that's something should be handled by the editor (i.e. provide the proper undo button to click and stuff).

FuncBook has been added, as you can see.
Report comment to moderator  
Reply With Quote
Unread 04-25-06, 10:42 PM  
Kaelten
Jack's raging bile duct
 
Kaelten's Avatar
Featured Addon Author

Forum posts: 782
File comments: 48
Uploads: 12
addons["FuncBook"] = {
"FuncBookFrameEditorScrollBoxEditBox"}
__________________
WowAce.com & CurseForge.com Adminstrator
Developer of Ace3, OneBag3, and many other addons and libraries
Project lead and Mac developer for the Curse Client

Anyone that needs what they want
And doesn't want what they need
I want nothing to do with
Report comment to moderator  
Reply With Quote
Unread 04-25-06, 02:47 PM  
Mazzlefizz
A Pyroguard Emberseer
 
Mazzlefizz's Avatar
AddOn Author - Click to view AddOns

Forum posts: 3521
File comments: 60
Uploads: 2
Awesome! Just awesome.

You should get an undo function in there, though that might be a bit cumbersome. That's the one other thing that stops me from ever editing code in WoW. I'll accidentally flick my trackpad or select the whole thing when I enter the frame, and then type something and, bam, one or all lines are gone forever.
__________________
MazzleUI Home Page: Mazzlefizz.WoWInterface.com
Info, FAQs, Forums, Download can be found at that link.
Last edited by Mazzlefizz : 04-25-06 at 04:58 PM.
Report comment to moderator  
Reply With Quote
Unread 04-25-06, 02:16 PM  
willgk
An Aku'mai Servant
AddOn Author - Click to view AddOns

Forum posts: 37
File comments: 147
Uploads: 1
Thumbs up WOW!

This is the absolute coolest mod yet. Thanks krka!!!!
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: