summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@src.gnome.org>2002-05-16 23:01:29 +0000
committerNalin Dahyabhai <nalin@src.gnome.org>2002-05-16 23:01:29 +0000
commit909c505d3a03de567c77da604d353b71f72df6a1 (patch)
tree5728c007c44dd248b2a875ac3bf8276f60beb48e
parentb72c6a398dab93bee5151859e7912ae575caa093 (diff)
downloadvte-909c505d3a03de567c77da604d353b71f72df6a1.tar.gz
Snip trailing whitespace off of copied lines, insert an end-of-line only
* src/vte.c: Snip trailing whitespace off of copied lines, insert an end-of-line only when the copied line doesn't go to the right edge, don't overrun right edge, even in insert mode.
-rw-r--r--ChangeLog4
-rw-r--r--src/vte.c40
-rw-r--r--vte.spec5
3 files changed, 36 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 4b78777e..3fd98bdd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2002-05-16 nalin
+ * src/vte.c: Snip trailing whitespace off of copied lines, insert
+ an end-of-line only when the copied line doesn't go to the right edge,
+ don't overrun right edge, even in insert mode.
2002-05-15 nalin
* src/vte.c: Send kI on insert key. Don't send drag events when the
child has only asked for click events. Fix crashbugs in selection.
diff --git a/src/vte.c b/src/vte.c
index 57ca32a9..69f51567 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -4554,9 +4554,16 @@ vte_terminal_insert_char(GtkWidget *widget, wchar_t c, gboolean force_insert)
/* If we're autowrapping here, do it. */
col = terminal->pvt->screen->cursor_current.col;
- if ((col >= terminal->column_count) && terminal->pvt->flags.am) {
- terminal->pvt->screen->cursor_current.col = 0;
- terminal->pvt->screen->cursor_current.row++;
+ if (col >= terminal->column_count) {
+ if (terminal->pvt->flags.am) {
+ /* Wrap. */
+ terminal->pvt->screen->cursor_current.col = 0;
+ terminal->pvt->screen->cursor_current.row++;
+ } else {
+ /* Don't wrap, stay at the rightmost column. */
+ terminal->pvt->screen->cursor_current.col =
+ terminal->column_count - 1;
+ }
}
/* Make sure we have enough rows to hold this data. */
@@ -4637,6 +4644,12 @@ vte_terminal_insert_char(GtkWidget *widget, wchar_t c, gboolean force_insert)
* both where the cursor was moved from. */
vte_invalidate_cursor_once(terminal);
screen->cursor_current.col++;
+ /* Make sure we're not getting random stuff past the right
+ * edge of the screen at this point, because the user can't
+ * see it. */
+ while (array->len > terminal->column_count) {
+ g_array_remove_index(array, array->len - 1);
+ }
}
/* Redraw where the cursor has moved to. */
@@ -6482,7 +6495,7 @@ vte_terminal_get_text(VteTerminal *terminal,
gboolean(*is_selected)(VteTerminal *, long, long),
GArray *attributes)
{
- long x, y, nuls;
+ long x, y, spaces;
VteScreen *screen;
struct vte_charcell *pcell;
char *ret = NULL;
@@ -6499,7 +6512,7 @@ vte_terminal_get_text(VteTerminal *terminal,
y < terminal->row_count + screen->scroll_delta;
y++) {
x = 0;
- nuls = 0;
+ spaces = 0;
attr.row = y;
do {
pcell = vte_terminal_find_charcell(terminal, x, y);
@@ -6509,7 +6522,8 @@ vte_terminal_get_text(VteTerminal *terminal,
/* If there are no more cells on this
* line, and we've hit the right margin,
* add a newline. */
- if (x < terminal->column_count) {
+ if ((x < terminal->column_count - 1) ||
+ (spaces > 0)) {
string = g_string_append_c(string, '\n');
if (attributes) {
g_array_append_val(attributes,
@@ -6518,10 +6532,11 @@ vte_terminal_get_text(VteTerminal *terminal,
}
break;
} else
- if (pcell->c == 0) {
- /* Count this NUL in case there's
- * something to the right of it. */
- nuls++;
+ if ((pcell->c == 0) ||
+ (g_unichar_isspace(pcell->c))) {
+ /* Count this in case there's something
+ * to the right of it. */
+ spaces++;
} else {
/* Use the attributes for this character. */
attr.fore.red =
@@ -6538,13 +6553,14 @@ vte_terminal_get_text(VteTerminal *terminal,
terminal->pvt->palette[pcell->back].blue;
attr.underline = pcell->underline;
attr.alternate = pcell->alternate;
- /* Stuff any saved NULs in as spaces. */
- while (nuls-- > 0) {
+ /* Stuff any saved spaces in. */
+ while (spaces > 0) {
string = g_string_append_c(string, ' ');
if (attributes != NULL) {
g_array_append_val(attributes,
attr);
}
+ spaces--;
}
/* Stuff the charcter in this cell. */
string = g_string_append_unichar(string, pcell->c);
diff --git a/vte.spec b/vte.spec
index cfb82cd7..67e0ada2 100644
--- a/vte.spec
+++ b/vte.spec
@@ -1,5 +1,5 @@
Name: vte
-Version: 0.3.16
+Version: 0.3.17
Release: 1
Summary: An experimental terminal emulator.
License: LGPL
@@ -53,6 +53,9 @@ make install DESTDIR=$RPM_BUILD_ROOT
%{_libdir}/pkgconfig/*
%changelog
+* Thu May 16 2002 Nalin Dahyabhai <nalin@redhat.com> 0.3.17-1
+- tweak finding of selected text
+
* Wed May 15 2002 Nalin Dahyabhai <nalin@redhat.com> 0.3.16-1
- hook up Insert->kI
- convert scroll events to button 4/5 if an app wants mouse events