2 * (C) Copyright 2004-2007 Shawn Betts
3 * (C) Copyright 2007-2008 Jeremy Maitin-Shepard
4 * (C) Copyright 2008 John Foerch
6 * Use, modification, and distribution are subject to the terms specified in the
12 define_keymap("universal_argument_keymap");
14 interactive("universal-argument",
15 "Begin a numeric argument for the following command.",
17 if (I.prefix_argument) {
18 if (typeof I.prefix_argument == "object") // must be array
19 I.prefix_argument = [I.prefix_argument[0] * 4];
21 I.prefix_argument = [4];
22 I.overlay_keymap = universal_argument_keymap;
26 interactive("universal-digit",
27 "Part of the numeric argument for the next command.",
29 var digit = I.event.charCode - 48;
30 if (I.prefix_argument == null)
31 I.prefix_argument = digit;
32 else if (typeof I.prefix_argument == "object") { // array
33 if (I.prefix_argument[0] < 0)
34 I.prefix_argument = -digit;
36 I.prefix_argument = digit;
38 else if (I.prefix_argument < 0)
39 I.prefix_argument = I.prefix_argument * 10 - digit;
41 I.prefix_argument = I.prefix_argument * 10 + digit;
45 interactive("universal-negate",
46 "Part of the numeric argument for the next command. "+
47 "This command negates the numeric argument.",
48 function universal_negate (I) {
49 if (typeof I.prefix_argument == "object")
50 I.prefix_argument[0] = 0 - I.prefix_argument[0];
52 I.prefix_argument = 0 - I.prefix_argument;
56 provide("universal-argument");