Fix debug output

Also add leak-watching to OakTextView.
This commit is contained in:
Allan Odgaard
2013-02-16 10:20:58 +01:00
parent 205173312d
commit c7763d5bcc
2 changed files with 5 additions and 2 deletions

View File

@@ -4,6 +4,7 @@
#import <buffer/buffer.h>
#import <theme/theme.h>
#import <document/document.h>
#import <oak/debug.h>
extern int32_t const NSWrapColumnWindowWidth;
extern int32_t const NSWrapColumnAskUser;
@@ -27,6 +28,8 @@ enum folding_state_t { kFoldingNone, kFoldingTop, kFoldingCollapsed, kFoldingBot
PUBLIC @interface OakTextView : OakView <NSTextInput, NSTextFieldDelegate>
{
OBJC_WATCH_LEAKS(OakTextView);
document::document_ptr document;
theme_ptr theme;
std::string fontName;

View File

@@ -2226,7 +2226,7 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac
D(DBF_OakTextView_Macros, bug("%s\n", BSTR(flag)););
if(macroRecordingArray)
{
D(DBF_OakTextView_Macros, bug("%s\n", to_s(plist::convert(macroRecordingArray)).c_str()););
D(DBF_OakTextView_Macros, bug("%s\n", to_s(plist::convert((__bridge CFDictionaryRef)macroRecordingArray)).c_str()););
[[NSUserDefaults standardUserDefaults] setObject:[macroRecordingArray copy] forKey:@"OakMacroManagerScratchMacro"];
macroRecordingArray = nil;
}
@@ -2238,7 +2238,7 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac
- (IBAction)playScratchMacro:(id)anArgument
{
D(DBF_OakTextView_Macros, bug("%s\n", to_s(plist::convert([[NSUserDefaults standardUserDefaults] arrayForKey:@"OakMacroManagerScratchMacro"])).c_str()););
D(DBF_OakTextView_Macros, bug("%s\n", to_s(plist::convert((__bridge CFDictionaryRef)[[NSUserDefaults standardUserDefaults] arrayForKey:@"OakMacroManagerScratchMacro"])).c_str()););
AUTO_REFRESH;
if(NSArray* scratchMacro = [[NSUserDefaults standardUserDefaults] arrayForKey:@"OakMacroManagerScratchMacro"])
editor->macro_dispatch(plist::convert((__bridge CFDictionaryRef)@{ @"commands" : scratchMacro }), editor->variables(std::map<std::string, std::string>(), to_s([self scopeAttributes])));