twintext: add tmux support, use in ", "" - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit fa7fecff33769e27653a51d1d15909d2b538194b
 (DIR) parent cc48e73a96c863784fb0bc46e69bccf509890827
 (HTM) Author: Russ Cox <rsc@swtch.com>
       Date:   Mon, 13 Jan 2020 11:04:53 -0500
       
       wintext: add tmux support, use in ", ""
       
       Fixes #223.
       
       Diffstat:
         M bin/quote1                          |      11 +----------
         M bin/quote2                          |       2 +-
         M bin/wintext                         |       8 +++++++-
         M man/man1/wintext.1                  |      18 ++++++++++--------
       
       4 files changed, 19 insertions(+), 20 deletions(-)
       ---
 (DIR) diff --git a/bin/quote1 b/bin/quote1
       t@@ -2,19 +2,10 @@
        
        . 9.rc
        
       -fn text {
       -        if(~ $winid [0-9]*)
       -                9p read acme/$winid/body
       -        if not if(~ $text9term unix!*)
       -                dial -e $text9term </dev/null
       -        if not
       -                status=''
       -}
       -
        PROMPT='[^         ]*[%;$#][         ]+'
        
        fn cmds {
       -        text | sed -n 's/^'$PROMPT'([^"])/        \1/p'
       +        wintext | sed -n 's/^'$PROMPT'([^"])/        \1/p'
        }
        
        switch($#*) {
 (DIR) diff --git a/bin/quote2 b/bin/quote2
       t@@ -1,6 +1,6 @@
        #!/usr/local/plan9/bin/rc
        
       -cmd = `{" $* | tail -1}
       +cmd = `{quote1 $* | tail -1}
        if (~ $#cmd 0) {
                echo no such command found >[1=2]
                exit notfound
 (DIR) diff --git a/bin/wintext b/bin/wintext
       t@@ -1,4 +1,4 @@
       -#!/bin/sh
       +#!/bin/bash
        
        case "$winid" in
        [0-9]*)
       t@@ -12,5 +12,11 @@ unix!*)
                exit 0
        esac
        
       +case "$TMUX" in
       +?*)
       +        tmux capture-pane -p
       +        exit 0
       +esac
       +
        echo 'no running window found' 2>&1
        exit 1
 (DIR) diff --git a/man/man1/wintext.1 b/man/man1/wintext.1
       t@@ -3,17 +3,17 @@
        wintext, ", "" \- access text in current window
        .ds x \C'"'
        .ds xx \C'"'\^\^\^\^\C'"'
       -.ds y \*x\ 
       -.ds yy \*(xx\ 
       +.ds y \*x\^
       +.ds yy \*(xx\^
        .SH SYNOPSIS
        .B wintext
        .br
       -.B \*x\ 
       +.B \*y
        [
        .I prefix
        ]
        .br
       -.B \*(xx\ 
       +.B \*(yy
        [
        .I prefix
        ]
       t@@ -22,9 +22,11 @@ wintext, ", "" \- access text in current window
        prints the text of the current
        .I win
        (see
       -.IR acme (1))
       +.IR acme (1)),
       +.IR 9term (1),
        or
       -.IR 9term (1)
       +(Unix's)
       +.IR tmux (1)
        window to standard output.
        .PP
        .I \*y
       t@@ -40,7 +42,7 @@ prints the last command executed.
        .I \*(yy
        prints the last command that
        .I \*y
       -would print and then executes it by piping it into 
       +would print and then executes it by piping it into
        .IR rc (1).
        .PP
        Both
       t@@ -82,7 +84,7 @@ command again:
        % \*(xx lc
                % lc r*
        ramfs   rc      read    rio     rm
       -% 
       +%
        .EE
        .SH SEE ALSO
        .IR 9term (1),