01: // Copyright (c) 2002 Per M.A. Bothner.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.jemacs.buffer;
05:
06: import gnu.math.IntNum;
07: import gnu.mapping.*;
08:
09: public class SelfInsertCommand extends Procedure0or1 {
10: public Object getProperty(Object key, Object defaultValue) {
11: if (key == "emacs-interactive")
12: return "*p";
13: return super .getProperty(key, defaultValue);
14: }
15:
16: public Object apply0() {
17: apply1(IntNum.one());
18: return Values.empty;
19: }
20:
21: public Object apply1(Object arg1) {
22: int count = ((Number) arg1).intValue();
23: EWindow window = EWindow.getSelected();
24: Buffer buffer = window.buffer;
25:
26: char ch = (char) window.pendingKeys[window.pendingLength];
27: buffer.insert(ch, count);
28: return Values.empty;
29: }
30: }
|