AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[module] HiEdit 4.0.0.4-5
Goto page Previous  1, 2, 3 ... 7, 8, 9 ... 11, 12, 13  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  

Do you want HiEdit internaly
Yes
52%
 52%  [ 37 ]
No, I like Edit control
28%
 28%  [ 20 ]
Other (please explain)
19%
 19%  [ 14 ]
Total Votes : 71

Author Message
freakkk



Joined: 29 Jul 2005
Posts: 179

PostPosted: Wed Oct 22, 2008 8:49 pm    Post subject: Reply with quote

Drugwash wrote:
Could this be taken care of, someday, please? Thank you.
Go for it dude; its open source. Just make sure to share your results. Thank you Wink
_________________
.o0[ corey ]0o.
Back to top
View user's profile Send private message
Drugwash



Joined: 07 Sep 2008
Posts: 608
Location: Ploiesti, RO

PostPosted: Wed Oct 22, 2008 9:22 pm    Post subject: Reply with quote

Hmmm... usually I don't like playing with someone else's toys, coz I tend to break them. Cool
Now, I'm just a noob at AHK as compared to what I've witnessed around and also got quite a bucketful of projects to bring to life, but if I get a pool of spare time I might take a look at the script, provided it's not the dll's fault (which comes with no sources, at least in the package that's listed on this board). And I might also make it 9x only, since many guys around make their scripts 2000+ only - I'm on 98SE, guys and will die with it!

Scratch that, was just kidding - I'm not that selfish. Wink
Back to top
View user's profile Send private message Yahoo Messenger
jballi



Joined: 01 Oct 2005
Posts: 537
Location: Texas, USA

PostPosted: Fri Oct 31, 2008 6:29 pm    Post subject: Reply with quote

This one has me banging my head...

Synopsis: Possible bug with the HE_GetSelText function. The function does not return the selected text (returns blank) if called from a process that did not create the HiEdit object.

The full story...

I have two scripts. The first script creates a window with a HiEdit object. The second scripts manipulates the HiEdit object using HE_* functions. All of the HE_* functions that I call work fine except for HE_GetSelText function which is supposed to copy selected text to a variable. This function, when called from the 2nd script, always returns a blank value. If I get rid of the 2nd script (put all of the code from the 2nd script into the 1st script), the HE_GetSelText function works as expected.

The "problem" appears to occur at the EM_GETSEL Message although the return code for the message indicates that the correct number of characters has been copied.

Question Anyone have any ideas on how to fix this bug? Question

Thanks for your assistance.

P.S. This phenomenon also occurs with cRichEdit library, action=GetSelText when used on a Rich Edit control. Since the functions are programmatically identical, it makes sense that this function doesn't work either.
Back to top
View user's profile Send private message Send e-mail
majkinetor !
Guest





PostPosted: Fri Oct 31, 2008 7:58 pm    Post subject: Reply with quote

It looks like interprocess limitation. You should re-implement function using RemoteBuffer module and I expect it to work.
Back to top
majkinetor



Joined: 24 May 2006
Posts: 4114
Location: Belgrade

PostPosted: Fri Oct 31, 2008 8:02 pm    Post subject: Reply with quote

And if that for some reason doesn't work (which I doubt) you can easily use IPC module to request data from the script from another script.
_________________
Back to top
View user's profile Send private message
jballi



Joined: 01 Oct 2005
Posts: 537
Location: Texas, USA

PostPosted: Sat Nov 01, 2008 12:21 pm    Post subject: Reply with quote

majkinetor wrote:
It looks like interprocess limitation. You should re-implement function using RemoteBuffer module and I expect it to work.

An "interprocess limitation" appears to be the case. For this message, the control does not want to access memory outside it's own process. I was able to get the message to work using the "Remote Buffer" library. In a nutshell, the code to collect the selected text using the EM_GETSELTEXT message looks something like the following :

Code:
SelectedTextSize:=EndSelectPosition-StartSelectPosition+1
    ;-- Size needs to be length of selected text plus 1.  Extra byte is
    ;   used to store terminating null character.

bufID:=RemoteBuf_Open(hWnd_Of_Remote_Window,SelectedTextSize)

SendMessage
    ,EM_GETSELTEXT                          ;-- EM_GETSELTEXT=0x43E
    ,0
    ,RemoteBuf_Get(bufID,"adr")             ;-- Address of remote buffer
    ,%Control%
    ,%WinTitle%


VarSetCapacity(SelectedText,SelectedTextSize)
RemoteBuf_Read(bufID,SelectedText,SelectedTextSize)

RemoteBuf_Close(bufID)

Thanks for providing the "Remote Buffer" library. It was definitely what was needed to solve this problem. I found a few small bugs/issues with the library but I'll post 'em in the "Remote Buffer" post so as not to clutter up this post any more.

Thanks for pointing me in the right direction.
Back to top
View user's profile Send private message Send e-mail
majkinetor



Joined: 24 May 2006
Posts: 4114
Location: Belgrade

PostPosted: Mon Nov 03, 2008 2:29 pm    Post subject: Reply with quote

You are welcome.
_________________
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4114
Location: Belgrade

PostPosted: Mon Nov 10, 2008 12:25 pm    Post subject: Reply with quote

Version 3.0.0.4-1


  • Control updated to latest version 3.0.0.4
  • Added jballi's API function: Scroll, Get/SetModfy, EmptyUndoBuffer, LineScroll
  • Bug fixes: If line contained only 1 character GetLine was returning empty string. GetTextLength typo fixed. Other reported bugs not confirmed.
  • Hes file AHK syntax updated. I used ahk section from QuickAHK project.
  • Documentation updated. There is aslo a new section about syntax highlighting.

_________________
Back to top
View user's profile Send private message
pokercurious



Joined: 16 Dec 2007
Posts: 48

PostPosted: Mon Nov 10, 2008 10:59 pm    Post subject: Reply with quote

I really like the HiEdit control and find myself using it quite a bit.

One thing is that I like to have a black background and light text: the problem with this is that I can't seem to get the backticks (`) to display in any color other than black.

For example, run the _Test.ahk script in majkinetor's release (it uses a black background) - you can see backticks when they're selected in text, but not otherwise.

The delimiters section of keywords.hes is currently:

Code:
;>>>>> Delimiters <<<<<
0x01FFFFFF = ( ) < > { } , % " = : + - * / ^ ! # ~ `;


I've tried adding a space in between the ` and the ;. Doesn't work.

I've also tried, pulling the ` out into its own section:

Code:
;>>>>> Delimiters <<<<<
0x01FFFFFF = ( ) < > { } , % " = : + - * / ^ ! # ~
0x01FFFF00 = `


Does anybody have any ideas here? This control is so almost perfect for me now, I'd like it to go the final mile.
Back to top
View user's profile Send private message
jballi



Joined: 01 Oct 2005
Posts: 537
Location: Texas, USA

PostPosted: Tue Nov 11, 2008 2:43 am    Post subject: Reply with quote

Thanks for the update. Cool
Back to top
View user's profile Send private message Send e-mail
BIG_RED_TEXT



Joined: 12 Jan 2008
Posts: 130

PostPosted: Tue Nov 11, 2008 4:02 am    Post subject: Reply with quote

hey! nice work... I only took a quick look in the documentation, and couldn't find a function that could retrieve the word that is currently marked (or under the typing cursor)...
This is usefull when you want to search for marked words. As in SCiTE you push F1 and it goes to AHK's help manual and takes you to the page explaining the marked word...
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4114
Location: Belgrade

PostPosted: Tue Nov 11, 2008 11:06 am    Post subject: Reply with quote

2pokercurious
I noticed this long time ago, but I don't know why is it happening. I think I reported it back then as a bug to akyprian, but the problem is that behavior doesn't happen with HiEditor or HiEditDemo....

If that troubles you so much, perhaps you should try to reproduce the problem in above tools. I didn't find a problem so far, but it might also be a bug in wrapper, although its hard to imagine how 1 character can misbehave like that...

2Ice_Tea
Currently there is no such API. You can get selection only. Its easy to make a function tho. This one has hardcoded delimiters, but you can eventually read them from appropriate section in hes file:

Code:
HE_GetCurrentWord(hEdit){
    cpos     := HE_GetSel(hEdit)        ;get cursor position in the entire text
    cline    := HE_GetLine(hEdit)       ;get line
    clineIdx := HE_LineIndex(hEdit)     ;get position of line in the entire text
    pos      := cpos - clineIdx         ;calculate position of cursor in line
    len      := StrLen(cline)   


    ;Find the start and end of the word starting from cursor position
    ;End of the word is ocurance of any delimiter or start/end of the line
    loop, 2
    {
        j := A_Index - 1,   i := j ? len : 1        ;j=0 (search 4 start of the word)  j=1 (search 4 end of the word)

        loop
        {
            p := j ? pos + A_Index : pos - A_Index
            if (j && (p > len)) || (!j && p<=0)
                break

            c := SubStr(cline, p , 1)
            if c in %A_Space%,%A_Tab%,(,),+
            {
                i := p + (j ? -1 : 1)
                break
            }           
        }
        if !j
             iSta := i      ;start of the word
        else iEnd := i      ;end of the word
    }
    return SubStr(cline, iSta, iEnd - iSta + 1)
}

_________________
Back to top
View user's profile Send private message
BIG_RED_TEXT



Joined: 12 Jan 2008
Posts: 130

PostPosted: Tue Nov 11, 2008 1:42 pm    Post subject: Reply with quote

majkinetor wrote:
2Ice_Tea
Currently there is no such API. You can get selection only. Its easy to make a function tho. This one has hardcoded delimiters, but you can eventually read them from appropriate section in hes file:

Code:
HE_GetCurrentWord(hEdit){
    cpos     := HE_GetSel(hEdit)        ;get cursor position in the entire text
    cline    := HE_GetLine(hEdit)       ;get line
    clineIdx := HE_LineIndex(hEdit)     ;get position of line in the entire text
    pos      := cpos - clineIdx         ;calculate position of cursor in line
    len      := StrLen(cline)   


    ;Find the start and end of the word starting from cursor position
    ;End of the word is ocurance of any delimiter or start/end of the line
    loop, 2
    {
        j := A_Index - 1,   i := j ? len : 1        ;j=0 (search 4 start of the word)  j=1 (search 4 end of the word)

        loop
        {
            p := j ? pos + A_Index : pos - A_Index
            if (j && (p > len)) || (!j && p<=0)
                break

            c := SubStr(cline, p , 1)
            if c in %A_Space%,%A_Tab%,(,),+
            {
                i := p + (j ? -1 : 1)
                break
            }           
        }
        if !j
             iSta := i      ;start of the word
        else iEnd := i      ;end of the word
    }
    return SubStr(cline, iSta, iEnd - iSta + 1)
}


Thank you, good sir. I think I'll use this to replace ACC (by Titan)...
Back to top
View user's profile Send private message
pokercurious



Joined: 16 Dec 2007
Posts: 48

PostPosted: Tue Nov 11, 2008 6:36 pm    Post subject: Reply with quote

majkinetor wrote:
2pokercurious
I noticed this long time ago, but I don't know why is it happening. I think I reported it back then as a bug to akyprian, but the problem is that behavior doesn't happen with HiEditor or HiEditDemo....

If that troubles you so much, perhaps you should try to reproduce the problem in above tools. I didn't find a problem so far, but it might also be a bug in wrapper, although its hard to imagine how 1 character can misbehave like that...


I just tried both HiEditor and HiEditDemo, and you're right - both seem to work just fine. This makes it all the weirder.

I'll mess around with it some more - if I stumble across anything interesting, I'll let you know. But generally you're right - it's not that big of a deal for most people. I just got really excited because this got so close to being exactly what I needed.
Back to top
View user's profile Send private message
automaticman



Joined: 27 Oct 2006
Posts: 483

PostPosted: Thu Nov 13, 2008 10:50 pm    Post subject: Reply with quote

Can HiEdit also do syntax highlighting while writing in real-time using regex definitions what to highlight?

For example one could define in a file a list of regexes and after the regex the formatting settings which should be applied then to any real-time pc-keyboard input. Each line could contain such a regex definition with its syntax highlighting parameters.


Example for one such line could be:
Code:
\+\s\s(\w|\s|\d|-|\!|,|\.)*     -->     Courier,14,Bold,TextColor,BackgroundColor


Important is that we should be able to define quite a lot (e.g. 30) of our own regex definitions together with the highlighting settings. If HiEdit can not do this, do you know any other editor which can do this?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 7, 8, 9 ... 11, 12, 13  Next
Page 8 of 13

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group