Add support for +xim

Inline marked text editing, underline marked text (even on command
line), etc.
This commit is contained in:
Bjorn Winckler
2009-08-09 19:12:10 +02:00
parent 271ef88821
commit 507a68ef81
13 changed files with 162 additions and 78 deletions
+13 -18
View File
@@ -56,6 +56,11 @@ vimmenu_T *menu_for_descriptor(NSArray *desc);
static id evalExprCocoa(NSString * expr, NSString ** errstr);
#ifndef USE_OLD_IM
extern void im_preedit_start_macvim();
extern void im_preedit_end_macvim();
extern void im_preedit_changed_macvim(char *preedit_string, int cursor_index);
#endif
enum {
MMBlinkStateNone = 0,
@@ -2768,32 +2773,22 @@ static void netbeansReadCallback(CFSocketRef s,
#ifndef USE_OLD_IM
int numMarkedChars = 0;
colnr_T preedit_start_col = MAXCOL;
- (void)handleMarkedText:(NSData *)data
{
const void *bytes = [data bytes];
unsigned pos = *((unsigned*)bytes); bytes += sizeof(unsigned);
unsigned len = *((unsigned*)bytes); bytes += sizeof(unsigned);
char_u *chars = (char_u *)bytes;
char *chars = (char *)bytes;
//ASLogTmp(@"num=%d len=%d chars=%s", numMarkedChars, len, chars);
ASLogDebug(@"pos=%d len=%d chars=%s", pos, len, chars);
if (numMarkedChars > 0) {
for (; numMarkedChars > 0; --numMarkedChars)
add_to_input_buf((char_u*)"\x9bkb",3);
if (len == 0) {
im_preedit_end_macvim();
} else {
getvcol(curwin, &curwin->w_cursor, &preedit_start_col, NULL, NULL);
}
if (!preedit_get_status())
im_preedit_start_macvim();
if (len > 0) {
add_to_input_buf(chars, len);
numMarkedChars = MB_CHARLEN(chars);
//ASLogTmp(@"added chars, num=%d", numMarkedChars);
if (numMarkedChars < 0)
numMarkedChars = 0;
} else {
preedit_start_col = MAXCOL;
im_preedit_changed_macvim(chars, pos);
}
}
+54 -16
View File
@@ -42,6 +42,8 @@ static float MMDragAreaSize = 73.0f;
- (void)dragTimerFired:(NSTimer *)timer;
- (void)setCursor;
- (NSRect)trackingRect;
- (BOOL)inputManagerHandleMouseEvent:(NSEvent *)event;
- (void)sendMarkedText:(NSString *)text position:(unsigned)pos;
@end
@@ -184,12 +186,7 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
{
if ([self hasMarkedText]) {
// Clear marked text
NSMutableData *data = [NSMutableData data];
unsigned len = 0;
[data appendBytes:&len length:sizeof(unsigned)];
[data appendBytes:"\x00" length:1];
[[self vimController] sendMessage:SetMarkedTextMsgID data:data];
[self sendMarkedText:nil position:0];
// NOTE: If this call is left out then the marked text isn't properly
// erased when Return is used to accept the text.
@@ -304,6 +301,14 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
- (void)scrollWheel:(NSEvent *)event
{
if ([self hasMarkedText]) {
// We must clear the marked text since the cursor may move if the
// marked text moves outside the view as a result of scrolling.
[self sendMarkedText:nil position:0];
[self unmarkText];
[[NSInputManager currentInputManager] markedTextAbandoned:self];
}
if ([event deltaY] == 0)
return;
@@ -325,6 +330,9 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
- (void)mouseDown:(NSEvent *)event
{
if ([self inputManagerHandleMouseEvent:event])
return;
int row, col;
NSPoint pt = [textView convertPoint:[event locationInWindow] fromView:nil];
if (![textView convertPoint:pt toRow:&row column:&col])
@@ -357,6 +365,9 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
- (void)mouseUp:(NSEvent *)event
{
if ([self inputManagerHandleMouseEvent:event])
return;
int row, col;
NSPoint pt = [textView convertPoint:[event locationInWindow] fromView:nil];
if (![textView convertPoint:pt toRow:&row column:&col])
@@ -376,6 +387,9 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
- (void)mouseDragged:(NSEvent *)event
{
if ([self inputManagerHandleMouseEvent:event])
return;
int flags = [event modifierFlags];
int row, col;
NSPoint pt = [textView convertPoint:[event locationInWindow] fromView:nil];
@@ -406,6 +420,9 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
- (void)mouseMoved:(NSEvent *)event
{
if ([self inputManagerHandleMouseEvent:event])
return;
// HACK! NSTextView has a nasty habit of resetting the cursor to the
// default I-beam cursor at random moments. The only reliable way we know
// of to work around this is to set the cursor each time the mouse moves.
@@ -659,16 +676,7 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
imRange = range;
}
NSMutableData *data = [NSMutableData data];
unsigned len = [text lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
[data appendBytes:&len length:sizeof(unsigned)];
if (len > 0) {
[data appendBytes:[text UTF8String] length:len];
[data appendBytes:"\x00" length:1];
}
[[self vimController] sendMessage:SetMarkedTextMsgID data:data];
[self sendMarkedText:text position:range.location];
#endif
}
@@ -1083,4 +1091,34 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
return rect;
}
- (BOOL)inputManagerHandleMouseEvent:(NSEvent *)event
{
// NOTE: The input manager usually handles events like mouse clicks (e.g.
// the Kotoeri manager "commits" the text on left clicks).
if (event) {
NSInputManager *imgr = [NSInputManager currentInputManager];
if ([imgr wantsToHandleMouseEvents])
return [imgr handleMouseEvent:event];
}
return NO;
}
- (void)sendMarkedText:(NSString *)text position:(unsigned)pos
{
NSMutableData *data = [NSMutableData data];
unsigned len = text == nil ? 0
: [text lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
[data appendBytes:&pos length:sizeof(unsigned)];
[data appendBytes:&len length:sizeof(unsigned)];
if (len > 0) {
[data appendBytes:[text UTF8String] length:len];
[data appendBytes:"\x00" length:1];
}
[[self vimController] sendMessage:SetMarkedTextMsgID data:data];
}
@end // MMTextViewHelper (Private)
+1 -1
View File
@@ -8898,7 +8898,7 @@ ins_left()
tpos = curwin->w_cursor;
if (oneleft() == OK)
{
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
/* Only call start_arrow() when not busy with preediting, it will
* break undo. K_LEFT is inserted in im_correct_cursor(). */
if (!im_is_preediting())
+8 -5
View File
@@ -93,7 +93,7 @@ static void draw_cmdline __ARGS((int start, int len));
static void save_cmdline __ARGS((struct cmdline_info *ccp));
static void restore_cmdline __ARGS((struct cmdline_info *ccp));
static int cmdline_paste __ARGS((int regname, int literally, int remcr));
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
static void redrawcmd_preedit __ARGS((void));
#endif
#ifdef FEAT_WILDMENU
@@ -2390,7 +2390,8 @@ cmdline_at_end()
}
#endif
#if (defined(FEAT_XIM) && (defined(FEAT_GUI_GTK))) || defined(PROTO)
#if (defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))) \
|| defined(PROTO)
/*
* Return the virtual column number at the current cursor position.
* This is used by the IM code to obtain the start of the preedit string.
@@ -2418,7 +2419,7 @@ cmdline_getvcol_cursor()
}
#endif
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
/*
* If part of the command line is an IM preedit string, redraw it with
* IM feedback attributes. The cursor position is restored after drawing.
@@ -2427,7 +2428,9 @@ cmdline_getvcol_cursor()
redrawcmd_preedit()
{
if ((State & CMDLINE)
# ifndef FEAT_GUI_MACVIM
&& xic != NULL
# endif
/* && im_get_status() doesn't work when using SCIM */
&& !p_imdisable
&& im_is_preediting())
@@ -2488,7 +2491,7 @@ redrawcmd_preedit()
msg_col = old_col;
}
}
#endif /* FEAT_XIM && FEAT_GUI_GTK */
#endif /* FEAT_XIM && (FEAT_GUI_GTK || FEAT_GUI_MACVIM) */
/*
* Allocate a new command line buffer.
@@ -3211,7 +3214,7 @@ cursorcmd()
}
windgoto(msg_row, msg_col);
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
redrawcmd_preedit();
#endif
#ifdef MCH_CURSOR_SHAPE
+4 -1
View File
@@ -666,10 +666,13 @@
* Both are for Unix and VMS only.
*/
#ifndef FEAT_XIM
# if defined(FEAT_GUI_MACVIM) && defined(FEAT_MBYTE)
# define FEAT_XIM
# endif
/* #define FEAT_XIM */
#endif
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MACVIM)
# define USE_XIM 1 /* needed for GTK include files */
#endif
+2 -2
View File
@@ -841,10 +841,10 @@ EXTERN int* (*iconv_errno) (void);
#endif /* FEAT_MBYTE */
#ifdef FEAT_XIM
# ifdef FEAT_GUI_GTK
# if defined(FEAT_GUI_GTK) || defined (FEAT_GUI_MACVIM)
# ifdef HAVE_GTK2
EXTERN GtkIMContext *xic INIT(= NULL);
# else
# elif !defined(FEAT_GUI_MACVIM)
EXTERN GdkICAttr *xic_attr INIT(= NULL);
EXTERN GdkIC *xic INIT(= NULL);
EXTERN char *draw_feedback INIT(= NULL);
+2 -2
View File
@@ -1206,7 +1206,7 @@ gui_position_components(total_width)
text_area_y,
text_area_width,
text_area_height
#if defined(FEAT_XIM) && !defined(HAVE_GTK2)
#if defined(FEAT_XIM) && !(defined(HAVE_GTK2) || defined(FEAT_GUI_MACVIM))
+ xim_get_status_area_height()
#endif
);
@@ -1337,7 +1337,7 @@ again:
gui_update_scrollbars(TRUE);
gui_update_cursor(FALSE, TRUE);
#if defined(FEAT_XIM) && !defined(HAVE_GTK2)
#if defined(FEAT_XIM) && !(defined(HAVE_GTK2) || defined(FEAT_GUI_MACVIM))
xim_set_status_area();
#endif
+1 -1
View File
@@ -495,7 +495,7 @@ typedef struct Gui
PhEvent_t *event_buffer;
#endif
#ifdef FEAT_XIM
#if defined(FEAT_XIM) && !defined(FEAT_GUI_MACVIM)
char *rsrc_input_method;
char *rsrc_preedit_type_name;
#endif
+64 -4
View File
@@ -3517,7 +3517,14 @@ iconv_end()
#if defined(FEAT_XIM) || defined(PROTO)
# ifdef FEAT_GUI_GTK
# ifdef FEAT_GUI_MACVIM
typedef int GtkIMContext;
typedef int * gpointer;
typedef char gchar;
# define g_return_if_fail(x) if (!(x)) return;
# endif
# if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM)
static int xim_has_preediting INIT(= FALSE); /* IM current status */
/*
@@ -3535,7 +3542,7 @@ init_preedit_start_col(void)
}
# endif
# if defined(HAVE_GTK2) && !defined(PROTO)
# if (defined(HAVE_GTK2) || defined(FEAT_GUI_MACVIM)) && !defined(PROTO)
static int im_is_active = FALSE; /* IM is enabled for current mode */
static int preedit_is_active = FALSE;
@@ -3543,9 +3550,12 @@ static int im_preedit_cursor = 0; /* cursor offset in characters */
static int im_preedit_trailing = 0; /* number of characters after cursor */
static unsigned long im_commit_handler_id = 0;
# ifndef FEAT_GUI_MACVIM
static unsigned int im_activatekey_keyval = GDK_VoidSymbol;
static unsigned int im_activatekey_state = 0;
# endif
# ifndef FEAT_GUI_MACVIM
void
im_set_active(int active)
{
@@ -3557,10 +3567,12 @@ im_set_active(int active)
if (im_is_active != was_active)
xim_reset();
}
# endif
void
xim_set_focus(int focus)
{
# ifndef FEAT_GUI_MACVIM
if (xic != NULL)
{
if (focus)
@@ -3568,8 +3580,10 @@ xim_set_focus(int focus)
else
gtk_im_context_focus_out(xic);
}
# endif
}
# ifndef FEAT_GUI_MACVIM
void
im_set_position(int row, int col)
{
@@ -3585,6 +3599,7 @@ im_set_position(int row, int col)
gtk_im_context_set_cursor_location(xic, &area);
}
}
# endif
# if 0 || defined(PROTO) /* apparently only used in gui_x11.c */
void
@@ -3609,8 +3624,10 @@ im_add_to_input(char_u *str, int len)
if (input_conv.vc_type != CONV_NONE)
vim_free(str);
# ifndef FEAT_GUI_MACVIM
if (p_mh) /* blank out the pointer if necessary */
gui_mch_mousehide(TRUE);
# endif
}
static void
@@ -3651,8 +3668,10 @@ im_correct_cursor(int num_move_back)
add_to_input_buf(backkey, (int)sizeof(backkey));
}
# ifndef FEAT_GUI_MACVIM
static int xim_expected_char = NUL;
static int xim_ignored_char = FALSE;
# endif
/*
* Update the mode and cursor while in an IM callback.
@@ -3670,6 +3689,7 @@ im_show_info(void)
out_flush();
}
# ifndef FEAT_GUI_MACVIM
/*
* Callback invoked when the user finished preediting.
* Put the final string into the input buffer.
@@ -3759,12 +3779,18 @@ im_commit_cb(GtkIMContext *context UNUSED,
if (gtk_main_level() > 0)
gtk_main_quit();
}
# endif
/*
* Callback invoked after start to the preedit.
*/
# ifndef FEAT_GUI_MACVIM
static void
im_preedit_start_cb(GtkIMContext *context UNUSED, gpointer data UNUSED)
# else
void
im_preedit_start_macvim()
# endif
{
#ifdef XIM_DEBUG
xim_log("im_preedit_start_cb()\n");
@@ -3779,8 +3805,13 @@ im_preedit_start_cb(GtkIMContext *context UNUSED, gpointer data UNUSED)
/*
* Callback invoked after end to the preedit.
*/
# ifndef FEAT_GUI_MACVIM
static void
im_preedit_end_cb(GtkIMContext *context UNUSED, gpointer data UNUSED)
# else
void
im_preedit_end_macvim()
# endif
{
#ifdef XIM_DEBUG
xim_log("im_preedit_end_cb()\n");
@@ -3839,19 +3870,28 @@ im_preedit_end_cb(GtkIMContext *context UNUSED, gpointer data UNUSED)
* remaining input from within the "retrieve_surrounding" signal handler, this
* might not be necessary. Gotta ask on vim-dev for opinions.
*/
# ifndef FEAT_GUI_MACVIM
static void
im_preedit_changed_cb(GtkIMContext *context, gpointer data UNUSED)
# else
void
im_preedit_changed_macvim(char *preedit_string, int cursor_index)
# endif
{
# ifndef FEAT_GUI_MACVIM
char *preedit_string = NULL;
int cursor_index = 0;
# endif
int num_move_back = 0;
char_u *str;
char_u *p;
int i;
# ifndef FEAT_GUI_MACVIM
gtk_im_context_get_preedit_string(context,
&preedit_string, NULL,
&cursor_index);
# endif
#ifdef XIM_DEBUG
xim_log("im_preedit_changed_cb(): %s\n", preedit_string);
@@ -3921,12 +3961,15 @@ im_preedit_changed_cb(GtkIMContext *context, gpointer data UNUSED)
im_correct_cursor(num_move_back);
}
# ifndef FEAT_GUI_MACVIM
g_free(preedit_string);
if (gtk_main_level() > 0)
gtk_main_quit();
# endif
}
# ifndef FEAT_GUI_MACVIM
/*
* Translate the Pango attributes at iter to Vim highlighting attributes.
* Ignore attributes not supported by Vim highlighting. This shouldn't have
@@ -3965,6 +4008,7 @@ translate_pango_attributes(PangoAttrIterator *iter)
return char_attr;
}
# endif
/*
* Retrieve the highlighting attributes at column col in the preedit string.
@@ -3973,6 +4017,7 @@ translate_pango_attributes(PangoAttrIterator *iter)
int
im_get_feedback_attr(int col)
{
# ifndef FEAT_GUI_MACVIM
char *preedit_string = NULL;
PangoAttrList *attr_list = NULL;
int char_attr = -1;
@@ -4017,6 +4062,9 @@ im_get_feedback_attr(int col)
g_free(preedit_string);
return char_attr;
# else
return HL_UNDERLINE;
# endif
}
void
@@ -4026,6 +4074,7 @@ xim_init(void)
xim_log("xim_init()\n");
#endif
# ifndef FEAT_GUI_MACVIM
g_return_if_fail(gui.drawarea != NULL);
g_return_if_fail(gui.drawarea->window != NULL);
@@ -4042,6 +4091,7 @@ xim_init(void)
G_CALLBACK(&im_preedit_end_cb), NULL);
gtk_im_context_set_client_window(xic, gui.drawarea->window);
# endif
}
void
@@ -4051,18 +4101,21 @@ im_shutdown(void)
xim_log("im_shutdown()\n");
#endif
# ifndef FEAT_GUI_MACVIM
if (xic != NULL)
{
gtk_im_context_focus_out(xic);
g_object_unref(xic);
xic = NULL;
}
# endif
im_is_active = FALSE;
im_commit_handler_id = 0;
preedit_start_col = MAXCOL;
xim_has_preediting = FALSE;
}
# ifndef FEAT_GUI_MACVIM
/*
* Convert the string argument to keyval and state for GdkEventKey.
* If str is valid return TRUE, otherwise FALSE.
@@ -4168,10 +4221,12 @@ im_synthesize_keypress(unsigned int keyval, unsigned int state)
g_free(event);
# endif
}
# endif // FEAT_GUI_MACVIM
void
xim_reset(void)
{
# ifndef FEAT_GUI_MACVIM
if (xic != NULL)
{
/*
@@ -4229,11 +4284,13 @@ xim_reset(void)
}
}
}
# endif
preedit_start_col = MAXCOL;
xim_has_preediting = FALSE;
}
# ifndef FEAT_GUI_MACVIM
int
xim_queue_key_press_event(GdkEventKey *event, int down)
{
@@ -4363,12 +4420,15 @@ xim_queue_key_press_event(GdkEventKey *event, int down)
return FALSE;
}
# endif
# ifndef FEAT_GUI_MACVIM
int
im_get_status(void)
{
return im_is_active;
}
# endif
# else /* !HAVE_GTK2 */
@@ -5808,7 +5868,7 @@ im_get_status()
# endif /* !HAVE_GTK2 */
# if defined(HAVE_GTK2) || defined(PROTO)
# if (defined(HAVE_GTK2) || defined(FEAT_GUI_MACVIM)) || defined(PROTO)
int
preedit_get_status(void)
{
@@ -5816,7 +5876,7 @@ preedit_get_status(void)
}
# endif
# if defined(FEAT_GUI_GTK) || defined(PROTO)
# if (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM)) || defined(PROTO)
int
im_is_preediting()
{
+1 -1
View File
@@ -2473,7 +2473,7 @@ skip_to_option_part(p)
void
changed()
{
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
/* The text of the preediting area is inserted, but this doesn't
* mean a change of the buffer yet. That is delayed until the
* text is committed. (this means preedit becomes empty) */
+10 -25
View File
@@ -2541,12 +2541,6 @@ fill_foldcolumn(p, wp, closed, lnum)
}
#endif /* FEAT_FOLDING */
#ifdef FEAT_GUI_MACVIM
extern int numMarkedChars;
extern colnr_T preedit_start_col;
#endif
/*
* Display line "lnum" of window 'wp' on the screen.
* Start at row "startrow", stop when "endrow" is reached.
@@ -2701,7 +2695,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
#endif
#define WL_LINE WL_SBR + 1 /* text in the line */
int draw_state = WL_START; /* what to draw next */
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
int feedback_col = 0;
int feedback_old_attr = -1;
#endif
@@ -4260,12 +4254,15 @@ win_line(wp, lnum, startrow, endrow, nochange)
&& !attr_pri)
char_attr = extra_attr;
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
/* XIM don't send preedit_start and preedit_end, but they send
* preedit_changed and commit. Thus Vim can't set "im_is_active", use
* im_is_preediting() here. */
if (xic != NULL
&& lnum == wp->w_cursor.lnum
if (
# ifndef FEAT_GUI_MACVIM
xic != NULL &&
# endif
lnum == wp->w_cursor.lnum
&& (State & INSERT)
&& !p_imdisable
&& im_is_preediting()
@@ -4296,19 +4293,6 @@ win_line(wp, lnum, startrow, endrow, nochange)
feedback_col = 0;
}
}
#endif
#ifdef FEAT_GUI_MACVIM
if (preedit_start_col != MAXCOL && numMarkedChars > 0)
{
colnr_T tcol;
getvcol(curwin, &(wp->w_cursor), &tcol, NULL, NULL);
if ((long)preedit_start_col <= vcol && vcol < (long)tcol)
{
char_attr = HL_UNDERLINE;
}
}
#endif
/*
* Handle the case where we are in column 0 but not on the first
@@ -8992,14 +8976,15 @@ showmode()
&& curbuf->b_p_iminsert == B_IMODE_IM)
# else
if (
# ifdef HAVE_GTK2
# if defined(HAVE_GTK2) || defined(FEAT_GUI_MACVIM)
preedit_get_status()
# else
im_get_status()
# endif
)
# endif
# ifdef HAVE_GTK2 /* most of the time, it's not XIM being used */
# if defined(HAVE_GTK2) || defined(FEAT_GUI_MACVIM)
/* most of the time, it's not XIM being used */
MSG_PUTS_ATTR(" IM", attr);
# else
MSG_PUTS_ATTR(" XIM", attr);
+1 -1
View File
@@ -3173,7 +3173,7 @@ im_save_status(psave)
* And don't save when the GUI is running but our window doesn't have
* input focus (e.g., when a find dialog is open). */
if (!p_imdisable && KeyTyped && !KeyStuffed
# ifdef FEAT_XIM
# if defined(FEAT_XIM) && !defined(FEAT_GUI_MACVIM)
&& xic != NULL
# endif
# ifdef FEAT_GUI
+1 -1
View File
@@ -1390,7 +1390,7 @@ u_sync(force)
/* Skip it when already synced or syncing is disabled. */
if (curbuf->b_u_synced || (!force && no_u_sync > 0))
return;
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
if (im_is_preediting())
return; /* XIM is busy, don't break an undo sequence */
#endif