[vte] widget: Make word char detection depend on the VteTerminal
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] widget: Make word char detection depend on the VteTerminal
- Date: Sun, 8 Feb 2015 19:12:29 +0000 (UTC)
commit 1c71f28a7f0f957cb45cf55fa9517e63390e62f6
Author: Egmont Koblinger <egmont gmail com>
Date: Sun Feb 8 19:04:10 2015 +0100
widget: Make word char detection depend on the VteTerminal
In preparation of (re-)introducing a way to override the default
word chars.
https://bugzilla.gnome.org/show_bug.cgi?id=730632
src/vte-private.h | 2 +-
src/vte.c | 9 +++++----
src/vteaccess.c | 35 +++++++++++++++++++----------------
3 files changed, 25 insertions(+), 21 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index 3a40131..b4fc654 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -520,7 +520,7 @@ gboolean _vte_terminal_size_to_grid_size(VteTerminal *terminal,
long *cols,
long *rows);
-gboolean _vte_is_word_char(gunichar c) G_GNUC_CONST;
+gboolean _vte_terminal_is_word_char(VteTerminal *terminal, gunichar c);
G_END_DECLS
diff --git a/src/vte.c b/src/vte.c
index a2f9a2c..e9dbe57 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -5241,7 +5241,8 @@ vte_terminal_key_release(GtkWidget *widget, GdkEventKey *event)
}
/*
- * _vte_is_word_char:
+ * _vte_terminal_is_word_char:
+ * @terminal: a #VteTerminal
* @c: a candidate Unicode code point
*
* Checks if a particular character is considered to be part of a word or not.
@@ -5249,7 +5250,7 @@ vte_terminal_key_release(GtkWidget *widget, GdkEventKey *event)
* Returns: %TRUE if the character is considered to be part of a word
*/
gboolean
-_vte_is_word_char(gunichar c)
+_vte_terminal_is_word_char(VteTerminal *terminal, gunichar c)
{
return g_unichar_isgraph(c) &&
(g_unichar_isalnum(c) ||
@@ -5267,7 +5268,7 @@ vte_same_class(VteTerminal *terminal, glong acol, glong arow,
const VteCell *pcell = NULL;
gboolean word_char;
if ((pcell = vte_terminal_find_charcell(terminal, acol, arow)) != NULL && pcell->c != 0) {
- word_char = _vte_is_word_char(_vte_unistr_get_base (pcell->c));
+ word_char = _vte_terminal_is_word_char(terminal, _vte_unistr_get_base (pcell->c));
/* Lets not group non-wordchars together (bug #25290) */
if (!word_char)
@@ -5277,7 +5278,7 @@ vte_same_class(VteTerminal *terminal, glong acol, glong arow,
if (pcell == NULL || pcell->c == 0) {
return FALSE;
}
- if (word_char != _vte_is_word_char(_vte_unistr_get_base (pcell->c))) {
+ if (word_char != _vte_terminal_is_word_char(terminal, _vte_unistr_get_base (pcell->c))) {
return FALSE;
}
return TRUE;
diff --git a/src/vteaccess.c b/src/vteaccess.c
index d445e43..2bb9100 100644
--- a/src/vteaccess.c
+++ b/src/vteaccess.c
@@ -887,12 +887,15 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
{
VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
+ VteTerminal *terminal;
gunichar current, prev, next;
guint start, end, line;
vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
+ terminal = VTE_TERMINAL(gtk_accessible_get_widget (GTK_ACCESSIBLE(text)));
+
_vte_debug_print(VTE_DEBUG_ALLY,
"Getting %s %s at %d of %d.\n",
(direction == direction_current) ? "this" :
@@ -925,7 +928,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
/* Back up to the previous non-word-word transition. */
while (offset > 0) {
prev = vte_terminal_accessible_get_character_at_offset(text, offset - 1);
- if (_vte_is_word_char(prev)) {
+ if (_vte_terminal_is_word_char(terminal, prev)) {
offset--;
} else {
break;
@@ -939,7 +942,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
if (direction == direction_previous) {
while (offset > 0) {
prev = vte_terminal_accessible_get_character_at_offset(text, offset -
1);
- if (!_vte_is_word_char(prev)) {
+ if (!_vte_terminal_is_word_char(terminal, prev)) {
offset--;
} else {
break;
@@ -947,7 +950,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
}
while (offset > 0) {
prev = vte_terminal_accessible_get_character_at_offset(text, offset -
1);
- if (_vte_is_word_char(prev)) {
+ if (_vte_terminal_is_word_char(terminal, prev)) {
offset--;
} else {
break;
@@ -962,7 +965,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
if (direction == direction_next) {
while (offset < (int) priv->snapshot_characters->len) {
next = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (_vte_is_word_char(next)) {
+ if (_vte_terminal_is_word_char(terminal, next)) {
offset++;
} else {
break;
@@ -970,7 +973,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
}
while (offset < (int) priv->snapshot_characters->len) {
next = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (!_vte_is_word_char(next)) {
+ if (!_vte_terminal_is_word_char(terminal, next)) {
offset++;
} else {
break;
@@ -981,7 +984,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
/* Now find the end of this word. */
while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (_vte_is_word_char(current)) {
+ if (_vte_terminal_is_word_char(terminal, current)) {
offset++;
} else {
break;
@@ -991,7 +994,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
/* Now find the next non-word-word transition */
while (offset < (int) priv->snapshot_characters->len) {
next = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (!_vte_is_word_char(next)) {
+ if (!_vte_terminal_is_word_char(terminal, next)) {
offset++;
} else {
break;
@@ -1004,8 +1007,8 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
current = vte_terminal_accessible_get_character_at_offset(text, offset);
while (offset > 0) {
prev = vte_terminal_accessible_get_character_at_offset(text, offset - 1);
- if (_vte_is_word_char(prev) &&
- !_vte_is_word_char(current)) {
+ if (_vte_terminal_is_word_char(terminal, prev) &&
+ !_vte_terminal_is_word_char(terminal, current)) {
break;
} else {
offset--;
@@ -1020,7 +1023,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
if (direction == direction_previous) {
while (offset > 0) {
prev = vte_terminal_accessible_get_character_at_offset(text, offset -
1);
- if (_vte_is_word_char(prev)) {
+ if (_vte_terminal_is_word_char(terminal, prev)) {
offset--;
} else {
break;
@@ -1029,8 +1032,8 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
current = vte_terminal_accessible_get_character_at_offset(text, offset);
while (offset > 0) {
prev = vte_terminal_accessible_get_character_at_offset(text, offset -
1);
- if (_vte_is_word_char(prev) &&
- !_vte_is_word_char(current)) {
+ if (_vte_terminal_is_word_char(terminal, prev) &&
+ !_vte_terminal_is_word_char(terminal, current)) {
break;
} else {
offset--;
@@ -1046,7 +1049,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
if (direction == direction_next) {
while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text,
offset);
- if (!_vte_is_word_char(current)) {
+ if (!_vte_terminal_is_word_char(terminal, current)) {
offset++;
} else {
break;
@@ -1054,7 +1057,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
}
while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text,
offset);
- if (_vte_is_word_char(current)) {
+ if (_vte_terminal_is_word_char(terminal, current)) {
offset++;
} else {
break;
@@ -1065,7 +1068,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
/* Now find the next word end. */
while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (!_vte_is_word_char(current)) {
+ if (!_vte_terminal_is_word_char(terminal, current)) {
offset++;
} else {
break;
@@ -1073,7 +1076,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
}
while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (_vte_is_word_char(current)) {
+ if (_vte_terminal_is_word_char(terminal, current)) {
offset++;
} else {
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]