title: NSTextview won't show pop-up menu for Korean text replacements
body: <p>(Disclaimer -- I don't understand Korean, so I have some test examples that don't make sense but demonstrate the issue.)</p>
  
  <p>I have a heavily customized NSTextView/NSTextStorage to provide syntax highlighting and other behaviors in my app.  A Korean user pointed out some difficulties using the macOS text replacement functionality.</p>
  
  <ol>
  <li><p>The pop-up menu to accept/reject text replacements doesn't appear.</p></li>
  <li><p>Text replacements of multi-character strings don't work -- it seems to only allow the last character to trigger a replacement.</p></li>
  </ol>
  
  <p>To test, I configured the following text replacements on my (US English) mac:</p>
  
  <ol>
  <li><code>해</code> (created by typing <code>go</code>) is replaced with <code>GO</code> (creative, I know...)</li>
  <li><code>새</code> (<code>to</code>) is replaced with <code>TO</code></li>
  <li><code>ㅂㅈ</code> (<code>qw</code>) is replaced with <code>qw</code></li>
  <li><code>햅ㅈ</code> (<code>goqw</code>) with <code>go qw</code></li>
  <li>I enabled the <code>2-Set Korean</code> input source (the "Caps Lock to switch" feature is a life saver) (If it matters, I have Font Size 18, Input format <code>Hangul (Hanja)</code>, and Delete by <code>Gulja</code>.</li>
  <li>I am running 10.12.6 on this machine.</li>
  </ol>
  
  <p>Test environments:</p>
  
  <ol>
  <li><p>I downloaded Apple's source for TextEdit, compiled, and used that (so that I could confirm TextEdit was compiled using same SDK as my app)</p></li>
  <li><p>I created a "toy" application that consists of a single window.  In the ViewController's <code>viewDidLoad</code>, I use this to replace the contents with a basic NSTextView (without any of my customizations):</p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
  
      NSView * contentView = [self view];
      NSRect cFrame = [contentView bounds];
  
      NSView * oldView = [[self.view subviews] firstObject];
      [oldView removeFromSuperview];
  
      // Create basic NSTextView with mostly default settings
      NSTextView * newView = [[NSTextView alloc] initWithFrame:cFrame];
      [newView setTranslatesAutoresizingMaskIntoConstraints:NO];
      [self.view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
      [newView setVerticallyResizable:YES];
      [newView setHorizontallyResizable:NO];
  
      // Scrollview for convenience
      NSScrollView * scroller = [[NSScrollView alloc] initWithFrame:cFrame];
      [scroller setAutoresizingMask:NSViewWidthSizable | NSViewWidthSizable];
      [scroller setHasVerticalRuler:YES];
      [scroller setUsesPredominantAxisScrolling:YES];
      [scroller setHorizontalScrollElasticity:NSScrollElasticityNone];
  
      [scroller setDocumentView:newView];
  
      [self.view addSubview:scroller];
  
      // Do any additional setup after loading the view.
      textView = newView;
      [textView setRulerVisible:YES];
  }
  </code></pre></li>
  </ol>
  
  <p>Results:</p>
  
  <ol>
  <li><p>Using TextEdit, all of the replacements display a pop-up menu allowing me to accept/reject the replacement as I type (Korean as well as my own English text replacements).</p></li>
  <li><p>Using the toy application, single character replacements are changed automatically, but no pop-up menu is displayed.</p></li>
  <li><p>The two character replacement is not triggered in the toy app.</p></li>
  <li><p>Typing quickly in the toy app (with a space after) allows all Korean replacements to happen, but still no pop-up.</p></li>
  <li><p>English text replacements, including multi-letter words, show the pop-up menu (e.g. <code>mmd</code> -> <code>MultiMarkdown</code>).</p></li>
  <li><p>Changing the font for the NSTextView doesn't change behavior (e.g. <code>Times</code> is same as <code>AppleMyungjo</code>).</p></li>
  </ol>
  
  <p>Reviewing the TextEdit code, I was unable to find anything relevant to indicate what I am doing wrong.  The fact that pop-ups appear with English replacements but not Korean ones seems odd, especially with an unmodified NSTextView.  Using a programmatic NSTextView should exclude me doing something wrong with the Xcode interface builder setup.  TextEdit uses programmatic NSTextViews, and I couldn't see anything obvious in their setup that differs meaningfully from mine, but obviously there is something going on.</p>
  
  <p>Any solutions?</p>
  
  <p>Thanks!</p>