Skip to content

Instantly share code, notes, and snippets.

@saitoha
Last active December 18, 2015 21:09
Show Gist options
  • Select an option

  • Save saitoha/5845597 to your computer and use it in GitHub Desktop.

Select an option

Save saitoha/5845597 to your computer and use it in GitHub Desktop.
DECARM(auto repeat mode) for iTerm2
diff --git a/PTYTextView.m b/PTYTextView.m
index 433f279..16050ac 100644
--- a/PTYTextView.m
+++ b/PTYTextView.m
@@ -2355,6 +2355,11 @@ NSMutableArray* screens=0;
NSLog(@"keycode is slash=%d, is backslash=%d", (keyCode == 0x2c), (keyCode == 0x2a));
}
+ // discard repeated key event if auto repeat mode (DECARM) is disabled
+ if (keyIsARepeat && ![[dataSource terminal] autorepeatMode]) {
+ return;
+ }
+
// Hide the cursor
[NSCursor setHiddenUntilMouseMoves:YES];
diff --git a/VT100Terminal.m b/VT100Terminal.m
index dd67b60..5996b9c 100644
--- a/VT100Terminal.m
+++ b/VT100Terminal.m
@@ -2300,7 +2300,7 @@ static VT100TCC decode_string(unsigned char *datap,
SCREEN_MODE = NO;
ORIGIN_MODE = NO;
WRAPAROUND_MODE = YES;
- AUTOREPEAT_MODE = NO;
+ AUTOREPEAT_MODE = YES;
INTERLACE_MODE = NO;
KEYPAD_MODE = NO;
INSERT_MODE = NO;
@@ -2465,7 +2465,7 @@ static VT100TCC decode_string(unsigned char *datap,
SCREEN_MODE = NO;
ORIGIN_MODE = NO;
WRAPAROUND_MODE = YES;
- AUTOREPEAT_MODE = NO;
+ AUTOREPEAT_MODE = YES;
INTERLACE_MODE = NO;
KEYPAD_MODE = NO;
INSERT_MODE = NO;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment