summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/cmd/paint.c14
-rw-r--r--sys/src/cmd/samterm/main.c3
2 files changed, 13 insertions, 4 deletions
diff --git a/sys/src/cmd/paint.c b/sys/src/cmd/paint.c
index dafb29fa4..31996c3f1 100644
--- a/sys/src/cmd/paint.c
+++ b/sys/src/cmd/paint.c
@@ -259,10 +259,16 @@ restore(int n)
if((tmp = undo[x]) == nil)
return;
undo[x] = nil;
- expand(tmp->r);
- draw(canvas, tmp->r, tmp, nil, tmp->r.min);
- update(&tmp->r);
- freeimage(tmp);
+ if(canvas != nil && canvas->chan != tmp->chan){
+ freeimage(canvas);
+ canvas = tmp;
+ update(nil);
+ } else {
+ expand(tmp->r);
+ draw(canvas, tmp->r, tmp, nil, tmp->r.min);
+ update(&tmp->r);
+ freeimage(tmp);
+ }
}
}
diff --git a/sys/src/cmd/samterm/main.c b/sys/src/cmd/samterm/main.c
index 6ee72c94a..6f47e455c 100644
--- a/sys/src/cmd/samterm/main.c
+++ b/sys/src/cmd/samterm/main.c
@@ -310,6 +310,9 @@ scrorigin(Flayer *l, int but, long p0)
{
Text *t=(Text *)l->user1;
+ if(t->tag == Untagged)
+ return;
+
switch(but){
case 1:
outTsll(Torigin, t->tag, l->origin, p0);