[geany/geany-plugins] 30f925: GeanyPG: Use sci_has_selection() rather than re-doing the logic
Colomban Wendling
git-noreply at xxxxx
Sun Jul 8 13:15:21 UTC 2012
Branch: refs/heads/1.22_release
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Sun, 08 Jul 2012 13:15:21
Commit: 30f925610f0d0c6a071adf006c8169d06675955c
https://github.com/geany/geany-plugins/commit/30f925610f0d0c6a071adf006c8169d06675955c
Log Message:
-----------
GeanyPG: Use sci_has_selection() rather than re-doing the logic
Modified Paths:
--------------
geanypg/src/helper_functions.c
Modified: geanypg/src/helper_functions.c
7 files changed, 2 insertions(+), 5 deletions(-)
===================================================================
@@ -133,12 +133,9 @@ void geanypg_load_buffer(gpgme_data_t * buffer)
{
/* gpgme_data_new_from_mem(buffer, text, size, 0); */
GeanyDocument * doc = document_get_current();
- /* SCI_GETSELECTIONSTART-SCI_GETSELECTIONEND */
char * data = NULL;
- unsigned long sstart = scintilla_send_message(doc->editor->sci, SCI_GETSELECTIONSTART, 0, 0);
- unsigned long send = scintilla_send_message(doc->editor->sci, SCI_GETSELECTIONEND, 0, 0);
unsigned long size = 0;
- if (sstart - send)
+ if (sci_has_selection(doc->editor->sci))
{
size = scintilla_send_message(doc->editor->sci, SCI_GETSELTEXT, 0, 0);
data = (char *) malloc(size + 1);
@@ -164,7 +161,7 @@ void geanypg_write_file(FILE * file)
unsigned long size;
char buffer[BUFSIZE] = {0};
GeanyDocument * doc = document_get_current();
- if (abs(sci_get_selection_start(doc->editor->sci) - sci_get_selection_end(doc->editor->sci)))
+ if (sci_has_selection(doc->editor->sci))
{ /* replace selected text
* clear selection, cursor should be at the end or beginneng of the selection */
scintilla_send_message(doc->editor->sci, SCI_REPLACESEL, 0, (sptr_t)"");
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
More information about the Plugins-Commits
mailing list