diff options
author | rsc <devnull@localhost> | 2005-11-07 01:51:11 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-11-07 01:51:11 +0000 |
commit | 3fd51250be8cd6f6ac5df5342d3b81e6ed1c01a9 (patch) | |
tree | 8171ef4e7991caae3df75451697a2a7ed5715d60 | |
parent | ac963cb3f58e13555336bc9c33e4e9591f9c914e (diff) | |
download | plan9port-3fd51250be8cd6f6ac5df5342d3b81e6ed1c01a9.tar.gz plan9port-3fd51250be8cd6f6ac5df5342d3b81e6ed1c01a9.tar.bz2 plan9port-3fd51250be8cd6f6ac5df5342d3b81e6ed1c01a9.zip |
fix snarf
-rw-r--r-- | src/cmd/9term/9term.c | 32 | ||||
-rw-r--r-- | src/cmd/9term/fns.h | 4 | ||||
-rw-r--r-- | src/cmd/9term/wind.c | 4 |
3 files changed, 36 insertions, 4 deletions
diff --git a/src/cmd/9term/9term.c b/src/cmd/9term/9term.c index 9d1fa1d1..e62330a3 100644 --- a/src/cmd/9term/9term.c +++ b/src/cmd/9term/9term.c @@ -322,7 +322,7 @@ button2menu(Window *w) break; case Paste: - //XXX getsnarf(); + riogetsnarf(); wpaste(w); wscrdraw(w); break; @@ -332,7 +332,7 @@ button2menu(Window *w) break; case Send: - //XXX getsnarf(); + riogetsnarf(); wsnarf(w); if(nsnarf == 0) break; @@ -505,3 +505,31 @@ rcinputproc(void *arg) } } +void +rioputsnarf(void) +{ + char *s; + + s = smprint("%.*S", nsnarf, snarf); + if(s){ + putsnarf(s); + free(s); + } +} + +void +riogetsnarf(void) +{ + char *s; + int n, nb, nulls; + +fprint(2, "getsnarf\n"); + s = getsnarf(); + if(s == nil) + return; + n = strlen(s)+1; + free(snarf); + snarf = runemalloc(n); + cvttorunes(s, n, snarf, &nb, &nsnarf, &nulls); + free(s); +} diff --git a/src/cmd/9term/fns.h b/src/cmd/9term/fns.h index 2d31ad88..a0ae686a 100644 --- a/src/cmd/9term/fns.h +++ b/src/cmd/9term/fns.h @@ -35,3 +35,7 @@ void winterrupt(Window*); #define runemalloc(n) malloc((n)*sizeof(Rune)) #define runerealloc(a, n) realloc(a, (n)*sizeof(Rune)) #define runemove(a, b, n) memmove(a, b, (n)*sizeof(Rune)) + +void rioputsnarf(void); +void riogetsnarf(void); + diff --git a/src/cmd/9term/wind.c b/src/cmd/9term/wind.c index 781a91d5..2eb2e638 100644 --- a/src/cmd/9term/wind.c +++ b/src/cmd/9term/wind.c @@ -772,7 +772,7 @@ wsnarf(Window *w) snarf = runerealloc(snarf, nsnarf); snarfversion++; /* maybe modified by parent */ runemove(snarf, w->r+w->q0, nsnarf); -//XXX putsnarf(); + rioputsnarf(); } void @@ -1034,7 +1034,7 @@ wselect(Window *w) }else{ if(first){ first = 0; - getsnarf(); + riogetsnarf(); } wpaste(w); } |