Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Mar 2011 12:20:26 +1030
From:      "Daniel O'Connor" <doconnor@gsoft.com.au>
To:        freebsd-current Current <freebsd-current@freebsd.org>
Cc:        Nathan Whitehorn <nwhitehorn@freebsd.org>
Subject:   bsdinstaller / partedit emacs key patch
Message-ID:  <DACD4C80-343E-4274-8F15-06C9FA865061@gsoft.com.au>

next in thread | raw e-mail | index | archive | help
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









Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DACD4C80-343E-4274-8F15-06C9FA865061>