9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] acme: copy selection to new window
       [not found] <CA+BaOWwkgjxhBVVOzHY3qGQYBQEzyhRjeY5yTrHinwndohOiSQ@mail.gmail.com>
@ 2011-11-27 15:03 ` Jacek Masiulaniec
  2011-11-28  1:41   ` Akshat Kumar
  0 siblings, 1 reply; 2+ messages in thread
From: Jacek Masiulaniec @ 2011-11-27 15:03 UTC (permalink / raw)


In plan9port acme, I'd like a command to copy selected text into new window.
Here's rc implementation:

% cat >/tmp/copy
#!/usr/bin/env rc

. $PLAN9/lib/acme.rc

winctl 'addr=dot'
winread data >/tmp/selection
@{
? ? ? ?newwindow
? ? ? ?cat /tmp/selection | winwrite body
}
%

Consider the scenario:

(1) Create a window that reads:

foo
bar
baz

(2) Add tag command /tmp/copy.

(3) Select "bar".

(4) Execute /tmp/copy.

I expect new window to contain only the text "bar".
In reality, the window contains "bar", and the unexpected "baz".

Where's the problem?

Thanks.

Jacek



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [9fans] acme: copy selection to new window
  2011-11-27 15:03 ` [9fans] acme: copy selection to new window Jacek Masiulaniec
@ 2011-11-28  1:41   ` Akshat Kumar
  0 siblings, 0 replies; 2+ messages in thread
From: Akshat Kumar @ 2011-11-28  1:41 UTC (permalink / raw)


I believe you have to keep the addr file open, while
you are making changes to it (through ctl or otherwise)
and while you read from the data file.


ak

On Sun, Nov 27, 2011 at 7:03 AM, Jacek Masiulaniec
<jacekm at dobremiasto.net> wrote:
> In plan9port acme, I'd like a command to copy selected text into new window.
> Here's rc implementation:
>
> % cat >/tmp/copy
> #!/usr/bin/env rc
>
> . $PLAN9/lib/acme.rc
>
> winctl 'addr=dot'
> winread data >/tmp/selection
> @{
> ? ? ? ?newwindow
> ? ? ? ?cat /tmp/selection | winwrite body
> }
> %
>
> Consider the scenario:
>
> (1) Create a window that reads:
>
> foo
> bar
> baz
>
> (2) Add tag command /tmp/copy.
>
> (3) Select "bar".
>
> (4) Execute /tmp/copy.
>
> I expect new window to contain only the text "bar".
> In reality, the window contains "bar", and the unexpected "baz".
>
> Where's the problem?
>
> Thanks.
>
> Jacek
>
>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-28  1:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CA+BaOWwkgjxhBVVOzHY3qGQYBQEzyhRjeY5yTrHinwndohOiSQ@mail.gmail.com>
2011-11-27 15:03 ` [9fans] acme: copy selection to new window Jacek Masiulaniec
2011-11-28  1:41   ` Akshat Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).