[geany/geany] b42804: Add sci_word_start_position, sci_word_end_position wrappers
Nick Treleaven
git-noreply at xxxxx
Thu Sep 19 13:15:17 UTC 2013
Branch: refs/heads/master
Author: Nick Treleaven <nick.treleaven at btinternet.com>
Committer: Nick Treleaven <nick.treleaven at btinternet.com>
Date: Thu, 19 Sep 2013 13:15:17 UTC
Commit: b428042278634f9c0b9311b951a0de33fa785f30
https://github.com/geany/geany/commit/b428042278634f9c0b9311b951a0de33fa785f30
Log Message:
-----------
Add sci_word_start_position, sci_word_end_position wrappers
Modified Paths:
--------------
src/editor.c
src/sciwrappers.c
src/sciwrappers.h
Modified: src/editor.c
14 files changed, 7 insertions(+), 7 deletions(-)
===================================================================
@@ -1700,8 +1700,8 @@ void editor_find_current_word_sciwc(GeanyEditor *editor, gint pos, gchar *word,
if (pos == -1)
pos = sci_get_current_position(editor->sci);
- start = SSM(editor->sci, SCI_WORDSTARTPOSITION, pos, TRUE);
- end = SSM(editor->sci, SCI_WORDENDPOSITION, pos, TRUE);
+ start = sci_word_start_position(editor->sci, pos, TRUE);
+ end = sci_word_end_position(editor->sci, pos, TRUE);
if (start == end) /* caret in whitespaces sequence */
*word = 0;
@@ -2114,7 +2114,7 @@ static GSList *get_doc_words(ScintillaObject *sci, gchar *root, gsize rootlen)
word_end = pos_find + rootlen;
if (pos_find != current)
{
- word_end = SSM(sci, SCI_WORDENDPOSITION, word_end, TRUE);
+ word_end = sci_word_end_position(sci, word_end, TRUE);
word_length = word_end - pos_find;
if (word_length > rootlen)
@@ -3657,15 +3657,15 @@ void editor_select_word(GeanyEditor *editor)
g_return_if_fail(editor != NULL);
pos = SSM(editor->sci, SCI_GETCURRENTPOS, 0, 0);
- start = SSM(editor->sci, SCI_WORDSTARTPOSITION, pos, TRUE);
- end = SSM(editor->sci, SCI_WORDENDPOSITION, pos, TRUE);
+ start = sci_word_start_position(editor->sci, pos, TRUE);
+ end = sci_word_end_position(editor->sci, pos, TRUE);
if (start == end) /* caret in whitespaces sequence */
{
/* look forward but reverse the selection direction,
* so the caret end up stay as near as the original position. */
- end = SSM(editor->sci, SCI_WORDENDPOSITION, pos, FALSE);
- start = SSM(editor->sci, SCI_WORDENDPOSITION, end, TRUE);
+ end = sci_word_end_position(editor->sci, pos, FALSE);
+ start = sci_word_end_position(editor->sci, end, TRUE);
if (start == end)
return;
}
Modified: src/sciwrappers.c
15 files changed, 15 insertions(+), 0 deletions(-)
===================================================================
@@ -1264,12 +1264,27 @@ gint sci_text_width(ScintillaObject *sci, gint styleNumber, const gchar *text)
return (gint) SSM(sci, SCI_TEXTWIDTH, (uptr_t) styleNumber, (sptr_t) text);
}
+
void sci_move_selected_lines_down(ScintillaObject *sci)
{
SSM(sci, SCI_MOVESELECTEDLINESDOWN, 0, 0);
}
+
void sci_move_selected_lines_up(ScintillaObject *sci)
{
SSM(sci, SCI_MOVESELECTEDLINESUP, 0, 0);
}
+
+
+gint sci_word_start_position(ScintillaObject *sci, gint position, gboolean onlyWordCharacters)
+{
+ return SSM(sci, SCI_WORDSTARTPOSITION, position, onlyWordCharacters);
+}
+
+
+gint sci_word_end_position(ScintillaObject *sci, gint position, gboolean onlyWordCharacters)
+{
+ return SSM(sci, SCI_WORDENDPOSITION, position, onlyWordCharacters);
+}
+
Modified: src/sciwrappers.h
2 files changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -180,6 +180,8 @@
void sci_cancel (ScintillaObject *sci);
gint sci_get_position_after (ScintillaObject *sci, gint start);
+gint sci_word_start_position (ScintillaObject *sci, gint position, gboolean onlyWordCharacters);
+gint sci_word_end_position (ScintillaObject *sci, gint position, gboolean onlyWordCharacters);
void sci_lines_join (ScintillaObject *sci);
gint sci_text_width (ScintillaObject *sci, gint styleNumber, const gchar *text);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list