From defa7bd0986d4fea1d5d45877c073b6edd7c4313 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Wed, 28 May 2008 21:16:27 +0200 Subject: [PATCH] Insert mode cursor respects 'rightleft' option When 'rl' is enabled the insert mode cursor is drawn on the right-hand side of a cell. --- src/MacVim/MMBackend.m | 8 ++++++++ src/MacVim/MMTextView.m | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m index 608388bd6f..0afd312264 100644 --- a/src/MacVim/MMBackend.m +++ b/src/MacVim/MMBackend.m @@ -1569,8 +1569,16 @@ static NSString *MMSymlinkWarningString = // flushed (e.g. storing the currently selected text would be a bad idea). // We take this approach of "pushing" the state to MacVim to avoid having // to make synchronous calls from MacVim to Vim in order to get state. + +#ifdef FEAT_RIGHTLEFT + BOOL rightLeft = curwin->w_p_rl; +#else + BOOL rightLeft = NO; +#endif + NSDictionary *vimState = [NSDictionary dictionaryWithObjectsAndKeys: [[NSFileManager defaultManager] currentDirectoryPath], @"pwd", + [NSNumber numberWithBool:rightLeft], @"w_p_rl", nil]; [self queueMessage:SetVimStateMsgID data:[vimState dictionaryAsData]]; diff --git a/src/MacVim/MMTextView.m b/src/MacVim/MMTextView.m index 72bcf4f1e7..c9b3431bce 100644 --- a/src/MacVim/MMTextView.m +++ b/src/MacVim/MMTextView.m @@ -469,7 +469,11 @@ enum { ipRect.origin.y += ipRect.size.height - frac; ipRect.size.height = frac; } else if (MMInsertionPointVertical == insertionPointShape) { + BOOL rightLeft = [[[[self vimController] vimState] + objectForKey:@"w_p_rl"] boolValue]; int frac = ([ts cellSize].width* insertionPointFraction + 99)/100; + if (rightLeft) + ipRect.origin.x += ipRect.size.width - frac; ipRect.size.width = frac; }