|
Karsten Hopp |
01e605 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
01e605 |
Subject: Patch 7.0.138 (extra)
|
|
Karsten Hopp |
01e605 |
Fcc: outbox
|
|
Karsten Hopp |
01e605 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
01e605 |
Mime-Version: 1.0
|
|
Karsten Hopp |
01e605 |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
01e605 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
01e605 |
------------
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
Patch 7.0.138 (extra)
|
|
Karsten Hopp |
01e605 |
Problem: Mac: modifiers don't work with function keys.
|
|
Karsten Hopp |
01e605 |
Solution: Use GetEventParameter() to obtain modifiers. (Nicolas Weber)
|
|
Karsten Hopp |
01e605 |
Files: src/gui_mac.c
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
*** ../vim-7.0.137/src/gui_mac.c Tue Aug 22 21:39:18 2006
|
|
Karsten Hopp |
01e605 |
--- src/gui_mac.c Sun Oct 15 14:53:38 2006
|
|
Karsten Hopp |
01e605 |
***************
|
|
Karsten Hopp |
01e605 |
*** 2014,2020 ****
|
|
Karsten Hopp |
01e605 |
void *data)
|
|
Karsten Hopp |
01e605 |
{
|
|
Karsten Hopp |
01e605 |
/* Multibyte-friendly key event handler */
|
|
Karsten Hopp |
01e605 |
! OSStatus e = -1;
|
|
Karsten Hopp |
01e605 |
UInt32 actualSize;
|
|
Karsten Hopp |
01e605 |
UniChar *text;
|
|
Karsten Hopp |
01e605 |
char_u result[INLINE_KEY_BUFFER_SIZE];
|
|
Karsten Hopp |
01e605 |
--- 2014,2020 ----
|
|
Karsten Hopp |
01e605 |
void *data)
|
|
Karsten Hopp |
01e605 |
{
|
|
Karsten Hopp |
01e605 |
/* Multibyte-friendly key event handler */
|
|
Karsten Hopp |
01e605 |
! OSStatus err = -1;
|
|
Karsten Hopp |
01e605 |
UInt32 actualSize;
|
|
Karsten Hopp |
01e605 |
UniChar *text;
|
|
Karsten Hopp |
01e605 |
char_u result[INLINE_KEY_BUFFER_SIZE];
|
|
Karsten Hopp |
01e605 |
***************
|
|
Karsten Hopp |
01e605 |
*** 2022,2195 ****
|
|
Karsten Hopp |
01e605 |
UInt32 key_sym;
|
|
Karsten Hopp |
01e605 |
char charcode;
|
|
Karsten Hopp |
01e605 |
int key_char;
|
|
Karsten Hopp |
01e605 |
! UInt32 modifiers;
|
|
Karsten Hopp |
01e605 |
size_t encLen;
|
|
Karsten Hopp |
01e605 |
char_u *to = NULL;
|
|
Karsten Hopp |
01e605 |
Boolean isSpecial = FALSE;
|
|
Karsten Hopp |
01e605 |
int i;
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
/* Mask the mouse (as per user setting) */
|
|
Karsten Hopp |
01e605 |
if (p_mh)
|
|
Karsten Hopp |
01e605 |
ObscureCursor();
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! do
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! /* Don't use the keys when the dialog wants them. */
|
|
Karsten Hopp |
01e605 |
! if (dialog_busy)
|
|
Karsten Hopp |
01e605 |
! break;
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! if (noErr != GetEventParameter(theEvent, kEventParamTextInputSendText,
|
|
Karsten Hopp |
01e605 |
! typeUnicodeText, NULL, 0, &actualSize, NULL))
|
|
Karsten Hopp |
01e605 |
! break;
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! text = (UniChar *)alloc(actualSize);
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! if (text)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! do
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! if (noErr != GetEventParameter(theEvent,
|
|
Karsten Hopp |
01e605 |
! kEventParamTextInputSendText,
|
|
Karsten Hopp |
01e605 |
! typeUnicodeText, NULL, actualSize, NULL, text))
|
|
Karsten Hopp |
01e605 |
! break;
|
|
Karsten Hopp |
01e605 |
! EventRef keyEvent;
|
|
Karsten Hopp |
01e605 |
! if (noErr != GetEventParameter(theEvent,
|
|
Karsten Hopp |
01e605 |
! kEventParamTextInputSendKeyboardEvent,
|
|
Karsten Hopp |
01e605 |
! typeEventRef, NULL, sizeof(EventRef), NULL, &keyEvent))
|
|
Karsten Hopp |
01e605 |
! break;
|
|
Karsten Hopp |
01e605 |
! if (noErr != GetEventParameter(keyEvent,
|
|
Karsten Hopp |
01e605 |
! kEventParamKeyModifiers,
|
|
Karsten Hopp |
01e605 |
! typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers))
|
|
Karsten Hopp |
01e605 |
! break;
|
|
Karsten Hopp |
01e605 |
! if (noErr != GetEventParameter(keyEvent,
|
|
Karsten Hopp |
01e605 |
! kEventParamKeyCode,
|
|
Karsten Hopp |
01e605 |
! typeUInt32, NULL, sizeof(UInt32), NULL, &key_sym))
|
|
Karsten Hopp |
01e605 |
! break;
|
|
Karsten Hopp |
01e605 |
! if (noErr != GetEventParameter(keyEvent,
|
|
Karsten Hopp |
01e605 |
! kEventParamKeyMacCharCodes,
|
|
Karsten Hopp |
01e605 |
! typeChar, NULL, sizeof(char), NULL, &charcode))
|
|
Karsten Hopp |
01e605 |
! break;
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! key_char = charcode;
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! if (modifiers & controlKey)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! if ((modifiers & ~(controlKey|shiftKey)) == 0
|
|
Karsten Hopp |
01e605 |
! && (key_char == '2' || key_char == '6'))
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! /* CTRL-^ and CTRL-@ don't work in the normal way. */
|
|
Karsten Hopp |
01e605 |
! if (key_char == '2')
|
|
Karsten Hopp |
01e605 |
! key_char = Ctrl_AT;
|
|
Karsten Hopp |
01e605 |
! else
|
|
Karsten Hopp |
01e605 |
! key_char = Ctrl_HAT;
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! text[0] = (UniChar)key_char;
|
|
Karsten Hopp |
01e605 |
! modifiers = 0;
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! if (modifiers & cmdKey)
|
|
Karsten Hopp |
01e605 |
! #ifndef USE_CMD_KEY
|
|
Karsten Hopp |
01e605 |
! break; /* Let system handle Cmd+... */
|
|
Karsten Hopp |
01e605 |
! #else
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! /* Intercept CMD-. */
|
|
Karsten Hopp |
01e605 |
! if (key_char == '.')
|
|
Karsten Hopp |
01e605 |
! got_int = TRUE;
|
|
Karsten Hopp |
01e605 |
!
|
|
Karsten Hopp |
01e605 |
! /* Convert the modifiers */
|
|
Karsten Hopp |
01e605 |
! modifiers = EventModifiers2VimModifiers(modifiers);
|
|
Karsten Hopp |
01e605 |
!
|
|
Karsten Hopp |
01e605 |
! /* Following code to simplify and consolidate modifiers
|
|
Karsten Hopp |
01e605 |
! * taken liberally from gui_w48.c */
|
|
Karsten Hopp |
01e605 |
!
|
|
Karsten Hopp |
01e605 |
! key_char = simplify_key(key_char, (int *)&modifiers);
|
|
Karsten Hopp |
01e605 |
!
|
|
Karsten Hopp |
01e605 |
! /* remove SHIFT for keys that are already shifted, e.g.,
|
|
Karsten Hopp |
01e605 |
! * '(' and '*' */
|
|
Karsten Hopp |
01e605 |
! if (key_char < 0x100 &&
|
|
Karsten Hopp |
01e605 |
! !isalpha(key_char) && isprint(key_char))
|
|
Karsten Hopp |
01e605 |
! modifiers &= ~MOD_MASK_SHIFT;
|
|
Karsten Hopp |
01e605 |
!
|
|
Karsten Hopp |
01e605 |
! /* Interpret META, include SHIFT, etc. */
|
|
Karsten Hopp |
01e605 |
! key_char = extract_modifiers(key_char, (int *)&modifiers);
|
|
Karsten Hopp |
01e605 |
! if (key_char == CSI)
|
|
Karsten Hopp |
01e605 |
! key_char = K_CSI;
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! if (modifiers)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! result[len++] = CSI;
|
|
Karsten Hopp |
01e605 |
! result[len++] = KS_MODIFIER;
|
|
Karsten Hopp |
01e605 |
! result[len++] = modifiers;
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! isSpecial = TRUE;
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! #endif
|
|
Karsten Hopp |
01e605 |
! else
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! /* Find the special key (eg., for cursor keys) */
|
|
Karsten Hopp |
01e605 |
! if (!(actualSize > sizeof(UniChar)) &&
|
|
Karsten Hopp |
01e605 |
! ((text[0] < 0x20) || (text[0] == 0x7f)))
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! for (i = 0; special_keys[i].key_sym != (KeySym)0; ++i)
|
|
Karsten Hopp |
01e605 |
! if (special_keys[i].key_sym == key_sym)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! key_char = TO_SPECIAL(special_keys[i].vim_code0,
|
|
Karsten Hopp |
01e605 |
! special_keys[i].vim_code1);
|
|
Karsten Hopp |
01e605 |
! key_char = simplify_key(key_char,
|
|
Karsten Hopp |
01e605 |
! (int *)&modifiers);
|
|
Karsten Hopp |
01e605 |
! isSpecial = TRUE;
|
|
Karsten Hopp |
01e605 |
! break;
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! if (isSpecial && IS_SPECIAL(key_char))
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! result[len++] = CSI;
|
|
Karsten Hopp |
01e605 |
! result[len++] = K_SECOND(key_char);
|
|
Karsten Hopp |
01e605 |
! result[len++] = K_THIRD(key_char);
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! else
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! encLen = actualSize;
|
|
Karsten Hopp |
01e605 |
! to = mac_utf16_to_enc(text, actualSize, &encLen);
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! if (to)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! /* This is basically add_to_input_buf_csi() */
|
|
Karsten Hopp |
01e605 |
! for (i = 0; i < encLen && len < (INLINE_KEY_BUFFER_SIZE-1); ++i)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! result[len++] = to[i];
|
|
Karsten Hopp |
01e605 |
! if (to[i] == CSI)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! result[len++] = KS_EXTRA;
|
|
Karsten Hopp |
01e605 |
! result[len++] = (int)KE_CSI;
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! vim_free(to);
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! add_to_input_buf(result, len);
|
|
Karsten Hopp |
01e605 |
! e = noErr;
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! while (0);
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! vim_free(text);
|
|
Karsten Hopp |
01e605 |
! if (e == noErr)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! /* Fake event to wake up WNE (required to get
|
|
Karsten Hopp |
01e605 |
! * key repeat working */
|
|
Karsten Hopp |
01e605 |
! PostEvent(keyUp, 0);
|
|
Karsten Hopp |
01e605 |
! return noErr;
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
}
|
|
Karsten Hopp |
01e605 |
- while (0);
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! return CallNextEventHandler(nextHandler, theEvent);
|
|
Karsten Hopp |
01e605 |
}
|
|
Karsten Hopp |
01e605 |
#else
|
|
Karsten Hopp |
01e605 |
void
|
|
Karsten Hopp |
01e605 |
--- 2022,2174 ----
|
|
Karsten Hopp |
01e605 |
UInt32 key_sym;
|
|
Karsten Hopp |
01e605 |
char charcode;
|
|
Karsten Hopp |
01e605 |
int key_char;
|
|
Karsten Hopp |
01e605 |
! UInt32 modifiers, vimModifiers;
|
|
Karsten Hopp |
01e605 |
size_t encLen;
|
|
Karsten Hopp |
01e605 |
char_u *to = NULL;
|
|
Karsten Hopp |
01e605 |
Boolean isSpecial = FALSE;
|
|
Karsten Hopp |
01e605 |
int i;
|
|
Karsten Hopp |
01e605 |
+ EventRef keyEvent;
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
/* Mask the mouse (as per user setting) */
|
|
Karsten Hopp |
01e605 |
if (p_mh)
|
|
Karsten Hopp |
01e605 |
ObscureCursor();
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! /* Don't use the keys when the dialog wants them. */
|
|
Karsten Hopp |
01e605 |
! if (dialog_busy)
|
|
Karsten Hopp |
01e605 |
! return eventNotHandledErr;
|
|
Karsten Hopp |
01e605 |
!
|
|
Karsten Hopp |
01e605 |
! if (noErr != GetEventParameter(theEvent, kEventParamTextInputSendText,
|
|
Karsten Hopp |
01e605 |
! typeUnicodeText, NULL, 0, &actualSize, NULL))
|
|
Karsten Hopp |
01e605 |
! return eventNotHandledErr;
|
|
Karsten Hopp |
01e605 |
!
|
|
Karsten Hopp |
01e605 |
! text = (UniChar *)alloc(actualSize);
|
|
Karsten Hopp |
01e605 |
! if (!text)
|
|
Karsten Hopp |
01e605 |
! return eventNotHandledErr;
|
|
Karsten Hopp |
01e605 |
!
|
|
Karsten Hopp |
01e605 |
! err = GetEventParameter(theEvent, kEventParamTextInputSendText,
|
|
Karsten Hopp |
01e605 |
! typeUnicodeText, NULL, actualSize, NULL, text);
|
|
Karsten Hopp |
01e605 |
! require_noerr(err, done);
|
|
Karsten Hopp |
01e605 |
!
|
|
Karsten Hopp |
01e605 |
! err = GetEventParameter(theEvent, kEventParamTextInputSendKeyboardEvent,
|
|
Karsten Hopp |
01e605 |
! typeEventRef, NULL, sizeof(EventRef), NULL, &keyEvent);
|
|
Karsten Hopp |
01e605 |
! require_noerr(err, done);
|
|
Karsten Hopp |
01e605 |
!
|
|
Karsten Hopp |
01e605 |
! err = GetEventParameter(keyEvent, kEventParamKeyModifiers,
|
|
Karsten Hopp |
01e605 |
! typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
|
Karsten Hopp |
01e605 |
! require_noerr(err, done);
|
|
Karsten Hopp |
01e605 |
!
|
|
Karsten Hopp |
01e605 |
! err = GetEventParameter(keyEvent, kEventParamKeyCode,
|
|
Karsten Hopp |
01e605 |
! typeUInt32, NULL, sizeof(UInt32), NULL, &key_sym);
|
|
Karsten Hopp |
01e605 |
! require_noerr(err, done);
|
|
Karsten Hopp |
01e605 |
!
|
|
Karsten Hopp |
01e605 |
! err = GetEventParameter(keyEvent, kEventParamKeyMacCharCodes,
|
|
Karsten Hopp |
01e605 |
! typeChar, NULL, sizeof(char), NULL, &charcode);
|
|
Karsten Hopp |
01e605 |
! require_noerr(err, done);
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! #ifndef USE_CMD_KEY
|
|
Karsten Hopp |
01e605 |
! if (modifiers & cmdKey)
|
|
Karsten Hopp |
01e605 |
! goto done; /* Let system handle Cmd+... */
|
|
Karsten Hopp |
01e605 |
! #endif
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! key_char = charcode;
|
|
Karsten Hopp |
01e605 |
! vimModifiers = EventModifiers2VimModifiers(modifiers);
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! /* Find the special key (eg., for cursor keys) */
|
|
Karsten Hopp |
01e605 |
! if (actualSize <= sizeof(UniChar) &&
|
|
Karsten Hopp |
01e605 |
! ((text[0] < 0x20) || (text[0] == 0x7f)))
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! for (i = 0; special_keys[i].key_sym != (KeySym)0; ++i)
|
|
Karsten Hopp |
01e605 |
! if (special_keys[i].key_sym == key_sym)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! key_char = TO_SPECIAL(special_keys[i].vim_code0,
|
|
Karsten Hopp |
01e605 |
! special_keys[i].vim_code1);
|
|
Karsten Hopp |
01e605 |
! key_char = simplify_key(key_char,
|
|
Karsten Hopp |
01e605 |
! (int *)&vimModifiers);
|
|
Karsten Hopp |
01e605 |
! isSpecial = TRUE;
|
|
Karsten Hopp |
01e605 |
! break;
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! /* Intercept CMD-. and CTRL-c */
|
|
Karsten Hopp |
01e605 |
! if (((modifiers & controlKey) && key_char == 'c') ||
|
|
Karsten Hopp |
01e605 |
! ((modifiers & cmdKey) && key_char == '.'))
|
|
Karsten Hopp |
01e605 |
! got_int = TRUE;
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! if (!isSpecial)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! /* remove SHIFT for keys that are already shifted, e.g.,
|
|
Karsten Hopp |
01e605 |
! * '(' and '*' */
|
|
Karsten Hopp |
01e605 |
! if (key_char < 0x100 && !isalpha(key_char) && isprint(key_char))
|
|
Karsten Hopp |
01e605 |
! vimModifiers &= ~MOD_MASK_SHIFT;
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! /* remove CTRL from keys that already have it */
|
|
Karsten Hopp |
01e605 |
! if (key_char < 0x20)
|
|
Karsten Hopp |
01e605 |
! vimModifiers &= ~MOD_MASK_CTRL;
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! /* don't process unicode characters here */
|
|
Karsten Hopp |
01e605 |
! if (!IS_SPECIAL(key_char))
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! /* Following code to simplify and consolidate vimModifiers
|
|
Karsten Hopp |
01e605 |
! * taken liberally from gui_w48.c */
|
|
Karsten Hopp |
01e605 |
! key_char = simplify_key(key_char, (int *)&vimModifiers);
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! /* Interpret META, include SHIFT, etc. */
|
|
Karsten Hopp |
01e605 |
! key_char = extract_modifiers(key_char, (int *)&vimModifiers);
|
|
Karsten Hopp |
01e605 |
! if (key_char == CSI)
|
|
Karsten Hopp |
01e605 |
! key_char = K_CSI;
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! if (IS_SPECIAL(key_char))
|
|
Karsten Hopp |
01e605 |
! isSpecial = TRUE;
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! if (vimModifiers)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! result[len++] = CSI;
|
|
Karsten Hopp |
01e605 |
! result[len++] = KS_MODIFIER;
|
|
Karsten Hopp |
01e605 |
! result[len++] = vimModifiers;
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! if (isSpecial && IS_SPECIAL(key_char))
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! result[len++] = CSI;
|
|
Karsten Hopp |
01e605 |
! result[len++] = K_SECOND(key_char);
|
|
Karsten Hopp |
01e605 |
! result[len++] = K_THIRD(key_char);
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! else
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! encLen = actualSize;
|
|
Karsten Hopp |
01e605 |
! to = mac_utf16_to_enc(text, actualSize, &encLen);
|
|
Karsten Hopp |
01e605 |
! if (to)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! /* This is basically add_to_input_buf_csi() */
|
|
Karsten Hopp |
01e605 |
! for (i = 0; i < encLen && len < (INLINE_KEY_BUFFER_SIZE-1); ++i)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! result[len++] = to[i];
|
|
Karsten Hopp |
01e605 |
! if (to[i] == CSI)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! result[len++] = KS_EXTRA;
|
|
Karsten Hopp |
01e605 |
! result[len++] = (int)KE_CSI;
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! vim_free(to);
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
! }
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! add_to_input_buf(result, len);
|
|
Karsten Hopp |
01e605 |
! err = noErr;
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! done:
|
|
Karsten Hopp |
01e605 |
! vim_free(text);
|
|
Karsten Hopp |
01e605 |
! if (err == noErr)
|
|
Karsten Hopp |
01e605 |
! {
|
|
Karsten Hopp |
01e605 |
! /* Fake event to wake up WNE (required to get
|
|
Karsten Hopp |
01e605 |
! * key repeat working */
|
|
Karsten Hopp |
01e605 |
! PostEvent(keyUp, 0);
|
|
Karsten Hopp |
01e605 |
! return noErr;
|
|
Karsten Hopp |
01e605 |
}
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
! return eventNotHandledErr;
|
|
Karsten Hopp |
01e605 |
}
|
|
Karsten Hopp |
01e605 |
#else
|
|
Karsten Hopp |
01e605 |
void
|
|
Karsten Hopp |
01e605 |
***************
|
|
Karsten Hopp |
01e605 |
*** 5748,5754 ****
|
|
Karsten Hopp |
01e605 |
/* TODO: Get the text selection from Vim */
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
/* Call to Handle Popup */
|
|
Karsten Hopp |
01e605 |
! status = ContextualMenuSelect(CntxMenu, where, false, kCMHelpItemNoHelp, HelpName, NULL, &CntxType, &CntxMenuID, &CntxMenuItem);
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
if (status == noErr)
|
|
Karsten Hopp |
01e605 |
{
|
|
Karsten Hopp |
01e605 |
--- 5727,5734 ----
|
|
Karsten Hopp |
01e605 |
/* TODO: Get the text selection from Vim */
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
/* Call to Handle Popup */
|
|
Karsten Hopp |
01e605 |
! status = ContextualMenuSelect(CntxMenu, where, false, kCMHelpItemNoHelp,
|
|
Karsten Hopp |
01e605 |
! HelpName, NULL, &CntxType, &CntxMenuID, &CntxMenuItem);
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
if (status == noErr)
|
|
Karsten Hopp |
01e605 |
{
|
|
Karsten Hopp |
01e605 |
***************
|
|
Karsten Hopp |
01e605 |
*** 5756,5762 ****
|
|
Karsten Hopp |
01e605 |
{
|
|
Karsten Hopp |
01e605 |
/* Handle the menu CntxMenuID, CntxMenuItem */
|
|
Karsten Hopp |
01e605 |
/* The submenu can be handle directly by gui_mac_handle_menu */
|
|
Karsten Hopp |
01e605 |
! /* But what about the current menu, is the menu changed by ContextualMenuSelect */
|
|
Karsten Hopp |
01e605 |
gui_mac_handle_menu((CntxMenuID << 16) + CntxMenuItem);
|
|
Karsten Hopp |
01e605 |
}
|
|
Karsten Hopp |
01e605 |
else if (CntxMenuID == kCMShowHelpSelected)
|
|
Karsten Hopp |
01e605 |
--- 5736,5743 ----
|
|
Karsten Hopp |
01e605 |
{
|
|
Karsten Hopp |
01e605 |
/* Handle the menu CntxMenuID, CntxMenuItem */
|
|
Karsten Hopp |
01e605 |
/* The submenu can be handle directly by gui_mac_handle_menu */
|
|
Karsten Hopp |
01e605 |
! /* But what about the current menu, is the menu changed by
|
|
Karsten Hopp |
01e605 |
! * ContextualMenuSelect */
|
|
Karsten Hopp |
01e605 |
gui_mac_handle_menu((CntxMenuID << 16) + CntxMenuItem);
|
|
Karsten Hopp |
01e605 |
}
|
|
Karsten Hopp |
01e605 |
else if (CntxMenuID == kCMShowHelpSelected)
|
|
Karsten Hopp |
01e605 |
*** ../vim-7.0.137/src/version.c Tue Oct 17 11:50:45 2006
|
|
Karsten Hopp |
01e605 |
--- src/version.c Tue Oct 17 12:51:21 2006
|
|
Karsten Hopp |
01e605 |
***************
|
|
Karsten Hopp |
01e605 |
*** 668,669 ****
|
|
Karsten Hopp |
01e605 |
--- 668,671 ----
|
|
Karsten Hopp |
01e605 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
01e605 |
+ /**/
|
|
Karsten Hopp |
01e605 |
+ 138,
|
|
Karsten Hopp |
01e605 |
/**/
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
--
|
|
Karsten Hopp |
01e605 |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
01e605 |
52. You ask a plumber how much it would cost to replace the chair in front of
|
|
Karsten Hopp |
01e605 |
your computer with a toilet.
|
|
Karsten Hopp |
01e605 |
|
|
Karsten Hopp |
01e605 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
01e605 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
01e605 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
01e605 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|