Changeset 112
- Timestamp:
- 10/12/02 00:06:39 (21 years ago)
- Location:
- trunk/j/src/org/armedbear/j
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/j/Dispatcher.java
r23 r112 3 3 * 4 4 * Copyright (C) 1998-2002 Peter Graves 5 * $Id: Dispatcher.java,v 1. 2 2002-10-02 16:32:12piso Exp $5 * $Id: Dispatcher.java,v 1.3 2002-10-12 00:06:39 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 189 189 } 190 190 191 if (editor.lastCommand == COMMAND_PASTE && editor.thisCommand != COMMAND_PASTE) 192 if (editor.thisCommand != COMMAND_UNDO) 193 Editor.promoteLastPaste(); 194 195 editor.lastCommand = editor.thisCommand; 196 editor.thisCommand = COMMAND_NOTHING; 191 final int currentCommand = editor.getCurrentCommand(); 192 if (editor.getLastCommand() == COMMAND_PASTE) 193 if (currentCommand != COMMAND_PASTE) 194 if (currentCommand != COMMAND_UNDO) 195 Editor.promoteLastPaste(); 196 197 editor.setLastCommand(currentCommand); 198 editor.setCurrentCommand(COMMAND_NOTHING); 197 199 198 200 editor.updateSystemSelection(); -
trunk/j/src/org/armedbear/j/Display.java
r2 r112 3 3 * 4 4 * Copyright (C) 1998-2002 Peter Graves 5 * $Id: Display.java,v 1. 1.1.1 2002-09-24 16:08:37piso Exp $5 * $Id: Display.java,v 1.2 2002-10-12 00:06:39 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 1223 1223 if (editor.getMark() == null) 1224 1224 editor.addUndo(SimpleEdit.MOVE); 1225 else if (editor. lastCommand!= COMMAND_UP)1225 else if (editor.getLastCommand() != COMMAND_UP) 1226 1226 editor.addUndo(SimpleEdit.MOVE); 1227 1227 } else { … … 1234 1234 if (isLineBlock) 1235 1235 return; 1236 } else if (editor. lastCommand!= COMMAND_UP)1236 } else if (editor.getLastCommand() != COMMAND_UP) 1237 1237 editor.addUndo(SimpleEdit.MOVE); 1238 1238 } … … 1285 1285 if (editor.getMark() == null) 1286 1286 editor.addUndo(SimpleEdit.MOVE); 1287 else if (editor. lastCommand!= COMMAND_DOWN)1287 else if (editor.getLastCommand() != COMMAND_DOWN) 1288 1288 editor.addUndo(SimpleEdit.MOVE); 1289 1289 } else { … … 1297 1297 return; 1298 1298 } 1299 else if (editor.lastCommand != COMMAND_DOWN) 1300 editor.addUndo(SimpleEdit.MOVE); 1299 else { 1300 if (editor.getLastCommand() != COMMAND_DOWN) { 1301 Log.debug("down calling addUndo(MOVE)"); 1302 editor.addUndo(SimpleEdit.MOVE); 1303 } else 1304 Log.debug("down lastCommand was DOWN"); 1305 } 1301 1306 } 1302 1307 final Line dotLine = editor.getDotLine(); -
trunk/j/src/org/armedbear/j/Editor.java
r110 r112 3 3 * 4 4 * Copyright (C) 1998-2002 Peter Graves 5 * $Id: Editor.java,v 1. 8 2002-10-11 18:32:13piso Exp $5 * $Id: Editor.java,v 1.9 2002-10-12 00:06:39 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 150 150 151 151 // BUG! This stuff should be factored somehow... 152 int thisCommand = COMMAND_NOTHING; 153 int lastCommand = COMMAND_NOTHING; 152 private int currentCommand = COMMAND_NOTHING; 153 private int lastCommand = COMMAND_NOTHING; 154 155 public final int getCurrentCommand() 156 { 157 return currentCommand; 158 } 159 160 public final void setCurrentCommand(int command) 161 { 162 currentCommand = command; 163 } 164 165 public final int getLastCommand() 166 { 167 return lastCommand; 168 } 169 170 public final void setLastCommand(int command) 171 { 172 lastCommand = command; 173 } 154 174 155 175 static Marker[] bookmarks = new Marker[10]; … … 2431 2451 public void recordMacro() 2432 2452 { 2433 if (isRecordingMacro) 2453 if (isRecordingMacro) { 2434 2454 isRecordingMacro = false; 2435 else { 2455 Log.debug("----- recordMacro end -----"); 2456 } else { 2436 2457 if (macro != null && !macro.isEmpty()) 2437 2458 if (!confirm("Record Macro", "Overwrite existing keyboard macro?")) … … 2440 2461 macro = new Macro(); 2441 2462 isRecordingMacro = true; 2463 Log.debug("----- recordMacro -----"); 2442 2464 } 2443 2465 } … … 2470 2492 } else 2471 2493 pageDownInternal(); 2472 thisCommand = COMMAND_PAGE_DOWN;2494 setCurrentCommand(COMMAND_PAGE_DOWN); 2473 2495 } 2474 2496 … … 2486 2508 } else 2487 2509 pageDownInternal(); 2488 thisCommand = COMMAND_PAGE_DOWN;2510 setCurrentCommand(COMMAND_PAGE_DOWN); 2489 2511 } 2490 2512 … … 2503 2525 } else 2504 2526 pageUpInternal(); 2505 thisCommand = COMMAND_PAGE_UP;2527 setCurrentCommand(COMMAND_PAGE_UP); 2506 2528 } 2507 2529 … … 2519 2541 } else 2520 2542 pageUpInternal(); 2521 thisCommand = COMMAND_PAGE_UP;2543 setCurrentCommand(COMMAND_PAGE_UP); 2522 2544 } 2523 2545 … … 2653 2675 if (getDotLine().next() != null) { 2654 2676 moveDotTo(getDotLine().next(), 0); 2655 thisCommand = COMMAND_RIGHT;2677 setCurrentCommand(COMMAND_RIGHT); 2656 2678 } 2657 2679 return; … … 2669 2691 } 2670 2692 updateDotLine(); 2671 thisCommand = COMMAND_RIGHT;2693 setCurrentCommand(COMMAND_RIGHT); 2672 2694 setUpdateFlag(REFRAME); 2673 2695 } … … 2704 2726 } 2705 2727 updateDotLine(); 2706 thisCommand = COMMAND_RIGHT;2728 setCurrentCommand(COMMAND_RIGHT); 2707 2729 setUpdateFlag(REFRAME); 2708 2730 } … … 2741 2763 } 2742 2764 updateDotLine(); 2743 thisCommand = COMMAND_LEFT;2765 setCurrentCommand(COMMAND_LEFT); 2744 2766 setUpdateFlag(REFRAME); 2745 2767 } … … 2780 2802 } 2781 2803 updateDotLine(); 2782 thisCommand = COMMAND_LEFT;2804 setCurrentCommand(COMMAND_LEFT); 2783 2805 setUpdateFlag(REFRAME); 2784 2806 } … … 2820 2842 maybeResetGoalColumn(); 2821 2843 display.down(false); 2822 thisCommand = COMMAND_DOWN;2844 setCurrentCommand(COMMAND_DOWN); 2823 2845 } 2824 2846 … … 2827 2849 maybeResetGoalColumn(); 2828 2850 display.down(true); 2829 thisCommand = COMMAND_DOWN;2851 setCurrentCommand(COMMAND_DOWN); 2830 2852 } 2831 2853 … … 2836 2858 maybeResetGoalColumn(); 2837 2859 display.up(false); 2838 thisCommand = COMMAND_UP;2860 setCurrentCommand(COMMAND_UP); 2839 2861 } 2840 2862 … … 2843 2865 maybeResetGoalColumn(); 2844 2866 display.up(true); 2845 thisCommand = COMMAND_UP;2867 setCurrentCommand(COMMAND_UP); 2846 2868 } 2847 2869 … … 2929 2951 buffer.getCol(pos) != display.getAbsoluteCaretCol()) { 2930 2952 moveDotTo(pos); 2931 thisCommand = COMMAND_HOME;2953 setCurrentCommand(COMMAND_HOME); 2932 2954 return; 2933 2955 } … … 2938 2960 // Timed out. 2939 2961 setUpdateFlag(REFRAME); 2940 thisCommand = COMMAND_HOME;2962 setCurrentCommand(COMMAND_HOME); 2941 2963 return; 2942 2964 } … … 2946 2968 pos = new Position(getTopLine(), 0); 2947 2969 setUpdateFlag(REFRAME); 2948 thisCommand = COMMAND_HOME_HOME;2970 setCurrentCommand(COMMAND_HOME_HOME); 2949 2971 } else { 2950 2972 setUpdateFlag(REFRAME); 2951 thisCommand = COMMAND_HOME;2973 setCurrentCommand(COMMAND_HOME); 2952 2974 return; 2953 2975 } … … 2985 3007 selectToPosition(pos); 2986 3008 setUpdateFlag(REFRAME); 2987 thisCommand = COMMAND_SELECT_HOME;3009 setCurrentCommand(COMMAND_SELECT_HOME); 2988 3010 return; 2989 3011 } … … 2994 3016 // Timed out. 2995 3017 setUpdateFlag(REFRAME); 2996 thisCommand = COMMAND_SELECT_HOME;3018 setCurrentCommand(COMMAND_SELECT_HOME); 2997 3019 return; 2998 3020 } … … 3002 3024 pos = new Position(getTopLine(), 0); 3003 3025 setUpdateFlag(REFRAME); 3004 thisCommand = COMMAND_SELECT_HOME_HOME;3026 setCurrentCommand(COMMAND_SELECT_HOME_HOME); 3005 3027 } else { 3006 3028 setUpdateFlag(REFRAME); 3007 thisCommand = COMMAND_SELECT_HOME;3029 setCurrentCommand(COMMAND_SELECT_HOME); 3008 3030 return; 3009 3031 } … … 3036 3058 moveDotTo(pos); 3037 3059 setUpdateFlag(REFRAME); 3038 thisCommand = COMMAND_END;3060 setCurrentCommand(COMMAND_END); 3039 3061 return; 3040 3062 } … … 3045 3067 // Timed out. 3046 3068 setUpdateFlag(REFRAME); 3047 thisCommand = COMMAND_END;3069 setCurrentCommand(COMMAND_END); 3048 3070 return; 3049 3071 } … … 3057 3079 pos = getEob(); 3058 3080 setUpdateFlag(REFRAME); 3059 thisCommand = COMMAND_END_END;3081 setCurrentCommand(COMMAND_END_END); 3060 3082 } else { 3061 3083 setUpdateFlag(REFRAME); 3062 thisCommand = COMMAND_END;3084 setCurrentCommand(COMMAND_END); 3063 3085 return; 3064 3086 } … … 3082 3104 selectToPosition(pos); 3083 3105 setUpdateFlag(REFRAME); 3084 thisCommand = COMMAND_END;3106 setCurrentCommand(COMMAND_END); 3085 3107 return; 3086 3108 } … … 3091 3113 // Timed out. 3092 3114 setUpdateFlag(REFRAME); 3093 thisCommand = COMMAND_END;3115 setCurrentCommand(COMMAND_END); 3094 3116 return; 3095 3117 } … … 3103 3125 pos = getEob(); 3104 3126 setUpdateFlag(REFRAME); 3105 thisCommand = COMMAND_END_END;3127 setCurrentCommand(COMMAND_END_END); 3106 3128 } else { 3107 thisCommand = COMMAND_END;3129 setCurrentCommand(COMMAND_END); 3108 3130 return; 3109 3131 } … … 5091 5113 else 5092 5114 updateInAllEditors(getDotLine()); 5093 thisCommand = COMMAND_KILL;5115 setCurrentCommand(COMMAND_KILL); 5094 5116 } 5095 5117 setMark(null); … … 5105 5127 killLine(); 5106 5128 endCompoundEdit(compoundEdit); 5107 thisCommand = COMMAND_KILL;5129 setCurrentCommand(COMMAND_KILL); 5108 5130 return; 5109 5131 } … … 5136 5158 moveCaretToDotCol(); 5137 5159 buffer.repaint(); 5138 thisCommand = COMMAND_KILL;5160 setCurrentCommand(COMMAND_KILL); 5139 5161 } 5140 5162 } … … 5146 5168 return; 5147 5169 } 5148 lastCommand = COMMAND_KILL; // Force append.5170 setLastCommand(COMMAND_KILL); // Force append. 5149 5171 killRegion(); 5150 5172 } … … 5308 5330 if (toBeInserted != null) { 5309 5331 paste(toBeInserted); 5310 thisCommand = COMMAND_PASTE;5332 setCurrentCommand(COMMAND_PASTE); 5311 5333 } 5312 5334 setDefaultCursor(); … … 5339 5361 } else 5340 5362 paste(s); 5341 thisCommand = COMMAND_PASTE;5363 setCurrentCommand(COMMAND_PASTE); 5342 5364 } 5343 5365 … … 5356 5378 undo(); 5357 5379 paste(s); 5358 thisCommand = COMMAND_PASTE;5380 setCurrentCommand(COMMAND_PASTE); 5359 5381 } 5360 5382 setDefaultCursor(); … … 6034 6056 buffer.undo(); 6035 6057 checkDotInOtherFrames(); 6036 thisCommand = COMMAND_UNDO;6058 setCurrentCommand(COMMAND_UNDO); 6037 6059 } 6038 6060 catch (Throwable t) { -
trunk/j/src/org/armedbear/j/Expansion.java
r2 r112 3 3 * 4 4 * Copyright (C) 1998-2002 Peter Graves 5 * $Id: Expansion.java,v 1. 1.1.1 2002-09-24 16:09:26piso Exp $5 * $Id: Expansion.java,v 1.2 2002-10-12 00:06:39 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 234 234 { 235 235 final Editor editor = Editor.currentEditor(); 236 if (editor. lastCommand== COMMAND_EXPAND)236 if (editor.getLastCommand() == COMMAND_EXPAND) 237 237 expand(editor, Expansion.getLastExpansion(), true); 238 238 else { … … 278 278 buffer.endCompoundEdit(compoundEdit); 279 279 Editor.updateInAllEditors(line); 280 editor. thisCommand = COMMAND_EXPAND;280 editor.setCurrentCommand(COMMAND_EXPAND); 281 281 } 282 282 finally { -
trunk/j/src/org/armedbear/j/Shell.java
r95 r112 3 3 * 4 4 * Copyright (C) 1998-2002 Peter Graves 5 * $Id: Shell.java,v 1. 5 2002-10-11 13:54:37piso Exp $5 * $Id: Shell.java,v 1.6 2002-10-12 00:06:39 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 293 293 return; 294 294 } 295 if (editor. lastCommand!= COMMAND_HISTORY)295 if (editor.getLastCommand() != COMMAND_HISTORY) 296 296 history.reset(); 297 297 String currentInput = dotLine.getText(); … … 324 324 endCompoundEdit(compoundEdit); 325 325 } 326 editor. thisCommand = COMMAND_HISTORY;326 editor.setCurrentCommand(COMMAND_HISTORY); 327 327 } 328 328
Note: See TracChangeset
for help on using the changeset viewer.