actually try this please which makes paste go through the mode keys path
rather than directly to the pane



diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c
index ff92783..2981358 100644
--- a/cmd-paste-buffer.c
+++ b/cmd-paste-buffer.c
@@ -29,8 +29,8 @@
 
 enum cmd_retval         cmd_paste_buffer_exec(struct cmd *, struct cmd_ctx *);
 
-void   cmd_paste_buffer_filter(struct window_pane *,
-           const char *, size_t, const char *, int bracket);
+void   cmd_paste_buffer_filter(struct window_pane *, struct session *,
+           const char *, size_t, const char *, int);
 
 const struct cmd_entry cmd_paste_buffer_entry = {
        "paste-buffer", "pasteb",
@@ -88,7 +88,8 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
                }
                pflag = args_has(args, 'p') &&
                    (wp->screen->mode & MODE_BRACKETPASTE);
-               cmd_paste_buffer_filter(wp, pb->data, pb->size, sepstr, pflag);
+               cmd_paste_buffer_filter(wp, s, pb->data, pb->size, sepstr,
+                   pflag);
        }
 
        /* Delete the buffer if -d. */
@@ -104,7 +105,7 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
 
 /* Add bytes to a buffer and filter '\n' according to separator. */
 void
-cmd_paste_buffer_filter(struct window_pane *wp,
+cmd_paste_buffer_filter(struct window_pane *wp, struct session *s,
     const char *data, size_t size, const char *sep, int bracket)
 {
        const char      *end = data + size;
@@ -112,19 +113,19 @@ cmd_paste_buffer_filter(struct window_pane *wp,
        size_t           seplen;
 
        if (bracket)
-               bufferevent_write(wp->event, "\033[200~", 6);
+               window_pane_write(wp, s, "\033[200~", 6);
 
        seplen = strlen(sep);
        while ((lf = memchr(data, '\n', end - data)) != NULL) {
                if (lf != data)
-                       bufferevent_write(wp->event, data, lf - data);
-               bufferevent_write(wp->event, sep, seplen);
+                       window_pane_write(wp, s, data, lf - data);
+               window_pane_write(wp, s, sep, seplen);
                data = lf + 1;
        }
 
        if (end != data)
-               bufferevent_write(wp->event, data, end - data);
+               window_pane_write(wp, s, data, end - data);
 
        if (bracket)
-               bufferevent_write(wp->event, "\033[201~", 6);
+               window_pane_write(wp, s, "\033[201~", 6);
 }
diff --git a/tmux.h b/tmux.h
index 9374012..ff35d3c 100644
--- a/tmux.h
+++ b/tmux.h
@@ -2117,6 +2117,8 @@ int                window_pane_set_mode(
                     struct window_pane *, const struct window_mode *);
 void            window_pane_reset_mode(struct window_pane *);
 void            window_pane_key(struct window_pane *, struct session *, int);
+void            window_pane_write(struct window_pane *, struct session *,
+                    const char *, size_t);
 void            window_pane_mouse(struct window_pane *,
                     struct session *, struct mouse_event *);
 int             window_pane_visible(struct window_pane *);
diff --git a/window.c b/window.c
index 5ef8195..bfe67ba 100644
--- a/window.c
+++ b/window.c
@@ -976,6 +976,24 @@ window_pane_reset_mode(struct window_pane *wp)
 }
 
 void
+window_pane_write(struct window_pane *wp, struct session *sess, const char 
*buf,
+    size_t len)
+{
+       size_t i;
+
+       if (!window_pane_visible(wp))
+               return;
+
+       if (wp->mode != NULL) {
+               for (i = 0; i < len; i++)
+                       wp->mode->key(wp, sess, buf[i]);
+               return;
+       }
+
+       bufferevent_write(wp->event, buf, len);
+}
+
+void
 window_pane_key(struct window_pane *wp, struct session *sess, int key)
 {
        struct window_pane      *wp2;


On Wed, Sep 12, 2012 at 01:09:24PM -0700, Edward Peschko wrote:
> On Tue, Sep 4, 2012 at 4:19 AM, Nicholas Marriott
> <nicholas.marri...@gmail.com> wrote:
> > It would not be a big code change to make the a key add the top paste
> > buffer to the search string in the same way as C-y works in the command
> > prompt.
> >
> 
> Nicholas,
> 
> Having that functionality would be great - if it needs to be a
> separate key for coding or design reasons, that would be good, but I'd
> suggest to overload the current paste buffer keys - that way, we
> wouldn't need to remember another key binding, and you could use the
> entire paste stack (instead of just the top one).
> 
> Again, either solution would work..
> 
> Thanks,
> 
> Ed

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to