Kaydet (Commit) b4280422 authored tarafından Nick Treleaven's avatar Nick Treleaven

Add sci_word_start_position, sci_word_end_position wrappers

üst 6d2f26c4
......@@ -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;
}
......
......@@ -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);
}
......@@ -180,6 +180,8 @@ void sci_set_scroll_stop_at_last_line (ScintillaObject *sci, gboolean set);
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment