Scinterm API Documentation
A curses platform for Scintilla that supports curses platforms like ncurses.
Functions defined by Scinterm
SCI_COLOR_PAIR
(f, b)
[Macro] Returns the curses COLOR_PAIR
for the given curses foreground and background COLOR
s.
This is used simply to enumerate every possible color combination.
Parameters:
f
: (int
) The curses foregroundCOLOR
.b
: (int
) The curses backgroundCOLOR
.
Return:
int
number for defining a cursesCOLOR_PAIR
.
scintilla_delete
(sci)
Deletes the given Scintilla window.
Parameters:
sci
: The Scintilla window returned byscintilla_new()
.
Return:
void
scintilla_get_clipboard
(sci, len)
Returns a null-terminated copy of the text on Scintilla’s internal clipboard (not the primary
and/or secondary X selections) and stores its length in len.
The caller is responsible for free
ing the returned text.
Keep in mind clipboard text may contain null bytes.
Parameters:
sci
: The Scintilla window returned byscintilla_new()
.len
: (int *
) The length of the returned text.
Return:
char *
clipboard text (caller is responsible forfree
ing it)
scintilla_get_window
(sci)
Returns the curses WINDOW
associated with the given Scintilla window.
Parameters:
sci
: The Scintilla window returned byscintilla_new()
.
Return:
- curses
WINDOW
.
scintilla_new
(callback, userdata)
Creates a new Scintilla curses window.
Parameters:
callback
: SCNotification callback function of the form:void callback(Scintilla *, int, void *, void *)
.userdata
: (void *
) Userdata to pass to callback.
Return:
Scintilla *
scintilla_noutrefresh
(sci)
Refreshes the Scintilla window on the virtual screen.
This should be done along with the normal curses noutrefresh()
.
Note: the terminal cursor may be hidden if Scintilla thinks this window has focus
(e.g. SCI_SETFOCUS
) and Scintilla’s caret is out of view. If another non-Scintilla window
has the real focus, call curs_set(1)
in order to show the terminal cursor for that window.
Parameters:
sci
: The Scintilla window returned byscintilla_new()
.
scintilla_refresh
(sci)
Refreshes the Scintilla window on the physical screen.
This should be done along with the normal curses refresh()
.
Note: the terminal cursor may be hidden if Scintilla thinks this window has focus
(e.g. SCI_SETFOCUS
) and Scintilla’s caret is out of view. If another non-Scintilla window
has the real focus, call curs_set(1)
in order to show the terminal cursor for that window.
Parameters:
sci
: The Scintilla window returned byscintilla_new()
.
Return:
void
scintilla_send_key
(sci, key, shift, ctrl, alt)
Sends the specified key to the given Scintilla window for processing. If it is not consumed, an SCNotification will be emitted.
Parameters:
sci
: The Scintilla window returned byscintilla_new()
.key
: (int
) The keycode of the key, or, if Scintilla’s code page is UTF-8, the UTF-8 code point of the key.shift
: (bool
) Flag indicating whether or not the shift modifier key is pressed.ctrl
: (bool
) Flag indicating whether or not the control modifier key is pressed.alt
: (bool
) Flag indicating whether or not the alt modifier key is pressed.
Return:
void
scintilla_send_message
(sci, iMessage, wParam, lParam)
Sends the given message with parameters to the given Scintilla window.
Parameters:
sci
: The Scintilla window returned byscintilla_new()
.iMessage
: (int
) The Scintilla message ID.wParam
: (uptr_t
) The first parameter.lParam
: (sptr_t
) The second parameter.
Return:
sptr_t
scintilla_send_mouse
(sci, event, time, button, y, x, shift, ctrl, alt)
Sends the specified mouse event to the given Scintilla window for processing.
Parameters:
sci
: The Scintilla window returned byscintilla_new()
.event
: (int
) The mouse event (SCM_CLICK
,SCM_DRAG
, orSCM_RELEASE
).time
: (unsigned int
) The time in milliseconds of the mouse event. This is only needed if double and triple clicks need to be detected.button
: (int
) The button number pressed, or0
if none.y
: (int
) The absolute y coordinate of the mouse event.x
: (int
) The absolute x coordinate of the mouse event.shift
: (bool
) Flag indicating whether or not the shift modifier key is pressed.ctrl
: (bool
) Flag indicating whether or not the control modifier key is pressed.alt
: (bool
) Flag indicating whether or not the alt modifier key is pressed.
Return:
bool
whether or not Scintilla handled the mouse event.
scintilla_update_cursor
(sci)
Updates the curses window cursor for the Scintilla window so the terminal draws the cursor
in the correct position.
This only needs to be called when scintilla_refresh()
or scintilla_noutrefresh()
is not
the last curses draw command issued (for any window, not just the Scintilla window).
Note: the terminal cursor may be hidden if Scintilla thinks this window has focus
(e.g. SCI_SETFOCUS
) and Scintilla’s caret is out of view. If another non-Scintilla window
has the real focus, call curs_set(1)
in order to show the terminal cursor for that window.
Parameters:
sci
: The Scintilla window returned byscintilla_new()
.
Return:
void