Created
December 24, 2008 03:25
-
-
Save tokuhirom/39571 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/.gitignore b/.gitignore | |
new file mode 100644 | |
index 0000000..567609b | |
--- /dev/null | |
+++ b/.gitignore | |
@@ -0,0 +1 @@ | |
+build/ | |
diff --git a/PTYSession.m b/PTYSession.m | |
index 65535a9..7955cf4 100644 | |
--- a/PTYSession.m | |
+++ b/PTYSession.m | |
@@ -580,6 +580,12 @@ static NSImage *warningImage; | |
send_strlen = [keydat length]; | |
} | |
} | |
+ else if ((modflag & NSCommandKeyMask) && (unicode != 0x20 && unicode != 0x74 && unicode != 0x76 && unicode != NSLeftArrowFunctionKey && unicode != NSRightArrowFunctionKey)) | |
+ { | |
+ send_str = (unsigned char*)strdup("\x1b "); | |
+ send_strlen = 2; | |
+ send_str[1] = (unsigned char)unicode; | |
+ } | |
else if ((modflag & NSAlternateKeyMask) && | |
([self optionKey] != OPT_NORMAL)) | |
{ | |
diff --git a/README_ITERM_META_COMMAND_PATCH b/README_ITERM_META_COMMAND_PATCH | |
new file mode 100644 | |
index 0000000..07ce5ef | |
--- /dev/null | |
+++ b/README_ITERM_META_COMMAND_PATCH | |
@@ -0,0 +1,10 @@ | |
+this patch is taken from | |
+- http://www.tux4web.de/2007/05/01/quick-and-dirty-hack-command-key-as-meta-in-iterm/ | |
+- http://openlab.dino.co.jp/2007/10/30/095010128.html | |
+ | |
+cvs -z3 -d:pserver:[email protected]:/cvsroot/iterm co -r RC_0_9_5 iTerm | |
+cd iTerm | |
+patch -p1 < ~/iterm-cmdkey-as-meta-patch-20071030.txt | |
+/usr/bin/xcodebuild -target iTerm -configuration Deployment | |
+open build/Deployment/ | |
+ | |
diff --git a/iTerm.xcodeproj/project.pbxproj b/iTerm.xcodeproj/project.pbxproj | |
index 142e35f..18042ec 100644 | |
--- a/iTerm.xcodeproj/project.pbxproj | |
+++ b/iTerm.xcodeproj/project.pbxproj | |
@@ -1518,7 +1518,6 @@ | |
isa = XCBuildConfiguration; | |
buildSettings = { | |
ARCHS = ( | |
- ppc, | |
i386, | |
); | |
FRAMEWORK_SEARCH_PATHS = ( | |
@@ -1536,7 +1535,6 @@ | |
isa = XCBuildConfiguration; | |
buildSettings = { | |
ARCHS = ( | |
- ppc, | |
i386, | |
); | |
FRAMEWORK_SEARCH_PATHS = ( | |
diff --git a/iTermApplication.m b/iTermApplication.m | |
index 9263b4f..6cf5000 100644 | |
--- a/iTermApplication.m | |
+++ b/iTermApplication.m | |
@@ -43,7 +43,8 @@ | |
id aWindow; | |
PseudoTerminal *currentTerminal; | |
PTYSession *currentSession; | |
- | |
+ unichar unicode; | |
+ NSString *keystr; | |
if([anEvent type] == NSKeyDown) | |
{ | |
@@ -56,7 +57,11 @@ | |
currentTerminal = [[iTermController sharedInstance] currentTerminal]; | |
currentSession = [currentTerminal currentSession]; | |
- if([currentSession hasKeyMappingForEvent: anEvent highPriority: YES]) | |
+ keystr = [anEvent characters]; | |
+ | |
+ unicode = [keystr length]>0?[keystr characterAtIndex:0]:0; | |
+ | |
+ if([currentSession hasKeyMappingForEvent: anEvent highPriority: YES] || (([anEvent modifierFlags] & NSCommandKeyMask) && (unicode != 0x20 && unicode != 0x74 && unicode != 0x76 && unicode != NSLeftArrowFunctionKey && unicode != NSRightArrowFunctionKey))) | |
[currentSession keyDown: anEvent]; | |
else | |
[super sendEvent: anEvent]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment