diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-01-11 10:14:35 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-01-11 10:14:35 +0100 |
commit | 7c503e6f49b140a99535c317092cc2f32d2a7140 (patch) | |
tree | 84a4d9595f5d7ddd3a8cc01de6b7d53937bd9567 /sys/src/cmd/rio | |
parent | 784e6ff8cd431e80800e0d7b0a4c5f3b385d8d89 (diff) |
rio: implement "look" (thanks lf94)
Diffstat (limited to 'sys/src/cmd/rio')
-rw-r--r-- | sys/src/cmd/rio/dat.h | 1 | ||||
-rw-r--r-- | sys/src/cmd/rio/rio.c | 6 | ||||
-rw-r--r-- | sys/src/cmd/rio/wind.c | 22 |
3 files changed, 29 insertions, 0 deletions
diff --git a/sys/src/cmd/rio/dat.h b/sys/src/cmd/rio/dat.h index 9ba409a1a..45159323d 100644 --- a/sys/src/cmd/rio/dat.h +++ b/sys/src/cmd/rio/dat.h @@ -210,6 +210,7 @@ void wmousectl(Window*); void wmovemouse(Window*, Point); void wpaste(Window*); void wplumb(Window*); +void wlook(Window*); void wrefresh(Window*, Rectangle); void wrepaint(Window*); void wresize(Window*, Image*, int); diff --git a/sys/src/cmd/rio/rio.c b/sys/src/cmd/rio/rio.c index ccf06ab0d..26b9b227d 100644 --- a/sys/src/cmd/rio/rio.c +++ b/sys/src/cmd/rio/rio.c @@ -62,6 +62,7 @@ enum Paste, Snarf, Plumb, + Look, Send, Scroll, }; @@ -71,6 +72,7 @@ char *menu2str[] = { [Paste] "paste", [Snarf] "snarf", [Plumb] "plumb", + [Look] "look", [Send] "send", [Scroll] "scroll", nil @@ -816,6 +818,10 @@ button2menu(Window *w) wplumb(w); break; + case Look: + wlook(w); + break; + case Send: getsnarf(); wsnarf(w); diff --git a/sys/src/cmd/rio/wind.c b/sys/src/cmd/rio/wind.c index 9b8f38d01..0c33c9616 100644 --- a/sys/src/cmd/rio/wind.c +++ b/sys/src/cmd/rio/wind.c @@ -889,6 +889,28 @@ wplumb(Window *w) plumbfree(m); } +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; + + 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); +} + int winborder(Window *w, Point xy) { |