From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6242 invoked by alias); 20 Dec 2011 16:25:40 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30032 Received: (qmail 4808 invoked from network); 20 Dec 2011 16:25:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.213.171 as permitted sender) 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= MIME-Version: 1.0 Date: Tue, 20 Dec 2011 08:20:07 -0800 Message-ID: Subject: Adding tests for zle? The missing X series tests From: Felix Rosencrantz To: zsh-workers@zsh.org Content-Type: text/plain; charset=ISO-8859-1 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; }