From 73d882124c24d1dbb178a9f3c2889922fcd78298 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 7 Dec 2007 09:49:18 +0000 Subject: [PATCH] Handle EOL properly when scrolled. --- TODO | 5 +++-- window-copy.c | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index cf722dd4..bf7c9b9e 100644 --- a/TODO +++ b/TODO @@ -34,13 +34,14 @@ kill server show-options command command to run something without a window at all? - command to insert a key (or other data...) into a window (send-key) + command to insert a key into a window (send-key) should paste-buffer become send-buffer..... + command to insert any data (a string) into a window (paste-data?) command to purge window history extend list-clients to list clients attached to a session (-a for all?) bring back detach-session to detach all clients on a session? paste buffer etc shouldn't be limited to keys - buffer manip: clear, view etc + buffer manip: clear, view etc (clear-buffer, show-buffer) - function groups, bind-key ^W { select-window 0; send-key ^W } etc - allow fnmatch for -c, so that you can, eg, detach all clients - session specification is all over the place. some things use -s before cmd, diff --git a/window-copy.c b/window-copy.c index bcf4b218..e61796e3 100644 --- a/window-copy.c +++ b/window-copy.c @@ -1,4 +1,4 @@ -/* $Id: window-copy.c,v 1.14 2007-12-06 10:04:43 nicm Exp $ */ +/* $Id: window-copy.c,v 1.15 2007-12-07 09:49:18 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -354,10 +354,14 @@ void window_copy_copy_selection(struct window *w) { struct window_copy_mode_data *data = w->modedata; + struct screen *s = &data->screen; char *buf; size_t len, off; u_int i, xx, yy, sx, sy, ex, ey; + if (!s->sel.flag) + return; + len = BUFSIZ; buf = xmalloc(len); off = 0; @@ -385,8 +389,6 @@ window_copy_copy_selection(struct window *w) if (ex > xx) ex = xx; - log_debug("copying from %u,%u to %u,%u", sx, sy, ex, ey); - /* Copy the lines. */ if (sy == ey) window_copy_copy_line(w, &buf, &off, &len, sy, sx, ex); @@ -477,7 +479,7 @@ window_copy_cursor_end_of_line(struct window *w) px = window_copy_find_length(w, py); /* On screen. */ - if (px > data->ox && px < data->ox + screen_last_x(s)) + if (px > data->ox && px <= data->ox + screen_last_x(s)) data->cx = px - data->ox; /* Off right of screen. */ @@ -572,7 +574,7 @@ window_copy_cursor_up(struct window *w) py = screen_y(&w->base, data->cy) - data->oy; px = window_copy_find_length(w, py); - if (data->cx > px || data->cx == ox) + if (data->cx + data->ox >= px || data->cx + data->ox >= ox) window_copy_cursor_end_of_line(w); } @@ -599,7 +601,7 @@ window_copy_cursor_down(struct window *w) py = screen_y(&w->base, data->cy) - data->oy; px = window_copy_find_length(w, py); - if (data->cx > px || data->cx == ox) + if (data->cx + data->ox >= px || data->cx + data->ox >= ox) window_copy_cursor_end_of_line(w); }