Hi there, I originally wrote this, forever ago:
http://comments.gmane.org/gmane.comp.gnu.screen.devel/294 I have kept using my :search command ever since, as I didn't bother changing my already-working patch at the time. Now I have just reimplemented it as a fallback for :select, which is what Sadrul was suggesting, and as you can see, the diff is much simpler. I have done some basic testing of this new patch and it works for me as expected. I am thinking of a strcasestr() version when _GNU_SOURCE or __GNUC__ or whatever is defined. What do you think, will this make it into screen? Regards --- src/doc/screen.1 | 2 +- src/process.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/doc/screen.1 b/src/doc/screen.1 index c175891..f59ec41 100644 --- a/src/doc/screen.1 +++ b/src/doc/screen.1 @@ -2913,7 +2913,7 @@ use the \*Qcopy\*U command. .BR "select " [ \fIWindowID ] .PP Switch to the window identified by \fIWindowID\fP. -This can be a prefix of a window title (alphanumeric window name) or a +This can be a substring of a window title (alphanumeric window name) or a window number. The parameter is optional and if omitted, you get prompted for an identifier. When a new window is established, the first available number diff --git a/src/process.c b/src/process.c index dfa7c82..c1f35fe 100644 --- a/src/process.c +++ b/src/process.c @@ -4988,6 +4988,9 @@ char *s; for (p = windows; p; p = p->w_next) if (!strncmp(p->w_title, s, strlen(s))) return p; + for(p=windows; p; p = p->w_next) + if (strstr(p->w_title, s)) + return p; return 0; } -- Fernando Vezzosi perl -E'$_="Pop Corn",s/\b\S(?{$0=$&^_^L})/$0/g,say' qw(MDAx MTAw MDEw MDEx MDAw _5 MTEw _6 _1 _5 _5 _4 _2 _2 _6 MTEx _1 _5 _5 _4 _5 _2 _6 _1 _1 _2 _2 _3 _5 _5 _6 _1 _1 _2 _5 _4 _3 _5 _2 _5 _1 _2 _3 _4 _5 MA==)