Jump to content

BETA: SciTE v5x & lua Dynamic_include and "Smart" AutoComplete for Vars/UDFs/Abbrevs


Recommended Posts

  • Developers
Posted (edited)
13 minutes ago, Shark007 said:

Now, interestingly, I used SciTEx86.zip to produce these screenshots

Just tried both the current versions of SciTEx86/64.zip and they both produce the exact same result as I posted previously, so the property works fine.
It looks like your ICONs are somewhat smaller than what I see, but that likely is the result of the Screen setting of 2560x1600 on my laptop with 150% scale (both the recommended setting for this device)

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted (edited)

Looking at the code used in SciTE to produce the Toolbar, I see that standard windows calls are used with standard ICONs and those come in only the 2 sizes..... hence the 0/1 option. :) 
There is an possibility to resize the tile which contains this standard ico to make the clickable space larger, without increasing the size of the ico itself.

This is just toying as I was curious how it was done and played a bit with it when setting the  toolbar.large to a  larger value than the default 32 pixels, it will use that specified size for the tile. EG: Standard toolbar.large=1

Schermafbeelding2023-10-04160408.png.63bd9423b4c972c5d2dc67c6735f3a3b.png

 toolbar.large=40

Schermafbeelding2023-10-04160620.png.b9b45b0ef351513469e89ec65468ecf4.png

 toolbar.large=60

Schermafbeelding2023-10-04160452.png.88c25289a665229a56c6fbd6ff24baef.png 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted (edited)
6 minutes ago, Shark007 said:

Those are interesting results that I cannot reproduce.

Correct as it is only available in my "play garden" ;) 

Still considering whether this is worth the extra MOD to maintain and if so, what the best approach would be.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted

I have updated the SciTEx86/x64.zip files with this test change in SciTE.

  • toolbar.large=1  will show the default large Windows icons in an 32 pixel box.
  • toolbar.large=20 will show the default large Windows icons in an 32+20-1=51 pixel box.

So the current change is to enlarge the button when toolbar.large > 0 with this formula: 32 - 1 + toolbar.large-value.

Give it a try and see if this would be helpful to keep this way. :) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

Hey Jos, not sure if you want to add any headaches to your project, but I was wondering if this helps you with any ideas for the multi-selection auto complete?

This is a bit rough, adding dyn. incl.  loses the multi selection, but it's more for demonstration.

Pic1.gif.cd33e3050702ecc3dab462483d061451.gif

Pic2.gif.e2b2d1df43f8c6a2e46d9099e3250f64.gif

 

I marked places I modified stuff with "--##BEGIN" & "--##END" comments

line 573    AutoItAutoComplete.lua
    -- List 12: AutoComplete Variables names with the seleted option
    if id == 12 then
        -- insert the text from the selected item.
        editor:BeginUndoAction()
        endPos = editor.CurrentPos
        startPos = editor:WordStartPosition(endPos, true)
--##BEGIN
    --  editor:SetSel(startPos, endPos)
    --##END
        -- this part is used for Abbrev expansion
        if str:find('^%w+%<%->') then
    --##BEGIN   
        editor:SetSel(startPos, endPos)
    --##END 
            self:DebugPrint('AutoComplete Abbreviation:', id, str)
            str = str:match('^(.-)<%->')
            -- Get the total len before expansion
            local beforelen = editor.Length - endPos + startPos
            editor:ReplaceSel(str)
            AutoItTools:Abbreviations(0)
            -- Get the total len after expansion
            local afterlen = editor.Length
            -- do  rangecheck for the added line(s) to check for required Includes
            Check_AddMissingIncludes = 'rangecheck'
            Check_AddMissing_spos = startPos
            Check_AddMissing_epos = startPos + afterlen - beforelen - 1
            Check_Adding_extra_chars = false
        else
            --[[
            -- multiselect logic but not able to insret text at multiple place unless clipboard is used.
            for i = 1, editor.Selections, 1 do
                endPos = editor.SelectionNStart[editor.MainSelection]
                startPos = editor:WordStartPosition(endPos, true)
                --print(editor.MainSelection, startPos, endPos)
                --editor:DeleteRange(startPos, endPos -  startPos)
                editor.SelectionNStart[editor.MainSelection] = startPos
                editor.SelectionNEnd[editor.MainSelection] = endPos
                --editor:InsertText(startPos, str) -- doesn't work
                editor:RotateSelection()
            end
            -- Clipboard is used to replace all Selected Ranges
            --  editor:CopyText(str)
            --  editor:Paste()
            ]]
