Jump to content

SciTE v 3.20 Beta available


Jos
 Share

Recommended Posts

I now receive this message:

C:Program Files (x86)AutoIt3SciTELUAMyTools.lua:1: attempt to index global 'MyTools' (a nil value)
>Lua: error occurred while loading startup script

Link to comment
Share on other sites

Sorry for the question, but is there already an installer for the Scite_beta or do I manually have to download the files from here : http://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/SciTE-3.03/

I would like to test a little bit, too :-)

On the first post the dll link isn't working, but I can download the standalone Scite.exe.

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

SciTEStartup.lua

--------------------------------------------------------------------------------
-- SciTE startup script.
--------------------------------------------------------------------------------

-- A table listing all loaded files.
LoadLuaFileList = { }

--------------------------------------------------------------------------------
-- LoadLuaFile(file, directory)
--
-- Helper function for easily loading Lua files.
--
-- Parameters:
--  file - The name of a Lua file to load.
--  directory - If specified, file is looked for in that directory.  By default,
--       this directory is $(SciTEDefaultHome)Lua.
--------------------------------------------------------------------------------
function LoadLuaFile(file, directory)
    if directory == nil then
        directory = props["SciteDefaultHome"] .. "Lua"
    end
    table.insert(LoadLuaFileList, directory .. file)
    dofile(directory .. file)
end -- LoadLuaFile()

-- Load all the Lua files.
LoadLuaFile("Class.lua")    -- Always load first.
LoadLuaFile("Common.lua")   -- Always load second.
LoadLuaFile("AutoItPixmap.lua")
LoadLuaFile("AutoHScroll.lua")
LoadLuaFile("AutoItAutoComplete.lua")
LoadLuaFile("LoadSession.lua")
LoadLuaFile("AutoItIndentFix.lua")
LoadLuaFile("EdgeMode.lua")
LoadLuaFile("SmartAutoCompleteHide.lua")
LoadLuaFile("Tools.lua")
LoadLuaFile("AutoItTools.lua")
LoadLuaFile("AutoItGotoDefinition.lua")
LoadLuaFile("MyTools.lua", "C:Program Files (x86)AutoIt3SciTELUA")

-- Start up the events (Calls OnStartup()).
EventClass:BeginEvents()

MyTools = EventClass:new(Common)

MyTools.lua

MyTools = EventClass:new(Common)

function MyTools:OnStartup()
    -- class property to hold active marker state so we only update when necessary
    self.bMarkersActive = false
    -- class property to indicate programatic marker clearing and avoid double UI update
    self.lastSelText = ""
    -- initialize missing props
    if props['highlight.sel.text'] ~= '0' and props['highlight.sel.text'] ~= '1' then
        props['highlight.sel.text'] = '1'
    end
    if props['highlight.whole.word'] ~= '0' and props['highlight.whole.word'] ~= '1' then
        props['highlight.whole.word'] = '1'
    end
    if props['highlight.min.length'] == '' then
        props['highlight.min.length'] = '2'
    end
end

function MyTools:OnUpdateUI()
    if props['highlight.sel.text'] == '1' then
        local selText = editor:GetSelText()
        -- check if selection has changed, update accordingly
        if selText == self.lastSelText then
            return false
        else
            self.lastSelText = selText
        end
        --print('update')
        local selStart = editor.SelectionStart
        local selEnd = editor.SelectionEnd
        -- check if selected text is an allowed word
        if selStart ~= selEnd and self:IsWord(selText) then
            -- check for word boundaries at ends of selection
            if props['highlight.whole.word'] == '0' or (not self:IsWord(string.char(editor.CharAt[selStart-1])) and not self:IsWord(string.char(editor.CharAt[selEnd]))) then
                self:markOccurrences(selText)
            else
                self:clearOccurrences()
            end
        else
            self:clearOccurrences()
        end
    end

    return false
end

