summaryrefslogtreecommitdiffstats
path: root/src/cmd/9term/wind.c
diff options
context:
space:
mode:
authorFazlul Shahriar <fshahriar@gmail.com>2020-01-07 15:02:01 -0500
committerDan Cross <crossd@gmail.com>2020-01-07 15:02:01 -0500
commita4e59b37021326e304c311825ba52a52b02bd9c0 (patch)
tree54973e13210709bde7f83e180ac3f22c1db80e0b /src/cmd/9term/wind.c
parentcf6b778799edf4ebc2331d12707e66e7d38331ea (diff)
downloadplan9port-a4e59b37021326e304c311825ba52a52b02bd9c0.tar.gz
plan9port-a4e59b37021326e304c311825ba52a52b02bd9c0.zip
9term: add a "look" menu item (#299)
Add a menu item which functions similar to acme's `Look` command. This is copied from 9front. See: https://code.9front.org/hg/plan9front/rev/1f1596dbca51 https://code.9front.org/hg/plan9front/rev/d2de1d2f7b48
Diffstat (limited to 'src/cmd/9term/wind.c')
-rw-r--r--src/cmd/9term/wind.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/cmd/9term/wind.c b/src/cmd/9term/wind.c
index 7dc20443..d47e8467 100644
--- a/src/cmd/9term/wind.c
+++ b/src/cmd/9term/wind.c
@@ -907,6 +907,31 @@ winborder(Window *w, Point xy)
}
void
+wlook(Window *w)
+{
+ int i, n, e;
+
+ i = w->q1;
+ n = i - w->q0;
+ e = w->nr - n;
+ if(n <= 0 || e < n)
+ return;
+
+ if(i > e)
+ i = 0;
+
+ while(runestrncmp(w->r+w->q0, w->r+i, n) != 0){
+ if(i < e)
+ i++;
+ else
+ i = 0;
+ }
+
+ wsetselect(w, i, i+n);
+ wshow(w, i);
+}
+
+void
wmousectl(Window *w)
{
int but;