[vte/vte-next: 138/223] Move method to VteBuffer
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next: 138/223] Move method to VteBuffer
- Date: Wed, 22 Jun 2011 21:00:12 +0000 (UTC)
commit ab0ad5e687e20b71e282e6910cadeb599a2b5673
Author: Christian Persch <chpe gnome org>
Date: Thu Jun 9 23:24:38 2011 +0200
Move method to VteBuffer
src/vte.c | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index cc6ecf2..a0084da 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -3727,9 +3727,12 @@ vte_terminal_io_write(GIOChannel *channel,
/* Convert some arbitrarily-encoded data to send to the child. */
static void
-vte_terminal_send(VteTerminal *terminal, const char *encoding,
- const void *data, gssize length,
- gboolean local_echo, gboolean newline_stuff)
+vte_buffer_send(VteBuffer *buffer,
+ const char *encoding,
+ const void *data,
+ gssize length,
+ gboolean local_echo,
+ gboolean newline_stuff)
{
gsize icount, ocount;
const guchar *ibuf;
@@ -3738,12 +3741,12 @@ vte_terminal_send(VteTerminal *terminal, const char *encoding,
VteConv conv;
long crcount, cooked_length, i;
- g_assert(VTE_IS_TERMINAL(terminal));
+ g_assert(VTE_IS_BUFFER(buffer));
g_assert(encoding && strcmp(encoding, "UTF-8") == 0);
conv = VTE_INVALID_CONV;
if (strcmp(encoding, "UTF-8") == 0) {
- conv = terminal->pvt->outgoing_conv;
+ conv = buffer->pvt->outgoing_conv;
}
if (conv == VTE_INVALID_CONV) {
g_warning (_("Unable to send data to child, invalid charset convertor"));
@@ -3753,8 +3756,8 @@ vte_terminal_send(VteTerminal *terminal, const char *encoding,
icount = length;
ibuf = data;
ocount = ((length + 1) * VTE_UTF8_BPC) + 1;
- _vte_byte_array_set_minimum_size(terminal->pvt->conv_buffer, ocount);
- obuf = obufptr = terminal->pvt->conv_buffer->data;
+ _vte_byte_array_set_minimum_size(buffer->pvt->conv_buffer, ocount);
+ obuf = obufptr = buffer->pvt->conv_buffer->data;
if (_vte_conv(conv, &ibuf, &icount, &obuf, &ocount) == (gsize)-1) {
g_warning(_("Error (%s) converting data for child, dropping."),
@@ -3792,8 +3795,7 @@ vte_terminal_send(VteTerminal *terminal, const char *encoding,
}
/* Tell observers that we're sending this to the child. */
if (cooked_length > 0) {
- vte_buffer_emit_commit(terminal->term_pvt->buffer,
- cooked, cooked_length);
+ vte_buffer_emit_commit(buffer, cooked, cooked_length);
}
/* Echo the text if we've been asked to do so. */
if ((cooked_length > 0) && local_echo) {
@@ -3804,7 +3806,7 @@ vte_terminal_send(VteTerminal *terminal, const char *encoding,
int len;
len = g_utf8_strlen(cooked, cooked_length);
for (i = 0; i < len; i++) {
- _vte_buffer_insert_char(terminal->term_pvt->buffer,
+ _vte_buffer_insert_char(buffer,
ucs4[i],
FALSE,
TRUE);
@@ -3814,8 +3816,8 @@ vte_terminal_send(VteTerminal *terminal, const char *encoding,
}
/* If there's a place for it to go, add the data to the
* outgoing buffer. */
- if ((cooked_length > 0) && (terminal->pvt->pty != NULL)) {
- _vte_byte_array_append(terminal->pvt->outgoing,
+ if ((cooked_length > 0) && (buffer->pvt->pty != NULL)) {
+ _vte_byte_array_append(buffer->pvt->outgoing,
cooked, cooked_length);
_VTE_DEBUG_IF(VTE_DEBUG_KEYBOARD) {
for (i = 0; i < cooked_length; i++) {
@@ -3835,7 +3837,7 @@ vte_terminal_send(VteTerminal *terminal, const char *encoding,
}
/* If we need to start waiting for the child pty to
* become available for writing, set that up here. */
- _vte_terminal_connect_pty_write(terminal);
+ _vte_terminal_connect_pty_write(buffer->pvt->terminal);
}
if (crcount > 0) {
g_free(cooked);
@@ -3867,7 +3869,7 @@ vte_buffer_feed_child(VteBuffer *buffer,
length = strlen(text);
}
if (length > 0) {
- vte_terminal_send(buffer->pvt->terminal, "UTF-8", text, length,
+ vte_buffer_send(buffer, "UTF-8", text, length,
FALSE, FALSE);
}
}
@@ -3914,7 +3916,7 @@ vte_terminal_feed_child_using_modes(VteTerminal *terminal,
length = strlen(data);
}
if (length > 0) {
- vte_terminal_send(terminal, "UTF-8", data, length,
+ vte_buffer_send(terminal->term_pvt->buffer, "UTF-8", data, length,
!terminal->pvt->screen->sendrecv_mode,
terminal->pvt->screen->linefeed_mode);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]