Scintilla 5.1.5 aftermath (#3098)
commit142b8ffdd4b7372b77966abbc99435644210515a
authorThomas Martitz <thomas.martitz@mailbox.org>
Tue, 11 Jan 2022 22:13:04 +0000 (11 23:13 +0100)
committerGitHub <noreply@github.com>
Tue, 11 Jan 2022 22:13:04 +0000 (11 23:13 +0100)
treed6b6b96117ec2fee41264148d9f85719b1d51bc0
parenta04f361ef357335e007a23ef04f3a3a4eec16c85
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")
src/sciwrappers.c
src/ui_utils.c