Announcement

Collapse
No announcement yet.

MemoryEx String

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MemoryEx String

    I have a document buffer not created by MemoryEx and I can get a specific character with:

    Code:
    local Char = MemoryEx.String(Buffer,Char_At_Pos,MEMEX_ASCII)
    but how do I get a range of characters from the buffer giving a start and end point so I have a character string to parse?

  • #2
    Buffer is a zero based pointer, so the first character is at buffer+0, the second character is at buffer+1 and so forth.

    Code:
    local string = MemoryEx.String(Buffer + 10, 20, MEMEX_ASCII);
    Get's the string starting at the 11th character with a length of 20.
    Bas Groothedde
    Imagine Programming :: Blog

    AMS8 Plugins
    IMXLH Compiler

    Comment


    • #3
      Cheers Bas :yes

      Comment


      • #4
        Actually Bas I cant get just a single character properly, could you have a look? Its in the style function, just paste everything to a blank project on show event with MemoryEx and the Scintilla.dll in cdroot and it will show you what I mean when you type some stuff in the Scintilla window:



        Excuse the code link but for reasons unknown one cant attach a Lua script.

        Comment


        • #5
          Doens't SCI_GETCHARAT actually return the character itself, and not a pointer to it? So it wouldn't return a Char_Buffer, but a Char.
          Bas Groothedde
          Imagine Programming :: Blog

          AMS8 Plugins
          IMXLH Compiler

          Comment


          • #6
            That's what I thought at first but some deep goggling reveled its a pointer to the character in the buffer returned from SCI_GETCHARACTERPOINTER and also SCN_STYLENEEDED reads in the docs like it styles only whole lines but it doesn't it can style all or some of the document so in my SCN_STYLENEEDED I have it set to only style a line at a time.

            Comment


            • #7
              What precisely are you trying to achieve though? Why aren't you using a lexer for styling?
              Bas Groothedde
              Imagine Programming :: Blog

              AMS8 Plugins
              IMXLH Compiler

              Comment


              • #8
                Well I was just trying to lex in the container because I know Lua and AMS is already in a Lua state.

                Just tried the return value from SCI_GETCHARAT and its giving a ASCII character code and thats fine as I can work with that but if you try to lex in the container you'll note it works just fine when typing but whenever text is set programmatically or through cut/copy/paste things stop working.....................

                Comment


                • #9
                  Originally posted by Shrek View Post
                  Well I was just trying to lex in the container because I know Lua and AMS is already in a Lua state.
                  This doesn't matter though right? The Lua state has no business with lexing If you use a scintilla lexer, much faster code will be called. What will you be highlighting? Lua code?
                  Bas Groothedde
                  Imagine Programming :: Blog

                  AMS8 Plugins
                  IMXLH Compiler

                  Comment


                  • #10
                    I just found one of your old posts here:



                    now I know the lexers aren't defined with colors and keywords Ive used Pearl as that deals with the folding how I need it and the comments how I need it, thank for the help :yes

                    Comment


                    • #11
                      Originally posted by Shrek View Post
                      I just found one of your old posts here:



                      now I know the lexers aren't defined with colors and keywords Ive used Pearl as that deals with the folding how I need it and the comments how I need it, thank for the help :yes
                      Glad I could be the second perspective hehe :yes
                      Bas Groothedde
                      Imagine Programming :: Blog

                      AMS8 Plugins
                      IMXLH Compiler

                      Comment

                      Working...
                      X