bsdinstaller / partedit emacs key patch
Daniel O'Connor
doconnor at gsoft.com.au
Wed Mar 30 01:50:31 UTC 2011
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).
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);
+static char *bindings[] = {
+ "* ^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];
TAILQ_INIT(&part_metadata);
init_fstab_metadata();
init_dialog(stdin, stdout);
+
+ for (i = 0; bindings[i] != NULL; i++) {
+ *stpncpy(tmp, bindings[i], sizeof(tmp) - 1) = 0;
+ dlg_parse_bindkey(tmp);
+ }
if (strcmp(basename(argv[0]), "sade") != 0)
dialog_vars.backtitle = __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
More information about the freebsd-current
mailing list