Sign in to follow this  
Followers 0
JonathanChan

AutoIt SciTE editor

8 posts in this topic

Hello,

I really enjoyed using the autoit scite editor... I'm surprised how well scripted it is into AutoIt... As I was hacking it to add features of my own, I noticed that certain abbreviations are expanded automagically (by just pressing space) while others require you to push ctrl+b.... Can someone tell me how does SciTE decide this behavior? I've been searching through the lua code and unless i'm blind, i don't see how autoit does it! It appears that it is using au3.keywords.abbrev somehow to tell which words should be expanded, but I can't figure out how the lua code calls this... Please set me straight...

Thanks,

Jonathan

Share this post


Link to post
Share on other sites



Ummm why are you asking about a LUA problem on an Autoit Support Forum just curious.

Share this post


Link to post
Share on other sites

Hello,

I really enjoyed using the autoit scite editor... I'm surprised how well scripted it is into AutoIt... As I was hacking it to add features of my own, I noticed that certain abbreviations are expanded automagically (by just pressing space) while others require you to push ctrl+b.... Can someone tell me how does SciTE decide this behavior? I've been searching through the lua code and unless i'm blind, i don't see how autoit does it! It appears that it is using au3.keywords.abbrev somehow to tell which words should be expanded, but I can't figure out how the lua code calls this... Please set me straight...

Thanks,

Jonathan

The way this works is :

SciTE's standard behavior is Ctrl+B to expand any abbreviation.

I added a new lexer group to the SciLexer called au3.keywords.abbrev. whenever a typed character sequence is in this list, it will get the defined color (standard Red).

The AutoIt3.LUA script is checking to see when a space is hit if the word infront of it is part of this table and when it is, it expands the abbrev as well.

So to sum it up, If Ctrl+B works but SPACE doesn't, it means that the abbrev is not defined in the file au3.keywords.abbreviations.properties.

:whistle:

Ummm why are you asking about a LUA problem on an Autoit Support Forum just curious.

...maybe because its a question about SciTE4AutoIt3 we supply ?

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Ummm why are you asking about a LUA problem on an Autoit Support Forum just curious.

Because the people here wrote the lua editor code - also the AutoIt SciTE page links here as the forum for help and support!

Share this post


Link to post
Share on other sites

The way this works is :

SciTE's standard behavior is Ctrl+B to expand any abbreviation.

I added a new lexer group to the SciLexer called au3.keywords.abbrev. whenever a typed character sequence is in this list, it will get the defined color (standard Red).

The AutoIt3.LUA script is checking to see when a space is hit if the word infront of it is part of this table and when it is, it expands the abbrev as well.

So to sum it up, If Ctrl+B works but SPACE doesn't, it means that the abbrev is not defined in the file au3.keywords.abbreviations.properties.

Ok... Thanks for your response... That all makes sense to me, but I can't figure out one thing! Call me blind, but I can't find where the abbreviation() function checks if the word is in the au3.keywords.abbrev list... I see that au3.keywords.abbrev is defined in the au3.keywords.abbreviation.properties... Could you please kindly show me the lines in autoit3.lua that checks for the au3.keywords.abbrev list? Not real important, but it's nagging at me after looking through the source code for so long...

Thank you..

Jonathan

Share this post


Link to post
Share on other sites

wait! I got it! It's not in the function, it's before the function!

local ls = editor.StyleAt[editor.CurrentPos-2]

if ls == 13 and c == " " then

Why is editor.StyleAt == 13? I see that the keywords.abbrev is keywords7.$(file.patterns.au3)=$(au3.keywords.abbrev)? Shouldn't ls == 7? Maybe i just don't understand lua code...

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

wait! I got it! It's not in the function, it's before the function!

local ls = editor.StyleAt[editor.CurrentPos-2]

if ls == 13 and c == " " then

Why is editor.StyleAt == 13? I see that the keywords.abbrev is keywords7.$(file.patterns.au3)=$(au3.keywords.abbrev)? Shouldn't ls == 7? Maybe i just don't understand lua code...

This is the style in SciLexer for Abbrev expansion:

SciLexer.h.1.137:821:#define SCE_AU3_EXPAND 13

In au3.properties you can find is here:

# Expand abbreviations

style.au3.13=fore:#FF0000,bold

I wrote this LUA function before I submitted the modified Au3LExer to Neil, so instead of testing for SCE_AU3_EXPAND it tests for 13 ...

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

This is the style in SciLexer for Abbrev expansion:

SciLexer.h.1.137:821:#define SCE_AU3_EXPAND 13

In au3.properties you can find is here:

# Expand abbreviations

style.au3.13=fore:#FF0000,bold

I wrote this LUA function before I submitted the modified Au3LExer to Neil, so instead of testing for SCE_AU3_EXPAND it tests for 13 ...

OK... Thanks, that explains things...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0