Skip to content

Commit

Permalink
Merge pull request #246 from bambu/more_deadkeys
Browse files Browse the repository at this point in the history
Allow deadkeys that do not require a modifier key to work
  • Loading branch information
rogual committed Apr 20, 2016
2 parents c00467c + fc65bd4 commit 93ce5f1
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/input.mm
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ - (void)keyDown:(NSEvent *)event
NSTextInputContext *con = [NSTextInputContext currentInputContext];
[NSCursor setHiddenUntilMouseMoves:YES];

std::stringstream raw;
translateKeyEvent(raw, event);
std::string raws = raw.str();

if ([self hasMarkedText])
[con handleEvent:event];
else if (raws.size())
[self vimInput:raws];
else if (mInsertMode || [self probablyCommandMode])
/* When a deadkey is received on keydown the length is 0. Allow
NSTextInputContext to handle the key press */
if ([[event characters] length] == 0 || [self hasMarkedText])
[con handleEvent:event];
else {
std::stringstream raw;
translateKeyEvent(raw, event);
std::string raws = raw.str();

if (raws.size())
[self vimInput:raws];
}
}

- (void)mouseEvent:(NSEvent *)event drag:(BOOL)drag type:(const char *)type
Expand Down

0 comments on commit 93ce5f1

Please sign in to comment.