Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: GitHub noreply@github.com Date: Thu, 05 Oct 2023 16:27:34 UTC Commit: a53c5db4453b1597374a78949dd21f2b7cd4e31c https://github.com/geany/geany-plugins/commit/a53c5db4453b1597374a78949dd21f...
Log Message: ----------- Merge pull request #1154 from techee/scintilla
geanypg: Update to Scintilla 5.1.5 SCI_GETSELTEXT change
Modified Paths: -------------- geanypg/src/helper_functions.c
Modified: geanypg/src/helper_functions.c 17 lines changed, 5 insertions(+), 12 deletions(-) =================================================================== @@ -133,24 +133,17 @@ void geanypg_load_buffer(gpgme_data_t * buffer) { /* gpgme_data_new_from_mem(buffer, text, size, 0); */ GeanyDocument * doc = document_get_current(); - char * data = NULL; - unsigned long size = 0; + char * data; if (sci_has_selection(doc->editor->sci)) { - size = scintilla_send_message(doc->editor->sci, SCI_GETSELTEXT, 0, 0) - 1; - data = (char *) malloc(size + 1); - scintilla_send_message(doc->editor->sci, SCI_GETSELTEXT, 0, (sptr_t)data); - gpgme_data_new_from_mem(buffer, data, size, 1); + data = sci_get_selection_contents(doc->editor->sci); } else { - size = scintilla_send_message(doc->editor->sci, SCI_GETLENGTH, 0, 0); - data = (char *) malloc(size + 1); - scintilla_send_message(doc->editor->sci, SCI_GETTEXT, (uptr_t)(size + 1), (sptr_t)data); - gpgme_data_new_from_mem(buffer, data, size, 1); + data = sci_get_contents(doc->editor->sci, -1); } - if (data) /* if there is no text data may still be NULL */ - free(data); + gpgme_data_new_from_mem(buffer, data, strlen(data), 1); + free(data); gpgme_data_set_encoding(*buffer, GPGME_DATA_ENCODING_BINARY); }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).