Jump to content
Enyby

SciTE4AutoIt3 bug: eat all empty line before debug/trace on remove it

Recommended Posts

Enyby

I checked this on latest stable SciTE4AutoIt3, and on latest beta. Issue present in both versions.

Part of code before add Trace lines:

EndFunc   ;==>_readAll

Func _readSettings($name, $default)
    $ret = IniRead($IniUser, "Settings", $name, '')
    If $ret == '' Then $ret = IniRead($IniFile, "Settings", $name, $default)
    Return $ret
EndFunc   ;==>_readSettings

Func _checkNewVersion()

Same part of code after remove trace lines:

EndFunc   ;==>_readAll
Func _readSettings($name, $default)
    $ret = IniRead($IniUser, "Settings", $name, '')
    If $ret == '' Then $ret = IniRead($IniFile, "Settings", $name, $default)
    Return $ret
EndFunc   ;==>_readSettings
Func _checkNewVersion()

As you see, empty lines is gone.

Same issue if you try add Debug line after empty line. On remove it eat all empty lines before it.

 

Source of bug - bad patterns in AutoItTools.lua. For example:

function AutoItTools:TracePattern(with_comment)
    local nl = self:NewLineInUse()
    if with_comment then
        return nl .. "[%s]*;[%s]*(ConsoleWrite%([^" .. nl .. "]-%) ;### Trace Console[^" .. nl .. "]?)"
    else
        return nl .. "[%s]*(ConsoleWrite%([^" .. nl .. "]-%) ;### Trace Console[^" .. nl .. "]?)"
    end
end -- TracePattern()

As you see used "[%s]*" - it is mistake because new line chars also fit to this pattern. It must be "[ \t]*"

So fixed code must be:

function AutoItTools:TracePattern(with_comment)
    local nl = self:NewLineInUse()
    if with_comment then
        return nl .. "[ \t]*;[ \t]*(ConsoleWrite%([^" .. nl .. "]-%) ;### Trace Console[^" .. nl .. "]?)"
    else
        return nl .. "[ \t]*(ConsoleWrite%([^" .. nl .. "]-%) ;### Trace Console[^" .. nl .. "]?)"
    end
end -- TracePattern()

 

Need fix this in all places:

  • AutoItTools:ConsoleWritePattern
  • AutoItTools:MsgBoxPattern
  • AutoItTools:FunctionTracePattern
  • AutoItTools:TracePattern

 

Also last two look like duplicate of same or similar code.

Currently used last variant.

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

×