Jump to content

Bug in SciTE


Nutster
 Share

Recommended Posts

  • Developers

emmanuel is right .....

I am looking at it to so why is doesn't work when you just have the opening (Double) quote.

It does work when inside "...."

More later..

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 have no clue. It works perfect for me. However, I have mine in SciTEStartup.lua. I don't know if that matters or not. I have no problems what-so-ever with the function. I see no reason not to put it in the startup script since I added in the line to make sure the AutoIt lexer is the active lexer. Since it's a callback function, this could be the problem. It's worth trying at least.

Link to comment
Share on other sites

I spoke (wrote) without FULLY testing things. If I type on an existing line, the code works. When I am typing on a new line at the bottom of the file, it does not work, that is the AuotComplete box still appears. I wonder if that help tracking down the bug. The line is coloured green, so it knows the style, but is not responding for the new line. The style is 1 or 7 on an existing line but 0 for a new line. I wonder if we have to look in another property for a new line.

Hmm, all I actually have to do is just save the .LUA file to get SciTE to recognise it.

Edited by Nutster

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Link to comment
Share on other sites

  • Developers

Valik, the issue is that when the cursor is at the last character of the line it sees a 0 as the Style.. so it should look for the style of the previous character

add this to the script to demo what i mean:

function OnChar(a)
   ls = editor.StyleAt[editor.CurrentPos]
   _ALERT(ls .. '|' .. editor.CurrentPos )

You will see it returns a 7 inside a string and a 0 at the end..

I tried it both in the SciTEStartup.lua and the autoit3.lua... works the same..

Puzzling at this moment how we can tell itr to check the previous position...

ls = editor.StyleAt[editor.CurrentPos-1] .. doesn't work at all...

Edited by JdeB

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

THAT's good information David, thank you. JdeB is correct in his assesment.

JdeB... what about CurrentPos-2? I just tried it and it _appeared_ to work correctly.

Edit:

function OnChar(c)
    -- At this time, AutoIt's lexer is 60, this is unlikely to change.
    if editor.Lexer ~= 60 then return false end
    ls = editor.StyleAt[editor.CurrentPos]
    prev = editor.StyleAt[editor.CurrentPos-2]
    if ls == SCE_AU3_COMMENTBLOCK or ls == SCE_AU3_COMMENT or ls == SCE_AU3_STRING or
        prev == SCE_AU3_COMMENTBLOCK or prev == SCE_AU3_COMMENT or prev == SCE_AU3_STRING then
        if editor:AutoCActive()  then 
            editor:AutoCCancel()     
        end
        return true    -- The key is here, this says don't process any more.
    end
end

That code works.

Edited by Valik
Link to comment
Share on other sites

  • Developers

Yeap the ls = editor.StyleAt[editor.CurrentPos-2] works fine..

I just had this version working but like your solution a lot better..

function OnChar(a)
   editor:CharLeft()
   editor:CharLeft()
   ls = editor.StyleAt[editor.CurrentPos]
   editor:CharRight()
   editor:CharRight()
   if ls == SCE_AU3_COMMENTBLOCK or ls == SCE_AU3_COMMENT or ls == SCE_AU3_STRING then
      if editor:AutoCActive()  then 
          editor:AutoCCancel()     
      end
      return true    -- The key is here, this says don't process any more.
   end
   return false
end

EDIT: Uploaded the modified http://www.autoitscript.com/fileman/users/jdeb/autoit3.lua

Edited by JdeB

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

Not really a bug, but I can't figure out how to change this behavior:

When you do a random cntrl+shift+d without being next to a variable you get;

MsgBox(4096,'debug:' , '



:' & 



);### Debug MSGBOX

I have the newest autoit3.lua file and the offending line looks like so:

editor:AddText("MsgBox(4096,'debug:' , \'" .. word .. "\:' & " .. word .. ") ;### Debug MSGBOX \n" )

