fix: search/calltip/autocomplete/style ignored arguments, duplicate constant, dead C export
ober
2337f26d49484cadce0f22de194c14efc0467454
--- a/jerboa_scintilla_shim.c +++ b/jerboa_scintilla_shim.c @@ -340,18 +340,6 @@ long jerboa_scintilla_send_message(jerboa_scintilla_handle_t handle, unsigned in return result; } -/* Send message with string as lparam (cast char* to sptr_t) */ -long jerboa_scintilla_send_message_string(jerboa_scintilla_handle_t handle, unsigned int msg, - unsigned long wparam, const char *str) { - if (!str) return 0; - instance_node_t *inst = acquire_instance(handle); - if (!inst) return 0; - long result = (long)scintilla_send_message(inst->view, msg, - (uptr_t)wparam, (sptr_t)str); - release_instance(inst); - return result; -} - long jerboa_scintilla_send_message_bytes(jerboa_scintilla_handle_t handle, unsigned int msg, unsigned long wparam, const unsigned char *bytes, --- a/lib/jerboa-scintilla/autocomplete.sls +++ b/lib/jerboa-scintilla/autocomplete.sls @@ -34,11 +34,14 @@ printf fprintf format path-extension path-absolute? with-input-from-string with-output-to-string iota \x31;+ \x31;- partition make-date make-time meta atom?) - (jerboa prelude) - (jerboa-scintilla constants) - (jerboa-scintilla scintilla)) + (jerboa prelude) (jerboa-scintilla constants) + (jerboa-scintilla ffi) (jerboa-scintilla scintilla)) (def (editor-autocomplete-show editor len-entered items) - (send-message/string editor SCI_AUTOCSHOW items)) + (ffi-scintilla-send-message-string + (scintilla-editor-handle editor) + SCI_AUTOCSHOW + len-entered + items)) (def (editor-autocomplete-cancel editor) (send-message editor SCI_AUTOCCANCEL)) (def (editor-autocomplete-active? editor) @@ -123,7 +126,11 @@ (def (editor-autocomplete-set-fill-ups editor chars) (send-message/string editor SCI_AUTOCSETFILLUPS chars)) (def (editor-calltip-show editor pos text) - (send-message/string editor SCI_CALLTIPSHOW text)) + (ffi-scintilla-send-message-string + (scintilla-editor-handle editor) + SCI_CALLTIPSHOW + pos + text)) (def (editor-calltip-cancel editor) (send-message editor SCI_CALLTIPCANCEL)) (def (editor-calltip-active? editor) --- a/lib/jerboa-scintilla/constants.sls +++ b/lib/jerboa-scintilla/constants.sls @@ -344,7 +344,7 @@ (def SCI_SETSELECTIONEND 2144) (def SCI_GETSELECTIONEMPTY 2650) (def SCI_SETMOVEEXTENDSSELECTION 2719) - (def SCI_GETMOVEEXTENDSSELECTION 2720) + (def SCI_GETMOVEEXTENDSSELECTION 2706) (def SCI_GETLINE 2153) (def SCI_GETLINECOUNT 2154) (def SCI_LINEFROMPOSITION 2166) --- a/lib/jerboa-scintilla/search.sls +++ b/lib/jerboa-scintilla/search.sls @@ -21,9 +21,17 @@ (def (editor-search-anchor editor) (send-message editor SCI_SEARCHANCHOR)) (def (editor-search-next editor flags text) - (send-message/string editor SCI_SEARCHNEXT text)) + (ffi-scintilla-send-message-string + (scintilla-editor-handle editor) + SCI_SEARCHNEXT + flags + text)) (def (editor-search-prev editor flags text) - (send-message/string editor SCI_SEARCHPREV text)) + (ffi-scintilla-send-message-string + (scintilla-editor-handle editor) + SCI_SEARCHPREV + flags + text)) (def (editor-set-target-start editor pos) (send-message editor SCI_SETTARGETSTART pos)) (def (editor-get-target-start editor) --- a/lib/jerboa-scintilla/style.sls +++ b/lib/jerboa-scintilla/style.sls @@ -30,9 +30,8 @@ printf fprintf format path-extension path-absolute? with-input-from-string with-output-to-string iota \x31;+ \x31;- partition make-date make-time meta atom?) - (jerboa prelude) - (jerboa-scintilla constants) - (jerboa-scintilla scintilla)) + (jerboa prelude) (jerboa-scintilla constants) + (jerboa-scintilla ffi) (jerboa-scintilla scintilla)) (def (editor-style-set-foreground editor style color) (send-message editor SCI_STYLESETFORE style color)) (def (editor-style-set-background editor style color) @@ -48,7 +47,11 @@ (def (editor-style-set-size editor style size) (send-message editor SCI_STYLESETSIZE style size)) (def (editor-style-set-font editor style font-name) - (send-message/string editor SCI_STYLESETFONT font-name)) + (ffi-scintilla-send-message-string + (scintilla-editor-handle editor) + SCI_STYLESETFONT + style + font-name)) (def (editor-style-set-underline editor style underline?) (send-message editor --- a/src/jerboa-scintilla/autocomplete.ss +++ b/src/jerboa-scintilla/autocomplete.ss @@ -46,6 +46,7 @@ (import (jerboa prelude) (jerboa-scintilla constants) + (jerboa-scintilla ffi) (jerboa-scintilla scintilla)) ;; ==================================================================== @@ -53,7 +54,8 @@ ;; ==================================================================== (def (editor-autocomplete-show editor len-entered items) - (send-message/string editor SCI_AUTOCSHOW items)) + (ffi-scintilla-send-message-string + (scintilla-editor-handle editor) SCI_AUTOCSHOW len-entered items)) (def (editor-autocomplete-cancel editor) (send-message editor SCI_AUTOCCANCEL)) @@ -152,7 +154,8 @@ ;; ==================================================================== (def (editor-calltip-show editor pos text) - (send-message/string editor SCI_CALLTIPSHOW text)) + (ffi-scintilla-send-message-string + (scintilla-editor-handle editor) SCI_CALLTIPSHOW pos text)) (def (editor-calltip-cancel editor) (send-message editor SCI_CALLTIPCANCEL)) --- a/src/jerboa-scintilla/constants.ss +++ b/src/jerboa-scintilla/constants.ss @@ -357,7 +357,7 @@ (def SCI_SETSELECTIONEND 2144) (def SCI_GETSELECTIONEMPTY 2650) (def SCI_SETMOVEEXTENDSSELECTION 2719) - (def SCI_GETMOVEEXTENDSSELECTION 2720) + (def SCI_GETMOVEEXTENDSSELECTION 2706) ;; ---- Line operations ---- (def SCI_GETLINE 2153) --- a/src/jerboa-scintilla/scintilla.ss +++ b/src/jerboa-scintilla/scintilla.ss @@ -228,6 +228,10 @@ (def (editor-get-text-length editor) (send-message editor SCI_GETTEXTLENGTH)) + ;; SCI_GETCHARAT returns the raw document byte (0-255) at POS, not a decoded + ;; UTF-8 codepoint, so integer->char yields the Latin-1 character for that + ;; byte. Callers needing a Unicode codepoint must decode the UTF-8 bytes + ;; themselves (e.g. via SCI_GETTEXTRANGE). (def (editor-get-char-at editor pos) (integer->char (send-message editor SCI_GETCHARAT pos))) --- a/src/jerboa-scintilla/search.ss +++ b/src/jerboa-scintilla/search.ss @@ -39,10 +39,12 @@ (send-message editor SCI_SEARCHANCHOR)) (def (editor-search-next editor flags text) - (send-message/string editor SCI_SEARCHNEXT text)) + (ffi-scintilla-send-message-string + (scintilla-editor-handle editor) SCI_SEARCHNEXT flags text)) (def (editor-search-prev editor flags text) - (send-message/string editor SCI_SEARCHPREV text)) + (ffi-scintilla-send-message-string + (scintilla-editor-handle editor) SCI_SEARCHPREV flags text)) ;; ==================================================================== ;; Target operations --- a/src/jerboa-scintilla/style.ss +++ b/src/jerboa-scintilla/style.ss @@ -55,6 +55,7 @@ (import (jerboa prelude) (jerboa-scintilla constants) + (jerboa-scintilla ffi) (jerboa-scintilla scintilla)) ;; ==================================================================== @@ -77,7 +78,8 @@ (send-message editor SCI_STYLESETSIZE style size)) (def (editor-style-set-font editor style font-name) - (send-message/string editor SCI_STYLESETFONT font-name)) + (ffi-scintilla-send-message-string + (scintilla-editor-handle editor) SCI_STYLESETFONT style font-name)) (def (editor-style-set-underline editor style underline?) (send-message editor SCI_STYLESETUNDERLINE style (if underline? 1 0)))