Introduction
Introduction Statistics Contact Development Disclaimer Help
tfix snarf - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit 3fd51250be8cd6f6ac5df5342d3b81e6ed1c01a9
parent ac963cb3f58e13555336bc9c33e4e9591f9c914e
Author: rsc <devnull@localhost>
Date: Mon, 7 Nov 2005 01:51:11 +0000
fix snarf
Diffstat:
M src/cmd/9term/9term.c | 32 +++++++++++++++++++++++++++++…
M src/cmd/9term/fns.h | 4 ++++
M 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
t@@ -322,7 +322,7 @@ button2menu(Window *w)
break;
case Paste:
- //XXX getsnarf();
+ riogetsnarf();
wpaste(w);
wscrdraw(w);
break;
t@@ -332,7 +332,7 @@ button2menu(Window *w)
break;
case Send:
- //XXX getsnarf();
+ riogetsnarf();
wsnarf(w);
if(nsnarf == 0)
break;
t@@ -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
t@@ -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
t@@ -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
t@@ -1034,7 +1034,7 @@ wselect(Window *w)
}else{
if(first){
first = 0;
- getsnarf();
+ riogetsnarf();
}
wpaste(w);
}
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.