zsh-workers
 help / color / mirror / code / Atom feed
* Adding tests for zle? The missing X series tests
@ 2011-12-20 16:20 Felix Rosencrantz
  2011-12-21 11:39 ` Peter Stephenson
  2011-12-21 16:48 ` Bart Schaefer
  0 siblings, 2 replies; 8+ messages in thread
From: Felix Rosencrantz @ 2011-12-20 16:20 UTC (permalink / raw)
  To: zsh-workers

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;
}


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-01-29 18:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-20 16:20 Adding tests for zle? The missing X series tests Felix Rosencrantz
2011-12-21 11:39 ` Peter Stephenson
2012-01-04 17:38   ` Peter Stephenson
2012-01-09  0:20     ` Felix Rosencrantz
2012-01-09 10:02       ` Peter Stephenson
2012-01-11 16:45         ` Felix Rosencrantz
2012-01-29 18:49       ` Peter Stephenson
2011-12-21 16:48 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).