From owner-freebsd-current@FreeBSD.ORG Wed Mar 30 01:50:31 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 063B21065674; Wed, 30 Mar 2011 01:50:31 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (unknown [IPv6:2001:44b8:7c07:5581:266:e1ff:fe0c:8f16]) by mx1.freebsd.org (Postfix) with ESMTP id 5BC198FC16; Wed, 30 Mar 2011 01:50:30 +0000 (UTC) Received: from ur.gsoft.com.au (Ur.gsoft.com.au [203.31.81.44]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id p2U1oQjm014341 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 30 Mar 2011 12:20:27 +1030 (CST) (envelope-from doconnor@gsoft.com.au) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1082) From: "Daniel O'Connor" Date: Wed, 30 Mar 2011 12:20:26 +1030 Content-Transfer-Encoding: quoted-printable Message-Id: To: freebsd-current Current X-Mailer: Apple Mail (2.1082) X-Spam-Score: -2.51 () ALL_TRUSTED,BAYES_00,T_RP_MATCHES_RCVD X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: Nathan Whitehorn Subject: bsdinstaller / partedit emacs key patch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2011 01:50:31 -0000 Hi, I noticed that the entry widgets in the bsdinstaller label editor don't = understand various "emacs keys" (eg C-a, C-d, C-e).=20 Here's a patch which adds the basics.. Unfortunately dialog doesn't have = a "key" for delete all, delete left or delete right so I couldn't add = C-u, C-w or C-k. Note that you can't just call dlg_parse_bindkey("* ^a BEGIN") because = dialog modifies the string which crashes (seg fault). --- partedit.c.orig 2011-03-30 01:41:20.000000000 +0000 +++ partedit.c 2011-03-30 01:47:06.000000000 +0000 @@ -50,6 +50,13 @@ static void get_mount_points(struct partedit_item *items, int nitems); static int validate_setup(void); =20 +static char *bindings[] =3D { + "* ^a BEGIN", + "* ^d DELETE_RIGHT", + "* ^e FINAL", + NULL +}; + int main(int argc, const char **argv) { struct partition_metadata *md; @@ -58,12 +65,18 @@ struct gmesh mesh; int i, op, nitems, nscroll; int error; + char tmp[80]; =20 TAILQ_INIT(&part_metadata); =20 init_fstab_metadata(); =20 init_dialog(stdin, stdout); +=09 + for (i =3D 0; bindings[i] !=3D NULL; i++) { + *stpncpy(tmp, bindings[i], sizeof(tmp) - 1) =3D 0; + dlg_parse_bindkey(tmp); + } =20 if (strcmp(basename(argv[0]), "sade") !=3D 0) dialog_vars.backtitle =3D __DECONST(char *, "FreeBSD = Installer"); -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C