--##BEGIN
        if (editor.Selections == 1) then

editor:SetSel(startPos, endPos)

        -- Only active range is replaced
            editor:ReplaceSel(str)
            self:DebugPrint('AutoComplete Variable selection:', id, str)
            Check_AddMissingIncludes = 'wordcheck'
            Check_AddMissing_spos = nil
            Check_AddMissing_epos = nil
            Check_Adding_extra_chars = true
        else

local aiSpos = { } -- Array of all current Selection positions
local iSels = editor.Selections -- Number of selections
local iDiff = 0 -- Var for recording the difference between string length already typed, and intended string insertion.

for i = 1, editor.Selections, 1 do -- cycle through all current selections, record their current postions.
aiSpos[i] = editor.CurrentPos

editor:RotateSelection()
end

-- Determine the length of characters that will be added. Take length of total insertion string, minus length of current 
-- typed word.
iDiff = string.len(str) - (aiSpos[1] - editor:WordStartPosition(aiSpos[1]))

            Check_AddMissingIncludes = 'wordcheck'
            Check_AddMissing_spos = nil
            Check_AddMissing_epos = nil
            Check_Adding_extra_chars = true
            
for i = 1, iSels, 1 do -- cycle through selections.

--Select the word already typed for the nth selection.
editor:SetSel(editor:WordStartPosition(aiSpos[i]), aiSpos[i])

editor:ReplaceSel(str) -- replace the text

