TheArkive / scintilla_ahk2

Scintilla class wrapper for AHK v2
MIT License
8 stars 6 forks source link

Using 2 scintilla controls #5

Open dmtr99 opened 2 years ago

dmtr99 commented 2 years ago

When using 2 scintilla controls, only the last defined seems to be updating.

dmtr99 commented 2 years ago

I tried this in this example, but even the second edit field is not displaying the colours correctly. https://github.com/mmikeww/AHK-v2-script-converter/blob/master/QuickConvertorV2_scintilla.ahk

TheArkive commented 2 years ago

Yah this aspect of scintilla is a little more tricky. And you have to decide if you are trying to look at 2 different files or the same file twice.

I know how to do this, but I'm not focused on making it happen in the example yet. I'm still focusing on ways to map out the document so that more than just syntax highlighting can happen. I want to also record user functions, classes, etc, and make auto complete + call tips happen as well.

But eventually I will expand the example to be able to do this.

TheArkive commented 2 years ago

On 2nd thought, I'll bump this up in my priority list. It shouldn't be too hard.

TheArkive commented 2 years ago

I tried running the script you linked to (by following the readme USAGE instructions) and I get a duplicate declaration error message for the _SendMessage function.

I submitted an issue on the repo.

As for "properly" coloring stuff. There are many different events to handle with scintilla, and if you are replacing entire ranges of text that may be "confusing" my poorly written DLL. I believe replacing one line at a time may function better than replacing multiple lines at a time.

EDIT:

My private copy of this repo is far ahead currently, but stalled due to me trying to work out some fairly complex settings. My private copy attempts to handle syntax coloring, language semantics, and mapping out user functions / classes in a single pass. I'm also trying to setup a system that is "plugin-like" so that a module that handles these things can be written for each "language" used by the editor.

Also, I'm also trying to decide which parts to keep as part of this lib, and which parts to split up into a separate lib.

dmtr99 commented 2 years ago

The _Sendmessage error should be fixed now.

If I find the time, I will try to start experimenting on the best method to set the text one line at a time, if I find a reliable way, maybe we can add it to the library. In most of my scripts the text can become quite long.

Another question: is it possible to make the coloring only happen when certain conitions are met (like a "." before the string or a "(" afther the string)?

Great usefull work!

TheArkive commented 2 years ago

Glad you like this lib 😃 ... yes it is possible, but that is actually more difficult than it sounds.

My previous comment talks about the future plans for this repo, and I'll explain a bit more below.

Basically, yes it is possible, but how to "map out" the language so that each element can be efficiently identified is what I am working on now. It's not exactly easy I'm afraid.

If you have ideas let me know. At some point I'll finally update this repo with syntax coloring that doesn't use the DLL.

EDIT:

I think I will try to separate the syntax highlighting from the actual scintilla lib. I've been struggling with this for a while, trying to figure out where exactly to draw the line for which parts. And thus determine what belongs in a separate repo.