Branch: refs/heads/master
Author: Thomas Martitz <thomas.martitz(a)mailbox.org>
Committer: GitHub <noreply(a)github.com>
Date: Tue, 11 Jan 2022 22:13:04 UTC
Commit: 142b8ffdd4b7372b77966abbc99435644210515a
https://github.com/geany/geany/commit/142b8ffdd4b7372b77966abbc994356442105…
Log Message:
-----------
Scintilla 5.1.5 aftermath (#3098)
This commit fixes a few problems introduced by the last Scintilla update.
That update caused some headache around the incompatible changes to
`SCI_GETTEXT`, `SCI_GETSELTEXT`, and `SCI_GETCURLINE`.
- An explicit NUL termination was added to `sci_get_text()`. This is both
superflous and wrong (it writes behind the allocated buffer) as SCI_GETTEXT
already does NUL termination.
- In `sci_get_contents()`, sci_get_string() cannot be used. That would call
SCI_GETTEXT with length == 0 which is not the desired outcome. Instead,
basically revert to the old implementation but account for the API change.
- The callers of sci_get_selected_text_length() must be adapted, this
was missing yet. sci_get_selected_text_length() return value does not
include the NUL termination anymore.
Resolves #3095
Fixes: d7c985e47 ("Adapt to SCI_GETTEXT changes")
Modified Paths:
--------------
src/sciwrappers.c
src/ui_utils.c
Modified: src/sciwrappers.c
20 lines changed, 8 insertions(+), 12 deletions(-)
===================================================================
@@ -726,14 +726,12 @@ gchar *sci_get_line(ScintillaObject *sci, gint line_num)
*
* @param sci Scintilla widget.
* @param len Length of @a text buffer, usually sci_get_length() + 1.
- * @param text Text buffer; must be allocated @a len + 1 bytes for null-termination. */
+ * @param text Text buffer; must be allocated @a len bytes for null-termination. */
GEANY_API_SYMBOL
void sci_get_text(ScintillaObject *sci, gint len, gchar *text)
{
- if (len > 0) {
- SSM(sci, SCI_GETTEXT, (uptr_t) len - 1, (sptr_t) text);
- text[len] = '\0';
- }
+ g_return_if_fail(len > 0);
+ SSM(sci, SCI_GETTEXT, (uptr_t) len - 1, (sptr_t) text);
}
@@ -751,15 +749,13 @@ gchar *sci_get_contents(ScintillaObject *sci, gint buffer_len)
{
gchar *text;
+ g_return_if_fail(buffer_len != 0);
+
if (buffer_len < 0)
- return sci_get_string(sci, SCI_GETTEXT, 0);
+ buffer_len = sci_get_length(sci) + 1;
- text = NULL;
- if (buffer_len > 0) {
- text = g_malloc(buffer_len);
- sci_get_text(sci, buffer_len - 1, text);
- text[buffer_len - 1] = '\0';
- }
+ text = g_malloc(buffer_len);
+ SSM(sci, SCI_GETTEXT, (uptr_t) buffer_len - 1, (sptr_t) text);
return text;
}
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) - 1;
+ gint len = sci_get_selected_text_length(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) - 1);
+ sci_get_selected_text_length(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).
Branch: refs/heads/master
Author: Andreas Deininger <adeininger(a)urbanonline.de>
Committer: Andreas Deininger <adeininger(a)urbanonline.de>
Date: Tue, 11 Jan 2022 10:39:14 UTC
Commit: e371eb6c4c9fc6f2ff4a356c8bd88aa1810474cb
https://github.com/geany/geany/commit/e371eb6c4c9fc6f2ff4a356c8bd88aa181047…
Log Message:
-----------
Fixing typos
Modified Paths:
--------------
HACKING
doc/geany.txt
Modified: HACKING
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -113,7 +113,7 @@ it's for.
Plugin API code
---------------
Please be aware that anything with a doc-comment (a comment with an
-extra asterix: ``/**``) is something in the plugin API. Things like
+extra asterisk: ``/**``) is something in the plugin API. Things like
enums and structs can usually still be appended to, ensuring that all
the existing elements stay in place - this will keep the ABI stable.
Modified: doc/geany.txt
6 lines changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -461,15 +461,15 @@ can create a file named ``geany.css`` in the user configuration directory
are applied to allow overriding the default styles.
Geany offers a number of CSS IDs which can be used to taylor its
-appearence. Among the more interesting include:
+appearance. Among the more interesting include:
* ``geany-compiler-context`` - the style used for build command output surrounding errors
* ``geany-compiler-error`` - the style used for build command errors
* ``geany-compiler-message`` - the style other output encountered while running build command
* ``geany-document-status-changed`` - the style for document tab labels when the document is changed
* ``geany-document-status-disk-changed`` - the style for document tab labels when the file on disk has changed
* ``geany-document-status-readyonly``` - the style for document tab labels when the document is read-only
-* ``geany-search-entry-no-match`` - the style of find/replace diaog entries when no match is found
+* ``geany-search-entry-no-match`` - the style of find/replace dialog entries when no match is found
* ``geany-terminal-dirty`` - the style for the message window Terminal tab label when the terminal output has changed.
@@ -1043,7 +1043,7 @@ will be replaced when using the snippet:
Snippet names must not contain spaces otherwise they won't
work correctly. But beside that you can define almost any
string as a snippet and use it later in Geany. It is not limited
-to existing contructs of certain programming languages(like ``if``,
+to existing constructs of certain programming languages(like ``if``,
``for``, ``switch``). Define whatever you need.
**Template wildcards**
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).