mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Add function to print message queue
This commit is contained in:
@@ -1148,21 +1148,14 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
return;
|
||||
}
|
||||
|
||||
//NSLog(@"[%s] QUEUE for identifier=%d: <<< %@>>>", _cmd, identifier,
|
||||
// debugStringForMessageQueue(queue));
|
||||
|
||||
NSNumber *key = [NSNumber numberWithUnsignedInt:identifier];
|
||||
NSArray *q = [inputQueues objectForKey:key];
|
||||
if (q) {
|
||||
q = [q arrayByAddingObjectsFromArray:queue];
|
||||
[inputQueues setObject:q forKey:key];
|
||||
|
||||
//NSLog(@"[%s] Appending queue id=%d", _cmd, identifier);
|
||||
#if 0 // More debug logging info
|
||||
unsigned i, count = [q count];
|
||||
for (i = 0; i < count; i += 2) {
|
||||
NSData *value = [q objectAtIndex:i];
|
||||
int msgid = *((int*)[value bytes]);
|
||||
NSLog(@" %s", MessageStrings[msgid]);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
[inputQueues setObject:queue forKey:key];
|
||||
}
|
||||
|
||||
+9
-1
@@ -101,7 +101,7 @@
|
||||
extern char *MessageStrings[];
|
||||
|
||||
enum {
|
||||
OpenWindowMsgID = 1,
|
||||
OpenWindowMsgID = 1, // NOTE: FIRST IN ENUM MUST BE 1
|
||||
InsertTextMsgID,
|
||||
KeyDownMsgID,
|
||||
CmdKeyMsgID,
|
||||
@@ -173,6 +173,7 @@ enum {
|
||||
DeactivateKeyScriptID,
|
||||
BrowseForFileMsgID,
|
||||
ShowDialogMsgID,
|
||||
LastMsgID // NOTE: MUST BE LAST MESSAGE IN ENUM!
|
||||
};
|
||||
|
||||
|
||||
@@ -211,6 +212,13 @@ enum {
|
||||
MMTabInfoCount
|
||||
};
|
||||
|
||||
|
||||
// Create a string holding the labels of all messages in message queue for
|
||||
// debugging purposes (condense some messages since there may typically be LOTS
|
||||
// of them on a queue).
|
||||
NSString *debugStringForMessageQueue(NSArray *queue);
|
||||
|
||||
|
||||
// Argument used to stop MacVim from opening an empty window on startup
|
||||
// (techincally this is a user default but should not be used as such).
|
||||
extern NSString *MMNoWindowKey;
|
||||
|
||||
@@ -88,6 +88,7 @@ char *MessageStrings[] =
|
||||
"DeactivateKeyScriptID",
|
||||
"BrowseForFileMsgID",
|
||||
"ShowDialogMsgID",
|
||||
"END OF MESSAGE IDs" // NOTE: Must be last!
|
||||
};
|
||||
|
||||
|
||||
@@ -102,6 +103,34 @@ NSString *VimPBoardType = @"VimPBoardType";
|
||||
|
||||
|
||||
|
||||
// Create a string holding the labels of all messages in message queue for
|
||||
// debugging purposes (condense some messages since there may typically be LOTS
|
||||
// of them on a queue).
|
||||
NSString *
|
||||
debugStringForMessageQueue(NSArray *queue)
|
||||
{
|
||||
NSMutableString *s = [NSMutableString new];
|
||||
unsigned i, count = [queue count];
|
||||
int item = 0, menu = 0, enable = 0;
|
||||
for (i = 0; i < count; i += 2) {
|
||||
NSData *value = [queue objectAtIndex:i];
|
||||
int msgid = *((int*)[value bytes]);
|
||||
if (msgid < 1 || msgid >= LastMsgID)
|
||||
continue;
|
||||
if (msgid == AddMenuItemMsgID) ++item;
|
||||
else if (msgid == AddMenuMsgID) ++menu;
|
||||
else if (msgid == EnableMenuItemMsgID) ++enable;
|
||||
else [s appendFormat:@"%s ", MessageStrings[msgid]];
|
||||
}
|
||||
if (item > 0) [s appendFormat:@"AddMenuItemMsgID(%d) ", item];
|
||||
if (menu > 0) [s appendFormat:@"AddMenuMsgID(%d) ", menu];
|
||||
if (enable > 0) [s appendFormat:@"EnableMenuItemMsgID(%d) ", enable];
|
||||
|
||||
return [s autorelease];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation NSString (MMExtras)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user