OSDN Git Service

47888e3b0c1ce59bea68824f8ea4d62f39574bfc
[splhack/MacPorts.git] / editors / vim-app / files / patch-gui_mac.m
1 --- src/gui_mac.m.orig
2 +++ src/gui_mac.m
3 @@ -21,6 +21,7 @@
4  
5  #include "vim.h"
6  #import <Cocoa/Cocoa.h>
7 +#import <Carbon/Carbon.h>
8  #import <PSMTabBarControl/PSMTabBarControl.h>
9  
10  #define GUI_MAC_DEBUG     1
11 @@ -102,7 +102,7 @@
12  
13  #define FF_Y(row)               (gui_mac.main_height - FILL_Y(row))
14  #define FT_Y(row)               (gui_mac.main_height - TEXT_Y(row))
15 -#define VIM_BG_ALPHA            ((100 - p_transp) / 100.0)
16 +#define VIM_BG_ALPHA            (p_transp / 255.0)
17  
18  /* A simple view to make setting text area, scrollbar position inside 
19   * vim window easier */
20 @@ -546,16 +547,24 @@
21  
22  /* Input Method Handling {{{ */
23  
24 +#if defined(FEAT_UIMFEP)
25 +int gui_im_get_status()
26 +#else // FEAT_UIMFEP
27  int im_get_status()
28 +#endif // FEAT_UIMFEP
29  {
30 -    if (! gui.in_use)
31 -            return 0;
32 -
33 -    return 0;
34 +       SInt32 script = GetScriptManagerVariable(smKeyScript);
35 +       return (script != smRoman
36 +               && script == GetScriptManagerVariable(smSysScript)) ? 1 : 0;
37  }
38  
39 +#if defined(FEAT_UIMFEP)
40 +void gui_im_set_active(int active)
41 +#else // FEAT_UIMFEP
42  void im_set_active(int active)
43 +#endif // FEAT_UIMFEP
44  {
45 +       KeyScript(active ? smKeySysScript : smKeyRoman);
46  }
47  
48  void im_set_position(int row, int col)
49 @@ -2835,6 +2844,13 @@
50  
51      if (markedRange.length > 0)
52      {
53 +               int idx = syn_name2id((char_u *)"IMLine");
54 +               [self setMarkedTextAttribute:NSColorFromGuiColor(
55 +                       highlight_gui_color_rgb(idx, TRUE), 1.0)
56 +                       forKey:NSBackgroundColorAttributeName];
57 +               [self setMarkedTextAttribute:NSColorFromGuiColor(
58 +                       highlight_gui_color_rgb(idx, FALSE), 1.0)
59 +                       forKey:NSForegroundColorAttributeName];
60      } else
61      {
62          // gui_mac_msg(MSG_DEBUG, @"clear markedText");
63 @@ -3244,6 +3260,8 @@
64          default:
65              if (vim_modifiers & MOD_MASK_CTRL)
66              {
67 +                               if (original_char == 'h' && [self hasMarkedText])
68 +                                       goto insert_text;
69                  result[len++] = modified_char;
70                  add_to_input_buf(result, len);
71                  // gui_mac_msg(MSG_DEBUG, @"CTRL-%c, add_to_input_buf: %d", original_char, len);