Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: GitHub noreply@github.com Date: Sun, 24 Apr 2022 15:07:11 UTC Commit: a86fc9bf8199a640d23d52584842921dcafef9c5 https://github.com/geany/geany/commit/a86fc9bf8199a640d23d52584842921dcafef9...
Log Message: ----------- Merge pull request #3099 from techee/sc_fix
Update sci_get_selected_text_length() after change to Scintilla 5.1.5
Modified Paths: -------------- src/sciwrappers.c src/sciwrappers.h src/ui_utils.c
Modified: src/sciwrappers.c 14 lines changed, 13 insertions(+), 1 deletions(-) =================================================================== @@ -791,11 +791,23 @@ gchar *sci_get_selection_contents(ScintillaObject *sci) }
-/** Gets selected text length. +/** Gets selected text length including the terminating NUL character. + * @deprecated sci_get_selected_text_length is deprecated and should not be used in newly-written code. + * Use sci_get_selected_text_length2() instead. * @param sci Scintilla widget. * @return Length. */ GEANY_API_SYMBOL gint sci_get_selected_text_length(ScintillaObject *sci) +{ + return (gint) SSM(sci, SCI_GETSELTEXT, 0, 0) + 1; +} + + +/** Gets selected text length without the terminating NUL character. + * @param sci Scintilla widget. + * @return Length. */ +GEANY_API_SYMBOL +gint sci_get_selected_text_length2(ScintillaObject *sci) { return (gint) SSM(sci, SCI_GETSELTEXT, 0, 0); }
Modified: src/sciwrappers.h 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -64,7 +64,7 @@ void sci_set_selection_end (ScintillaObject *sci, gint position);
gint sci_get_length (ScintillaObject *sci); gchar* sci_get_contents (ScintillaObject *sci, gint buffer_len); -gint sci_get_selected_text_length(ScintillaObject *sci); +gint sci_get_selected_text_length2(ScintillaObject *sci); gchar* sci_get_selection_contents (ScintillaObject *sci); gchar* sci_get_line (ScintillaObject *sci, gint line_num); gint sci_get_line_length (ScintillaObject *sci, gint line); @@ -106,6 +106,7 @@ gint sci_find_matching_brace (ScintillaObject *sci, gint pos); void sci_get_text (ScintillaObject *sci, gint len, gchar *text) GEANY_DEPRECATED_FOR(sci_get_contents); void sci_get_selected_text (ScintillaObject *sci, gchar *text) GEANY_DEPRECATED_FOR(sci_get_selection_contents); void sci_get_text_range (ScintillaObject *sci, gint start, gint end, gchar *text) GEANY_DEPRECATED_FOR(sci_get_contents_range); +gint sci_get_selected_text_length(ScintillaObject *sci) GEANY_DEPRECATED_FOR(sci_get_selected_text_length2); #endif /* GEANY_DISABLE_DEPRECATED */
#ifdef GEANY_PRIVATE
Modified: src/ui_utils.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -227,7 +227,7 @@ static gchar *create_statusbar_statistics(GeanyDocument *doc, break; case 's': { - gint len = sci_get_selected_text_length(sci); + gint len = sci_get_selected_text_length2(sci); /* check if whole lines are selected */ if (!len || sci_get_col_from_position(sci, sci_get_selection_start(sci)) != 0 || @@ -241,7 +241,7 @@ static gchar *create_statusbar_statistics(GeanyDocument *doc, } case 'n' : g_string_append_printf(stats_str, "%d", - sci_get_selected_text_length(doc->editor->sci)); + sci_get_selected_text_length2(doc->editor->sci)); break; case 'w': /* RO = read-only */
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).