Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sci_get_selected_text_length() after change to Scintilla 5.1.5 #3099

Merged
merged 4 commits into from Apr 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/sciwrappers.c
Expand Up @@ -792,6 +792,8 @@ gchar *sci_get_selection_contents(ScintillaObject *sci)


/** 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
Expand All @@ -801,6 +803,16 @@ gint sci_get_selected_text_length(ScintillaObject *sci)
}


/** 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);
}


gint sci_get_position_from_xy(ScintillaObject *sci, gint x, gint y, gboolean nearby)
{
/* for nearby return -1 if there is no character near to the x,y point. */
Expand Down
3 changes: 2 additions & 1 deletion src/sciwrappers.h
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/ui_utils.c
Expand Up @@ -227,7 +227,7 @@ static gchar *create_statusbar_statistics(GeanyDocument *doc,
break;
case 's':
{
gint len = sci_get_selected_text_length(sci) - 1;
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 ||
Expand All @@ -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) - 1);
sci_get_selected_text_length2(doc->editor->sci));
break;
case 'w':
/* RO = read-only */
Expand Down