Is there anyway to keep the same functionality that it has when you place the cursor next to the variable (nice help file, I learned that in there :( ) and just enhance it so that you can place a message box anywhere?

Sometimes, ok a lot of times, I place random msgboxs around in my scripts to see what part of a specific loop or for statement I'm not getting to or what have you.

Just curious. I was trying to mess around with it myself but I didn't investigate too deep into the whole lua stuff. :ph34r:

Raoul S. Duke: Few people understand the psychology of dealing with a highway traffic cop. Your normal speeder will panic and immediately pull over to the side. This is wrong. It arouses contempt in the cop-heart. Make the bastard chase you. He will follow.
Link to comment
Share on other sites

seriously, maybe you guys need to post something at the

scite-interest site about this and see what they say :

http://mailman.lyra.org/mailman/listinfo/scite-interest

Or we can just bug you until you fix the problem. :(:lol:

:ph34r: Keep up the good work! Maybe I'll look at Lua one of these days

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Or we can just bug you until you fix the problem.  :(  :lol:

:ph34r:  Keep up the good work!  Maybe I'll look at Lua one of these days

It's not often I'll do a "fix" like this. JdeB would of figured it out; I think he was on the same track as I was, I just figured out a quirk of Lua quicker. However, the only reason productivity won out over laziness was because I grew annoyed with it, too. Most of the time, laziness wins.
Link to comment
Share on other sites

  • Developers

Not really a bug, but I can't figure out how to change this behavior:

Just curious.  I was trying to mess around with it myself but I didn't investigate too deep into the whole lua stuff.  :ph34r:

Changed this function that it will now work as follows:

- if text is selected then put that in the Debug msgbox.

- if no text is selected then select "Current Word" and strip the \n \r and spaces from it.

- if the lenght of the selected text is zero then display msg in output pane and don't put in the msgbox.

Uploaded it again.... :(

--++++++++++++++++++++++++++++++++++++++++++++++++++ 
-- Add debug msgbox...
-- shortcut Ctrl+Shift+D Create MsgBox(4096,'debug',...)
function Debug_MsgBox() 
   word = editor:GetSelText()
   if string.len (word) == 0 then           -- If no text is Selected yet then select current word.
      from = editor:WordStartPosition(editor.CurrentPos)   
      to = editor:WordEndPosition(editor.CurrentPos)
      word = editor:textrange(from, to)     
      word = string.gsub(word, "\n", "")    -- strip newline characters
      word = string.gsub(word, "\r", "")    -- strip carriage return  characters
      word = string.gsub(word, " ", "")     -- strip spaces  characters
   end
   if string.len (word) == 0 then 
      _ALERT("Cursor not on any text.")
      return 
   end
   word2 = string.gsub(word, "'", "''")     -- replace quote by 2 quotes
   editor:Home()
   editor:LineDown()
   editor:AddText("MsgBox(4096,'debug:' , \'" .. word2 .. "\:' & " .. word .. ");### Debug MSGBOX \n" )
   _ALERT("inserted debug msgbox.")
end
Edited by JdeB

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 think I might have found a different "bug"....

Type--do not cut and paste--the following into a new AutoIt file:

MsgBox("'flag',", "'title',"

It appears that the nested quoting containing commas throws off the intellisense....

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

  • Developers

I think I might have found a different "bug"....

Type--do not cut and paste--the following into a new AutoIt file:

MsgBox("'flag',", "'title',"

It appears that the nested quoting containing commas throws off the intellisense....

You are really going to win the Master Nitpick tropy this year ! :(:lol::lol:

As mentioned :ph34r:

seriously, maybe you guys need to post something at the

scite-interest site about this and see what they say :

http://mailman.lyra.org/mailman/listinfo/scite-interest 

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 think the following code would be better:

-- Disable Autocomplete in comments lines/blocks by Valik..
function OnChar(a)
   ls = editor.StyleAt[editor.CurrentPos] -- check current character
   if ls == 0 then
      ls = editor.StyleAt[editor.CurrentPos-2] -- check previous character
   endi
   if ls == SCE_AU3_COMMENTBLOCK or ls == SCE_AU3_COMMENT or ls == SCE_AU3_STRING then
      if editor:AutoCActive()  then 
          editor:AutoCCancel()     
      end
      return true    -- The key is here, this says don't process any more.
   end
   return false
end

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Link to comment
Share on other sites

  • Developers

I think the following code would be better:

-- Disable Autocomplete in comments lines/blocks by Valik..
function OnChar(a)
   ls = editor.StyleAt[editor.CurrentPos] -- check current character
   if ls == 0 then
      ls = editor.StyleAt[editor.CurrentPos-2] -- check previous character
   endi
   if ls == SCE_AU3_COMMENTBLOCK or ls == SCE_AU3_COMMENT or ls == SCE_AU3_STRING then
      if editor:AutoCActive()  then 
          editor:AutoCCancel()     
      end
      return true    -- The key is here, this says don't process any more.
   end
   return false
end
Did you find an issue with the other code ?

p.s. you have a typo in the code : endi

Edited by JdeB

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

Oops that should be end

I thought the problem with the old code would happen at the beginning of the file. Current position -2 would give a negative, which is invalid. But my testing has shown that it still works.

This is what I have working in my AutoIt3.LUA

-- Disable Autocomplete in comments lines/blocks by Valik.
function OnChar(a)
  ls = editor.StyleAt[editor.CurrentPos-2] -- check current character
  if ls == SCE_AU3_COMMENTBLOCK or ls == SCE_AU3_COMMENT or ls == SCE_AU3_STRING then
     if editor:AutoCActive()  then
         editor:AutoCCancel()    
     end
     return true    -- The key is here, this says don't process any more.
  end
  return false
end
Edited by Nutster

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Link to comment
Share on other sites

  • Developers

Oops that should be end

I thought the problem with the old code would happen at the beginning of the file.  Current position -2 would give a negative, which is invalid.  But my testing has shown that it still works.

This is in the to-be-released version. I added a rt variable to have the possibility to add other functions/logic to the onchar() event before doing the return:

function OnChar(a)
   rt = false
   -- Disable Autocomplete in comments lines/blocks by Valik..
   ls = editor.StyleAt[editor.CurrentPos-2]
   if ls == SCE_AU3_COMMENTBLOCK or ls == SCE_AU3_COMMENT or ls == SCE_AU3_STRING then
      if editor:AutoCActive()  then 
          editor:AutoCCancel()     
      end
      rt = true   -- The key is here, this says don't process any more.
   end
   -- Return    
   return rt
end

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 wonder where the person who wrote Lua is from

Lua is also an ancient hawaiian martial art

Rick

From the LUA site:

Lua is designed and implemented by a team at Tecgraf, the Computer Graphics Technology Group of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro in Brazil).

Lua means moon in Portuguese and is pronounced LOO-ah

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

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
 Share

  • Recently Browsing   0 members

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