Noob question, how to tweak the Scintilla editor and recreate the dll

  • Zook

    Zook - 2013-01-06

    Just installed Notepad++ tonight, finally got tired of coding in Notepad. The behavior of the cursor when I move up and down, where it stores the x position and puts it back when you get to a line of sufficient length, just hurts my brain. If I press the up button and it can go directly up, I don't want it going up and jumping right. So, a few hours later, now I know what Scintilla is, downloaded the source code, and I'm hoping I can fix it really easily like so (in Editor.cxx):

    void Editor::SetLastXChosen() {
        Point pt = PointMainCaret();
        lastXChosen = pt.x + xOffset;


    void Editor::SetLastXChosen() {
        Point pt = PointMainCaret();
        lastXChosen = pt.x/* + xOffset*/;

    So, (a) can it really be that easy of a fix, and (b) how do I, um, Make It So? I also just installed Borland C++ Compiler 5.5.

    (I was also about to try to fix the behavior where the Home button doesn't actually go to the beginning of a line, but it turns out those functions already exist, I just had to tweak the shortcuts.)

    Last edit: Zook 2013-01-06
  • Loreia2

    Loreia2 - 2013-01-06

    Hi Zook,

    (a) can it really be that easy of a fix,
    Why wouldn't it be?
     and (b) how do I, um, Make It So? I also just installed Borland C++ Compiler 5.5.
    Officially, Scintilla supports just Visual studio. I can confirm that it compiles nicely in VS 2005, 2008 and 2010. Specific steps?
    As described in scintilla/win32/scintilla.mak, execute this in Visual studio command prompt:
    nmake -f scintilla.mak


  • Don HO

    Don HO - 2013-01-06

    For the sake of Scintilla update facility, the modification of Scintilla source code won't be integrated into trunck of Notepad++ (ie. future release).

    OTOH, you can try to make your modification integrated in Scintilla project, so it will go into Notepad++ future release:


  • Dave Brotherstone

    I can tell you simply removing the functionality won't be accepted into Scintilla - it's a reasonably common expectation. Making it optional (perhaps with a SCI_SETCARETXBEHAVIOUR) would have more chance.


  • Zook

    Zook - 2013-01-06

    Thanks for the help. Yeah my hunch was right, that little comment didn't fix it :( I can't figure out how to fix it, the code keeps referring to things that I can't track down. Submitted a feature request though.

  • Zook

    Zook - 2013-01-06

    Oh my god I did it, it only took me like 12 hours! In the function

    void Editor::CursorUpOrDown(int direction, Selection::selTypes selt) {

    just add the line


    before the closing brace. (Turns out xoffset refers to cursor position on wrapped lines and such, something entirely different.)

  • cchris

    cchris - 2013-01-13

    The problem I could see is when:
    - cursor is on some long line
    - move up to a shorter line. Cursor goes to end of that line. This is the expected behaviour when virtual space is not enabled - it has been requested many times to allow turning it on.
    - move up again, to a longer line again. Then Scintilla doesn't remember current horizontal position, but that you were at end of line, hence the undesired move to right. And the original position on line #1 is not remembered.

    I found that simply pressing End when on the shorter line avoids the extra move right thereafter. But again, turning virtual space on would be much better.