Page MenuHome

Scintilla Implementation for Text Editor
Closed, ArchivedPublic


This is a very WIP patch that implements Scintilla as the back end of the Text Editor. So far ~90% of editing functionality is implemented (loading, saving, undo, syntax highlighting, search/replace, etc). As per Campbell's suggestion, it is implemented as a build option (WITH_BF_SCINTILLA) so that if/when this code is in master, it can be tested and we can always fall back to the default implementation if needed.

There is only Scons support currently and I've only compiled the code with Win64/Mingw. Again this is a WIP, meaning there are many known bugs, comments to myself, printf()s, and can crash Blender. By posting this patch I'm hoping to:

  • Get a general yay/nay on if this seems reasonable to continue implementing
  • Make sure it compiles on other systems
  • Generate interest in development (especially due to my lack of knowledge of DNA, UTF8, opengl, etc)

I'm not looking for a detailed review, just high level suggestions/opinions. There is still a lot to do to get it completely functional and up to the same level as the current code.



Related Objects

Event Timeline

Justin Dailey (dail) set Type to Patch.
Justin Dailey (dail) created this task.
Justin Dailey (dail) raised the priority of this task from to Needs Triage by Developer.

Great to see this patch! - I'll check on it and try get cmake working too.

Brecht Van Lommel (brecht) triaged this task as Normal priority.Dec 6 2013, 2:26 PM

Here is an updated patch. Code for scroll rect calculation/drawing has been moved out of the Scintilla wrapper and reuses the code from text_draw.c, plus a few minor enhancements over the previous patch.

It may be good to have a github repo for this (I can set one up if it helps), so we can develop this more easily.

I had thought about doing that in the past but wasn't for sure the best way to go about it (which unofficial repo to fork, create a new one, etc). If you didn't care to set one up that would be great! If it helps, my username on github is dail8859. Thanks!

Committed scintilla_text_editor_v2.diff and added you as a contributor to the repo.


After checking out the github repo do:

git remote add bf

Adding http means no risk of accidental push to

Then you can update from blenders master easily,
git pull bf master
... and push the changes to github with git push

To create a patch against blenders master at any time:

git diff bf/master > scintilla_text_editor_v3.diff

Thanks! I'll check this out more later today when I get time. One question I do have though...later when this code is integrated into the main bf repo, will we just apply it as a single patch or merge it in saving the commit history? The reason I ask this is because the author name I use for github (dail8859) is different than if I would merge in commits to the bf repo (i.e. my full name so phabricator recognizes it correctly).

Thanks again!

@Justin Dailey (dail) probably as a single patch, it it makes sense perhaps split into ~2-4.

Note, I found an error:

intern/scintilla/SCI_TextEditor.cpp:565 its passing as string as a uptr_t. Did you mean '#'

Also, When I load a python script in with syntax highlighting (Python Simple Panel Template for eg) I get a buffer overrun.

buffer isnt NULL terminated in BKE_text_load_ex but sci_document_set_text expects it to be.

Looks like sci_document_set_text should take a lenth arg and call InsertString instead of InsertCString.

This implementation is interesting as a text, but copying entire buffer and re-evaluating for every redraw.