function MyTools:IsWord(word)
    if props['highlight.whole.word'] == '1' then
        -- look for anything not allowed
        local find = string.find(word, '[^%a%d_$#@.]')
        if find == nil then
            return true
        else
            return false
        end
    else
        -- return true if selection length is >= highlight.min.length and no new lines
        local find = string.find(word, '[rn]')
        if find == nil and string.len(word) >= tonumber(props['highlight.min.length']) then
            return true
        else
            return false
        end
    end
end

function MyTools:clearOccurrences()
    if self.bMarkersActive then
        --print('clearing')
        scite.SendEditor(SCI_INDICATORCLEARRANGE, 0, editor.Length)
        self.bMarkersActive = false
    end
end

function MyTools:markOccurrences(selText)
    self:clearOccurrences()
    -- set flag markers are active
    self.bMarkersActive = true
    -- set indicator style
    local curIndic = 0
    scite.SendEditor(SCI_SETINDICATORCURRENT, curIndic)
    scite.SendEditor(SCI_INDICSETALPHA, curIndic, 255)
    scite.SendEditor(SCI_INDICSETUNDER, curIndic, true)
    scite.SendEditor(SCI_INDICSETSTYLE, curIndic, INDIC_ROUNDBOX)
    scite.SendEditor(SCI_INDICSETFORE, curIndic, 0xFFF55D)
    -- set search flags
    --local flags = SCFIND_WHOLEWORD
    local flags = 0
    -- find each occurrence of the word and set the indicator range
    local s,e = editor:findtext(selText, flags, 0)
    while s do
        scite.SendEditor(SCI_INDICATORFILLRANGE, s, e - s)
        s,e = editor:findtext(selText, flags, e+1)
    end
end

Mine is inside of the SciTE folder for now. I'll move it soon.

Edited by LaCastiglione
Link to comment
Share on other sites

As an aside, hope this is the right thread for this.

I found InsertRegion in AutoItTools.lua. Any reason why it isn't set to be used? It seems to work fine for me.

Link to comment
Share on other sites

  • Developers

Sorry for the question, but is there already an installer for the Scite_beta or do I manually have to download the files from here : http://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/SciTE-3.03/

I would like to test a little bit, too :-)

On the first post the dll link isn't working, but I can download the standalone Scite.exe.

Yes, just replace the 2 files. I have fixed the url for scilexer.dll.

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.
  :)

Link to comment
Share on other sites

Yes, just replace the 2 files. I have fixed the url for scilexer.dll.

Jos

Thanks, I updated my Scite, the dll, the Wrapper and the SciteGlobal.properties.

Now, hopefully magic happens :-)

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

  • Developers

Also update the au3check.exe to allow for the inline errors to display the proper colors. :)

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.
  :)

Link to comment
Share on other sites

I did! Thanks again.

Nothing special belonging to the new Scite version, but I just noticed that stream and box comments are not really working.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi. Earlier I hacked around with some lua (neat-o!) and I came up with some extra options for styling the calltip window. This isn't something that no one else could have done.

Add these to your SciTEUser.Properties

## CallTips
# Display the calltip above the function
calltips.set.above=1
# Set the fore and back color of the calltip window
style.au3.38=fore:#DADADA,back:#15191E
# Set the highlight color of the function argument
calltips.color.highlight=#5C81B3