-- Color inserted text to set the right style
        self:ReLexStyles()
        
        -- if is a Func, add the "(". 
            if editor.StyleAt[editor.CurrentPos - 2] == SCE_AU3_FUNCTION
            or (editor.StyleAt[editor.CurrentPos - 2] >= SCE_AU3_UDF and editor.StyleAt[editor.CurrentPos - 2] <= SCE_AU3_FILEUDF) then
            -- add ( for Funcs/UDFS and trigger the CallTip
            editor:AddText('(')
            
            -- If we are adding a "(", I need to add 1 to my iDiff var. 
            -- I cant add 1 on the first or last rounds, as that would put my positions out of sync. 
if (i ~= 1) and (i ~= iSels) then iDiff = (iDiff + 1) end

            scite.MenuCommand(IDM_SHOWCALLTIP) -- Show ToolTip for Functions
            -- Vars/Keywords: add newline when Enter was pressed on Dropdown ... else add space for Variables and internal keywords
end

-- Cycle through my list of Selection positions, if any come after the current position I am working on, add my difference 
 -- value to keep the correct position.
for j = 1,iSels, 1 do
if (aiSpos[j] > aiSpos[i]) then aiSpos[j] = aiSpos[j] + iDiff end

end

-- update the saved position to the current position after auto completing.
aiSpos[i] = editor.CurrentPos

end

-- Add the selections back so we have multiple again.
for i = 1, iSels, 1 do 
editor:AddSelection(aiSpos[i], aiSpos[i])

end

-- rotate one selection to get back to the original "MainSelection".
editor:RotateSelection()

        end
        
            self:DebugPrint('AutoComplete Variable selection:', id, str)
Check_Adding_extra_chars = false

--##END
        end
        -- Color inserted text to set the right style
        self:ReLexStyles()
        -- check for adding characters after adding the selected Dropdown text
        if not Check_Adding_extra_chars then
            -- Don't add any character for Abbrev's
            -- nothing here

 

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Posted (edited)

setting of 1

image.thumb.jpeg.8319885e5b14d113911be3fcb108c12f.jpeg

setting of 20

image.thumb.jpeg.499aa3b0266e4fc2bb770ea709e0c270.jpeg

setting of 40

image.thumb.jpeg.23c9e55ab920e58a2c500670a8d8dc45.jpeg

@Jos, although not perfect, it certainly gets props for visibility and usability.  Please carry some form of this into the next official release.

I have not tested 32bit yet. I will post of it only if I encounter anomalies.

EDIT: It may be of interest to you, I'd like to explain my use of HiDpi=n

I have recently adopted @argumentum solution for DPI Awareness GUI presentation integration in This Thread which is facilitated by @UEZ solution in This Post because the resulting code is so much cleaner than adding a multiplication factor to all of the coordinates and dimensions as I was doing in the past. I hope these projects see the love they deserve.

Edited by Shark007
  • Developers
Posted
9 hours ago, donnyh13 said:

This is a bit rough, adding dyn. incl.  loses the multi selection, but it's more for demonstration.

I see what you have done working around the losing Multi Sel by saving the positions, then replacing each and then adding them back into the multi selections set.
Have to have a look at that in more detail, but thanks for the idea.  It all still feels strange that AutoComplete isn't working with MultiSelect in the base functionality either.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted
9 hours ago, Shark007 said:

@Jos, although not perfect, it certainly gets props for visibility and usability.

Life's full of compromises, but I am planning to leave this in for now as it also helps me making the Click-and-Hit-rate better. :) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)
9 hours ago, Jos said:

It all still feels strange that AutoComplete isn't working with MultiSelect in the base functionality either

Ya I know, it's kinda weird.

I did spot this, but I'm guessing it wouldn't be compatible with your method of Auto completing?

Lua Scite API

Quote

int editor.AutoCMulti -- Change the effect of autocompleting when there are multiple selections.

Quote

SCI_AUTOCSETMULTI(int multi)
SCI_AUTOCGETMULTI → int
When autocompleting with multiple selections present, the autocompleted text can go into just the main selection with SC_MULTIAUTOC_ONCE (0) or into each selection with SC_MULTIAUTOC_EACH (1). The default is SC_MULTIAUTOC_ONCE.

 

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Posted (edited)

Something wrong with auto indent.
When I hit ENTER after 1


I get:
 

_Example()
Func _Example()
    Select
    Case 1
        
        
    EndSelect
EndFunc   ;==>_Example

instead expected:

_Example()
Func _Example()
    Select
        Case 1
        
        
    EndSelect
EndFunc   ;==>_Example

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

  • Developers
Posted
On 10/9/2023 at 9:33 AM, mLipok said:

Something wrong with auto indent.
When I hit ENTER after 1

 

The issue looked like some race condition between scripts, so I have changed the logic somewhat to avoid that in the latest SciTE_changes_Dynamic_Includes_LUA.zip

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted (edited)
On 10/5/2023 at 5:56 PM, donnyh13 said:

Lua Scite API

Quote

int editor.AutoCMulti -- Change the effect of autocompleting when there are multiple selections.

When I activate this one via LUA by doing editor.AutoCMulti=1, then the standard SciTE AutoComplete does insert the selected text in all multiselects. Not sure yet how one could configure this as standard behavior when wanted.    

EDIT: Think I found the proper way of doing this so have a play with the latest LUA version in SciTE_changes_Dynamic_Includes_LUA.zip

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
2 hours ago, Jos said:

The issue looked like some race condition between scripts, so I have changed the logic somewhat to avoid that in the latest SciTE_changes_Dynamic_Includes_LUA.zip

Confirmed as fixed

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

  • Developers
Posted (edited)
22 minutes ago, mLipok said:

Confirmed as fixed

...Thanks, but I think I have an issue with AutoComplete Abbrevs after the last changes so stay tuned. ....

EDIT: Should be fixed in the latest version (13:06)

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Thanks for all of the additions and fixes Jos, I was wondering if you have decided on my feature request from a few pages ago? Sorry if you did repsond, I didn't see it if you did.

On 9/26/2023 at 10:21 AM, donnyh13 said:

Is it possible to allow ctrl+Backspace to be used (to delete a word at a time) while the AutoComplete drop down is active? Both in single selection and multiple selection?

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

  • Developers
Posted (edited)

Sorry .... indeed missed that....   need to think/play a bit for that one, but assume it should be possible when that indeed is standard behavior. (Another one I haven't used before :) )

EDIT: Uploaded fix for that in the latest SciTE_changes_Dynamic_Includes_LUA.zip

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...