1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
|
From 41b21dfbd47e768d803b59d1507935ad1602d77c Mon Sep 17 00:00:00 2001
From: Jelle van der Waa <jelle@vdwaa.nl>
Date: Sat, 13 Feb 2016 22:01:59 +0100
Subject: [PATCH 1/5] expose functions for pausing unpausing output
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
index 18ac0714..d6404220 100644
--- a/src/vte/vteterminal.h
+++ b/src/vte/vteterminal.h
@@ -175,6 +175,12 @@ void vte_terminal_feed_child_binary(VteTerminal *terminal,
const guint8 *data,
gsize length) _VTE_GNUC_NONNULL(1);
+_VTE_PUBLIC
+void vte_terminal_connect_pty_read(VteTerminal *terminal);
+
+_VTE_PUBLIC
+void vte_terminal_disconnect_pty_read(VteTerminal *terminal);
+
/* Copy currently-selected text to the clipboard, or from the clipboard to
* the terminal. */
_VTE_PUBLIC
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index c18a178a..6ba8c61c 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -2917,6 +2917,32 @@ vte_terminal_feed_child(VteTerminal *terminal,
IMPL(terminal)->feed_child(text, length);
}
+/**
+ * vte_terminal_connect_pty_read:
+ * @terminal: a #VteTerminal
+ *
+ * Unpause output
+ */
+void
+vte_terminal_connect_pty_read(VteTerminal *terminal)
+{
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ IMPL(terminal)->connect_pty_read();
+}
+
+/**
+ * vte_terminal_disconnect_pty_read:
+ * @terminal: a #VteTerminal
+ *
+ * Pause output
+ */
+void
+vte_terminal_disconnect_pty_read(VteTerminal *terminal)
+{
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ IMPL(terminal)->disconnect_pty_read();
+}
+
/**
* vte_terminal_feed_child_binary:
* @terminal: a #VteTerminal
--
2.25.0
From 05c0f85efe721595464b6b9d794e2663f0f5f10f Mon Sep 17 00:00:00 2001
From: Jelle van der Waa <jelle@vdwaa.nl>
Date: Sat, 13 Feb 2016 22:18:01 +0100
Subject: [PATCH 2/5] expose function for setting cursor position
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
index d6404220..af291ba8 100644
--- a/src/vte/vteterminal.h
+++ b/src/vte/vteterminal.h
@@ -386,6 +386,11 @@ _VTE_PUBLIC
void vte_terminal_get_cursor_position(VteTerminal *terminal,
glong *column,
glong *row) _VTE_GNUC_NONNULL(1);
+_VTE_PUBLIC
+void vte_terminal_set_cursor_position(VteTerminal *terminal,
+ glong column,
+ glong row) _VTE_GNUC_NONNULL(1);
+
_VTE_PUBLIC
char *vte_terminal_hyperlink_check_event(VteTerminal *terminal,
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 6ba8c61c..66bf05bd 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -2552,6 +2552,30 @@ vte_terminal_get_cursor_position(VteTerminal *terminal,
}
}
+/**
+ * vte_terminal_set_cursor_position
+ * @terminal: a #VteTerminal
+ * @column: the new cursor column
+ * @row: the new cursor row
+ *
+ * Set the location of the cursor.
+ */
+void
+vte_terminal_set_cursor_position(VteTerminal *terminal,
+ long column, long row)
+{
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+
+ auto impl = IMPL(terminal);
+ impl->invalidate_cursor_once(FALSE);
+ impl->m_screen->cursor.col = column;
+ impl->m_screen->cursor.row = row;
+ impl->invalidate_cursor_once(FALSE);
+ impl->check_cursor_blink();
+ impl->queue_cursor_moved();
+
+}
+
/**
* vte_terminal_pty_new_sync:
* @terminal: a #VteTerminal
--
2.25.0
From 87f3350ca7af430d30a9680fb91dec73a3314c97 Mon Sep 17 00:00:00 2001
From: Jelle van der Waa <jelle@vdwaa.nl>
Date: Sat, 13 Feb 2016 22:25:19 +0100
Subject: [PATCH 3/5] add function for setting the text selections
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
index af291ba8..1827f140 100644
--- a/src/vte/vteterminal.h
+++ b/src/vte/vteterminal.h
@@ -196,6 +196,10 @@ _VTE_PUBLIC
void vte_terminal_select_all(VteTerminal *terminal) _VTE_GNUC_NONNULL(1);
_VTE_PUBLIC
void vte_terminal_unselect_all(VteTerminal *terminal) _VTE_GNUC_NONNULL(1);
+_VTE_PUBLIC
+void vte_terminal_select_text(VteTerminal *terminal, long start_col, long start_row,
+ long end_col, long end_row) _VTE_GNUC_NONNULL(1);
+
/* By-word selection */
_VTE_PUBLIC
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 66bf05bd..1a190933 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -2525,6 +2525,26 @@ vte_terminal_unselect_all(VteTerminal *terminal)
IMPL(terminal)->deselect_all();
}
+/**
+ * vte_terminal_select_text:
+ * @terminal: a #VteTerminal
+ * @start_col: the starting column for the selection
+ * @start_row: the starting row for the selection
+ * @end_col: the end column for the selection
+ * @end_row: the end row for the selection
+ *
+ * Sets the current selection region.
+ */
+void
+vte_terminal_select_text(VteTerminal *terminal,
+ long start_col, long start_row,
+ long end_col, long end_row)
+{
+ g_return_if_fail (VTE_IS_TERMINAL (terminal));
+
+ IMPL(terminal)->select_text(start_col, start_row, end_col, end_row);
+}
+
/**
* vte_terminal_get_cursor_position:
* @terminal: a #VteTerminal
--
2.25.0
From 7e2a93bdf8cfecd7f2f143f7c02ca5e3e3a3849a Mon Sep 17 00:00:00 2001
From: Jelle van der Waa <jelle@vdwaa.nl>
Date: Sat, 13 Feb 2016 22:38:21 +0100
Subject: [PATCH 4/5] add functions to get/set block selection mode
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
index 1827f140..c027dd92 100644
--- a/src/vte/vteterminal.h
+++ b/src/vte/vteterminal.h
@@ -197,6 +197,11 @@ void vte_terminal_select_all(VteTerminal *terminal) _VTE_GNUC_NONNULL(1);
_VTE_PUBLIC
void vte_terminal_unselect_all(VteTerminal *terminal) _VTE_GNUC_NONNULL(1);
_VTE_PUBLIC
+gboolean vte_terminal_get_selection_block_mode(VteTerminal *terminal) _VTE_GNUC_NONNULL(1);
+_VTE_PUBLIC
+void vte_terminal_set_selection_block_mode(VteTerminal *terminal,
+ gboolean block_mode) _VTE_GNUC_NONNULL(1);
+_VTE_PUBLIC
void vte_terminal_select_text(VteTerminal *terminal, long start_col, long start_row,
long end_col, long end_row) _VTE_GNUC_NONNULL(1);
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 1a190933..b684492d 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -2524,6 +2524,31 @@ vte_terminal_unselect_all(VteTerminal *terminal)
IMPL(terminal)->deselect_all();
}
+/**
+ * vte_terminal_get_selection_block_mode:
+ * @terminal: a #VteTerminal
+ *
+ * Checks whether or not block selection is enabled.
+ *
+ * Returns: %TRUE if block selection is enabled, %FALSE if not
+ */
+
+gboolean vte_terminal_get_selection_block_mode(VteTerminal *terminal) {
+ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
+ return IMPL(terminal)->m_selection_block_mode;
+}
+/**
+ * vte_terminal_set_selection_block_mode:
+ * @terminal: a #VteTerminal
+ * @block_mode: whether block selection is enabled
+ *
+ * Sets whether or not block selection is enabled.
+ */
+void
+vte_terminal_set_selection_block_mode(VteTerminal *terminal, gboolean block_mode) {
+ g_return_if_fail (VTE_IS_TERMINAL (terminal));
+ IMPL(terminal)->m_selection_block_mode = block_mode;
+}
/**
* vte_terminal_select_text:
--
2.25.0
From 5f46868476bad435e76e2624ff0a3a85efc53198 Mon Sep 17 00:00:00 2001
From: Jelle van der Waa <jelle@vdwaa.nl>
Date: Sat, 13 Feb 2016 22:47:44 +0100
Subject: [PATCH 5/5] expose function for getting the selected text
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
index c027dd92..adf96da6 100644
--- a/src/vte/vteterminal.h
+++ b/src/vte/vteterminal.h
@@ -204,7 +204,9 @@ void vte_terminal_set_selection_block_mode(VteTerminal *terminal,
_VTE_PUBLIC
void vte_terminal_select_text(VteTerminal *terminal, long start_col, long start_row,
long end_col, long end_row) _VTE_GNUC_NONNULL(1);
-
+_VTE_PUBLIC
+char *
+vte_terminal_get_selection(VteTerminal *terminal) _VTE_GNUC_NONNULL(1);
/* By-word selection */
_VTE_PUBLIC
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index b684492d..e405841c 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -2570,6 +2570,13 @@ vte_terminal_select_text(VteTerminal *terminal,
IMPL(terminal)->select_text(start_col, start_row, end_col, end_row);
}
+char *
+vte_terminal_get_selection(VteTerminal *terminal)
+{
+ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
+ return g_strdup (IMPL(terminal)->m_selection[VTE_SELECTION_PRIMARY]->str);
+}
+
/**
* vte_terminal_get_cursor_position:
* @terminal: a #VteTerminal
--
2.25.0
|