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
10 define_keymap("universal_argument_keymap");
12 interactive("universal-argument",
13 "Begin a numeric argument for the following command.",
15 if (I.prefix_argument) {
16 if (typeof I.prefix_argument == "object") // must be array
17 I.prefix_argument = [I.prefix_argument[0] * 4];
19 I.prefix_argument = [4];
20 I.overlay_keymap = universal_argument_keymap;
24 interactive("universal-digit",
25 "Part of the numeric argument for the next command.",
27 var digit = I.event.charCode - 48;
28 if (I.prefix_argument == null)
29 I.prefix_argument = digit;
30 else if (typeof I.prefix_argument == "object") { // array
31 if (I.prefix_argument[0] < 0)
32 I.prefix_argument = -digit;
34 I.prefix_argument = digit;
36 else if (I.prefix_argument < 0)
37 I.prefix_argument = I.prefix_argument * 10 - digit;
39 I.prefix_argument = I.prefix_argument * 10 + digit;
43 interactive("universal-negate",
44 "Part of the numeric argument for the next command. "+
45 "This command negates the numeric argument.",
46 function universal_negate (I) {
47 if (typeof I.prefix_argument == "object")
48 I.prefix_argument[0] = 0 - I.prefix_argument[0];
50 I.prefix_argument = 0 - I.prefix_argument;
54 provide("universal-argument");