#126 Expose more Scintilla functionality via (hidden) prefs

closed
None
5
2008-03-09
2008-03-01
No

Scintilla has some cool features that are currently not used in Geany. These are the ones that I'd like to see:

* SCI_SETSCROLLWIDTHTRACKING - Currently, if you load a document with a very long line, you cannot scroll the window far enough to the right to see all of it---you have to put the cursor on the line, and jump to the end. Scintilla doesn't have the ideal behavior (where the scrollbar dynamically adjusts to the width of the currently visible portion of text), but this is a reasonable compromise.

* SCI_SETSELALPHA, SCI_SETCARETLINEBACKALPHA - The alpha-coloring options for the selection and caret lines are too good to ignore. I never liked how the background colors of my highlighting styles would disappear in either of these contexts; the effect was jarring, and partly defeated the purpose of highlighting (large selections were effectively turned into plain text).

* SCI_SETCARETSTYLE: I prefer a block cursor instead of a line. (This would be a good candidate for a non-hidden pref, IMO)

* SCI_SETWRAPVISUALFLAGS, SCI_SETWRAPVISUALFLAGSLOCATION - It's useful to be able to tweak these. I like to have indicators both at the end of the current sub-line, and at the beginning of the next one.

Attached is a patch that partly implements these changes. There are some issues that need to be addressed, however:

* I made use of the foreground color of current_line to store the alpha value; however, because get_keyfile_hex() cannot interpret numbers that don't represent a color, the value has to be pulled using a separate get_keyfile_int() call.

* The argument to SCI_SETSELALPHA is hard-coded because, quite simply, I don't know where to store the value. Should there be a GCS_SELECTION_ALPHA? This way of storing non-color styling arguments is *such* a hack....

Discussion

  • Patch against Geany SVN

     
    Attachments
  • Enrico Tröger
    Enrico Tröger
    2008-03-07

    • assigned_to: nobody --> eht16
     
  • Enrico Tröger
    Enrico Tröger
    2008-03-07

    Logged In: YES
    user_id=1117045
    Originator: NO

    Is there any reason why SCI_SETSCROLLWIDTHTRACKING should not be enabled at all? Maybe performance problems? I couldn't find anything in the Scintilla docs.

    I added a flag to caret-style in filetypes.common to enable block caret.

    SCI_SETWRAPVISUALFLAGS*: added to filetypes.common. I also added a style to change the indentation for wrapped lines.

    SCI_SETSELALPHA, SCI_SETCARETLINEBACKALPHA: Added style translucency to set translucency for the current line and the selection.

    > This way of storing non-color styling arguments is *such* a hack....
    yes ;-). This has to be re-written some time.

    Thanks for the suggestions.

     
  • Logged In: YES
    user_id=18383
    Originator: YES

    I'm pretty sure SCI_SETSCROLLWIDTHTRACKING doesn't have any performance issues in itself (as opposed to the aforementioned "ideal behavior," which is not implemented for this reason).

    The only downside to it (that I can see) is that the scrollbar only ever gets wider, not narrower. So if you have a large document that has only one long line, that could be a bit annoying. But I think it's reasonable to argue that having this quirk is better than adding yet another obscure hidden pref.

     
  • Enrico Tröger
    Enrico Tröger
    2008-03-09

    Logged In: YES
    user_id=1117045
    Originator: NO

    > The only downside to it (that I can see) is that the scrollbar only ever gets wider, not narrower. So if you have a large document that has only one long line, that could be a bit annoying. But I think it's reasonable to argue that having this quirk is better than adding yet another obscure hidden pref.

    I completely agree and so added to SVN.

     
  • Enrico Tröger
    Enrico Tröger
    2008-03-09

    • status: open --> closed