diff options
| author | Richard M. Stallman | 1994-03-02 22:51:20 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-03-02 22:51:20 +0000 |
| commit | 0301268e2ba6a1ce8ddf77473e74d1aea856427b (patch) | |
| tree | cd914962bd02b04f65ee2c23aa2c363f4fba4550 | |
| parent | 93b4f6997403fdc595168871276bee651c8c07c6 (diff) | |
| download | emacs-0301268e2ba6a1ce8ddf77473e74d1aea856427b.tar.gz emacs-0301268e2ba6a1ce8ddf77473e74d1aea856427b.zip | |
(menu_bar_items): When moving an item to the end,
shift all the following ones forward one slot.
| -rw-r--r-- | src/keyboard.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index fc9ce849e00..1ea938c654f 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -3558,17 +3558,20 @@ menu_bar_items (old) | |||
| 3558 | for (i = 0; i < end; i += 3) | 3558 | for (i = 0; i < end; i += 3) |
| 3559 | if (EQ (XCONS (tail)->car, XVECTOR (menu_bar_items_vector)->contents[i])) | 3559 | if (EQ (XCONS (tail)->car, XVECTOR (menu_bar_items_vector)->contents[i])) |
| 3560 | { | 3560 | { |
| 3561 | Lisp_Object tem; | 3561 | Lisp_Object tem0, tem1, tem2; |
| 3562 | end -= 3; | 3562 | /* Move the item at index I to the end, |
| 3563 | #define EXCH(a, b) tem = a, a = b, b = tem | 3563 | shifting all the others forward. */ |
| 3564 | EXCH (XVECTOR (menu_bar_items_vector)->contents[i], | 3564 | tem0 = XVECTOR (menu_bar_items_vector)->contents[i + 0]; |
| 3565 | XVECTOR (menu_bar_items_vector)->contents[end]); | 3565 | tem1 = XVECTOR (menu_bar_items_vector)->contents[i + 1]; |
| 3566 | EXCH (XVECTOR (menu_bar_items_vector)->contents[i + 1], | 3566 | tem2 = XVECTOR (menu_bar_items_vector)->contents[i + 2]; |
| 3567 | XVECTOR (menu_bar_items_vector)->contents[end + 1]); | 3567 | if (end > i + 3) |
| 3568 | EXCH (XVECTOR (menu_bar_items_vector)->contents[i + 2], | 3568 | bcopy (&XVECTOR (menu_bar_items_vector)->contents[i + 3], |
| 3569 | XVECTOR (menu_bar_items_vector)->contents[end + 2]); | 3569 | &XVECTOR (menu_bar_items_vector)->contents[i], |
| 3570 | #undef EXCH | 3570 | (end - i - 3) * sizeof (Lisp_Object)); |
| 3571 | i -= 3; | 3571 | XVECTOR (menu_bar_items_vector)->contents[end - 3] = tem0; |
| 3572 | XVECTOR (menu_bar_items_vector)->contents[end - 2] = tem1; | ||
| 3573 | XVECTOR (menu_bar_items_vector)->contents[end - 1] = tem2; | ||
| 3574 | break; | ||
| 3572 | } | 3575 | } |
| 3573 | } | 3576 | } |
| 3574 | 3577 | ||