texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Texmacs-dev] Keyboard bug + solution


From: Miguel de Benito Delgado
Subject: [Texmacs-dev] Keyboard bug + solution
Date: Fri, 5 Nov 2010 23:22:20 +0100

HI all,

  I've been experiencing a bug with the svn version of the code for some time. Pressing the "apostrophe" key ( ´ ), the one needed to produce letters like á é í ó ú, caused the program to crash apparently after a random number of times. The console showed pairs of

-[NSCFString characterAtIndex:]: Range or index out of bounds


and a, to my eyes, utterly undecipherable stack trace. It took me an embarrassing amount of time to think of searching for "characterAtIndex" and thus locate the problem in Plugins/MacOS/mac_utilities.mm, function mac_handler_body, around line 76. The new first few lines of it must check for empty strings:


NSEvent *mac_handler_body(NSEvent *event

{

  if (([event type] == NSKeyDown) || ([event type] == NSKeyUp)) {

    NSString *nss = [event charactersIgnoringModifiers];

    if ([nss length] > 0) {

      unichar key = [nss characterAtIndex:0];


and then a new closing brace must be added, of course. I have attached a diff for that file only, but my editor has messed up the indentation so it looks bigger than it is.

Best regards,
________________
Miguel de  Benito.

Attachment: diff-against-3522.zip
Description: Zip archive


reply via email to

[Prev in Thread] Current Thread [Next in Thread]