Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Adding tests for zle? The missing X series tests
- X-seq: zsh-workers 30032
- From: Felix Rosencrantz <f.rosencrantz@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Adding tests for zle? The missing X series tests
- Date: Tue, 20 Dec 2011 08:20:07 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=S4sTy6FbDHXmIR1PDOh85O00JUwMBNWLogMceavaM9s=; b=omEwQpjb+YcIEiAmRnxehReDlfCVi1dqU+qduO4T10GB6qlFVh2iBReqtLMh8CS4oq cc+Z/z67ddfLukyUNed8mExzI3O4wE6wTOez5DquCq0o8a175A5jt4i7obRK/gY+xbI2 j+Pd1Ql+mJ7dN5OoOIP1QWZJ9ntaChad46iZI=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
I was thinking about refactoring doisearch(), so it is easier to
read/understand/change, so the base function might look like below.
Though before attempting this I would like to have the safety net of
tests, to assure the changes don't break the incremental search
widgets. There are no zle tests, though the letter X was reserved for
zle tests. I was wondering if anyone had thought about how this might
be done. I looked at the tests for the completion, and tried to copy
that, though got mired down a little, since I'm not familiar with the
terminal codes. The completion code added xml like tags with zstyle
formatting controls (list-colors, message format, etc) and then parses
that output, though the incremental search widgets don't have that
kind of control.
-FR
How the base function might be refactored:
/*
* doisearch:
* args: (char**) args to search widget
* Currently only first arg is used, given as input to ungetbytes, for
* initial search string.
* dir: (int) direction (-1=reverse, 1= forward)
* is_regex: (int) is search string a regex? (0= No, 1=Yes)
*/
static int
doisearch(char **args, int dir, int is_regex)
{
int action, ret;
struct isearch_globals *isg;
isg = doisearch_init(args, dir);
if (isg == NULL) return 1;
for(;;) {
doisearch_search(isg, is_regex);
doisearch_highlighting(isg);
action = doisearch_handleinput(isg);
if (act == SEARCH_DONE) break;
}
ret = doisearch_cleanup(isg);
return ret;
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author