Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/notes-3.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ Major New Features:
between them. The group now stays contiguous
and the removed tab moves just after it.

- Fixed a bug where pressing Backspace while
composing with an input method (such as the
Korean 2-Set IME) left a stray jamo behind.
When the IME commits its composition and
hands the keystroke back, iTerm2 now acts on
it instead of dropping it. This also makes
Return submit the line it completes.

- Fixed a bug where the top-right session
indicators left a horizontal smear while
swiping between tabs with two fingers.
Expand Down
20 changes: 20 additions & 0 deletions sources/Keyboard/iTermKeyboardHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,26 @@ - (void)doCommandBySelector:(SEL)aSelector {
return;
}

// An input method can finish a composition by committing it with
// -insertText:replacementRange: and then handing the keystroke back to us as a command
// selector. When that happens the key is ours to handle: the composition is already gone
// by the time we get here, so the delete would otherwise be dropped and the committed
// text left behind. _keyPressHandled distinguishes this from the case where the IME
// consumed the keystroke to edit its composition, in which case there is nothing to do.
// Issue 13030.
if (_keyPressHandled &&
_hadMarkedTextBeforeHandlingKeypressEvent &&
![self hasMarkedText] &&
_eventBeingHandled &&
(aSelector == @selector(deleteBackward:) ||
aSelector == @selector(deleteBackwardByDecomposingPreviousCharacter:) ||
aSelector == @selector(insertNewline:))) {
DLog(@"IME committed and handed back %@; sending to delegate", NSStringFromSelector(aSelector));
[self.delegate keyboardHandler:self sendEventToController:_eventBeingHandled];
DLog(@"returning from doCommandBySelector:%@", NSStringFromSelector(aSelector));
return;
}

if ([iTermAdvancedSettingsModel experimentalKeyHandling] || [iTermAdvancedSettingsModel enableCharacterAccentMenu]) {
// Pass the event to the delegate since doCommandBySelector was called instead of
// insertText:replacementRange:, unless an IME is in use. An example of when this gets called
Expand Down