ref: 9314883aff7950820a26782d863a78d18be93635
parent: 7682a24bc514a9348ec01b1a3d66f9c6568373c4
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Oct 21 11:29:07 EDT 2019
Make ctrl+g focus text windows and cycle zeroxed copies (thanks kvik)
--- a/sys/man/1/sam
+++ b/sys/man/1/sam
@@ -723,6 +723,9 @@
.PP
Ctrl+b switches to the command window and moves to the end
of the text.
+Ctrl+g switches from to the last focused window.
+If the focused window is a text window, ctrl+g switches
+to the next zeroxed instance of that window.
.PP
The button 3 menu controls window operations.
The top of the menu
--- a/sys/src/cmd/samterm/main.c
+++ b/sys/src/cmd/samterm/main.c
@@ -485,6 +485,7 @@
case Ksoh:
case Kenq:
case Kstx:
+ case Kbel:
return 1;
}
return 0;
@@ -658,6 +659,22 @@
a = t->rasp.nrunes;
flsetselect(l, a, a);
center(l, a);
+ }else if(c == Kbel){
+ int i;
+ if(work == nil)
+ return;
+ if(which != work){
+ current(work);
+ return;
+ }
+ t = (Text*)work->user1;
+ l = &t->l[t->front];
+ for(i=t->front; t->nwin>1 && (i = (i+1)%NL) != t->front; )
+ if(t->l[i].textfn != 0){
+ l = &t->l[i];
+ break;
+ }
+ current(l);
}else{
if(c==Kesc && typeesc>=0){
l->p0 = typeesc;
--- a/sys/src/cmd/samterm/samterm.h
+++ b/sys/src/cmd/samterm/samterm.h
@@ -7,7 +7,9 @@
enum{
Up,
- Down
+ Down,
+
+ Kbel=0x7,
};
typedef struct Text Text;