Add this to your lua file. (Look to wraithdu's post here: )

myCallTips = EventClass:new(Common)

function myCallTips:OnOpen(path)
    self.error = "Error"
    myCallTips:set_above()
    myCallTips:set_highlight_color()
    return true
end

-- set_above()
-- Displays the calltip above the function.
function myCallTips:set_above()
    local calltips_set_above = tonumber(props["calltips.set.above"])

    if (calltips_set_above == 1) then
        scite.SendEditor(SCI_CALLTIPSETPOSITION, true)
    else
        scite.SendEditor(SCI_CALLTIPSETPOSITION, false)
    end

    return true
end

-- set_highlight_color()
-- Set the color of the highlighted calltip property
function myCallTips:set_highlight_color()
    local calltips_color_highlight = props["calltips.color.highlight"]

    if (calltips_color_highlight == '') then
        calltips_color_highlight = "#FF0000" -- dark blue default
    end

    calltips_color_highlight = myCallTips:BGR2Decimal(calltips_color_highlight)

    if (calltips_color_highlight == self.error) then
        return false
    end

    scite.SendEditor(SCI_CALLTIPSETFOREHLT, calltips_color_highlight)

    return true
end

-- BGR2Decimal()
-- convert BGR to decimal, duh! (albeit in a hack and stab manner)
function myCallTips:BGR2Decimal(BGR)
    if (BGR.len(BGR) ~= 7) then
        return self.error
    end

    BGR = BGR:gsub('#', '') -- remove hash
    BGR = BGR.reverse(BGR)
    BGR = "0x"..BGR

    return tonumber(BGR)
end
Edited by LaCastiglione
Link to comment
Share on other sites

The red color is... too red! and i dont like the fact that it's above the function.

Anyway, it's just a question of tasts!

Nice example, anyway, too.

These let you change that:
## CallTips
# Display the calltip above the function
calltips.set.above=1
# Set the fore and back color of the calltip window
style.au3.38=fore:#DADADA,back:#15191E
# Set the highlight color of the function argument
calltips.color.highlight=#5C81B3
Link to comment
Share on other sites

  • Developers

Nothing special belonging to the new Scite version, but I just noticed that stream and box comments are not really working.

could explain what you mean with this? What exactly do you do and result do you see?

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.
  :)

Link to comment
Share on other sites

  • Developers

Speaking of bugs, did you see my report in Post #51 about bookmarks?

Seen your remark and hope I find all the remark/issues/suggestions back when i return home. :)

Did you check if this is a change in the SciTE version from Neil or just my version?

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.
  :)

Link to comment
Share on other sites

  • Developers

I'm really digging the inline errors :) I found a bug though. I can no longer click in the gray area just to the right of the line numbers (where the mouse cursor changes to a mirrored version) to insert a bookmark. It just highlights the line now and moves the cursor to the next line. Maybe this is an option now? Ctrl-F2 still works to insert bookmarks though.

Are you sure this worked before? I just tried it in SciTE 2.28 released in the latest installer and the mouse doesn't mirror and bookmarks clicks don't do anything.

Researching this in Google only gave me a hit for Notepad++ till now.

Was this working for you in the 2.28 version included in the latest installer?

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.
  :)

Link to comment
Share on other sites

  • Developers

I just have one question. Now I just need to figure out how to get the IDM_NEXTMSG to stick. With output.scroll=1 the IDM_NEXTMSG happens before the last line of output (The exit code as returned by the wrapper script) so SciTE re-scrolls to the end. I think it would be better if it was left on the first error because that is also where the editor has jumped to. Not a big deal but the current behavior feels a bit wrong to me.

This is easy to implement when doing it the following way:

I Added a Commandline option to AutoIt3Wrapper:

Case $T_Var = "/Jump2FirstError"
   ; when AutoIt3Wrapper is launched for "Jump2FirstError" then wait till the original AutoIt3Wrapper is ended and after send "Next Message(F4)" command
   $H_Cmp = $CMDLINE[$x + 1]
   While ProcessExists($H_Cmp)
    Sleep(100)
   WEnd
   Sleep(200)
   SendSciTE_Command($My_Hwnd, $SciTE_hwnd, "menucommand:306") ; IDM_NEXTMSG
   Exit

And use the following code after au3check completion which will shell an additional instances of the script that waits for the completion of the initial version and then send the "Next Message(F4)" command:

If $ExitCode Then
    Run(@ScriptFullPath & " /Jump2FirstError " & @AutoItPID)
   Else
    SendSciTE_Command($My_Hwnd, $SciTE_hwnd, "extender:dostring scite.SendEditor(SCI_ANNOTATIONCLEARALL)")
   EndIf

Uploaded a updated version (2.1.0.12) of AutoIt3Wrapper that contains these changes.

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.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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