Advertisement
Guest User

textroom spell-check patch

a guest
May 28th, 2014
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.11 KB | None | 0 0
  1. --- textroom-0.8.2/application/src/textroom.cpp 2014-05-26 16:04:11.155079095 +0400
  2. +++ textroom-svn/application/src/textroom.cpp   2014-05-26 16:50:26.250577206 +0400
  3. @@ -28,6 +28,7 @@
  4.  ****************************************************************************/
  5.  
  6.  #include <QtGui>
  7. +#include <QTextCodec>
  8.  #include <SDL/SDL.h>
  9.  #ifdef Q_OS_MACX
  10.  # include <SDL_mixer/SDL_mixer.h>
  11. @@ -1163,6 +1164,7 @@
  12.  #endif
  13.  
  14.     pMS= new Hunspell(affFileName.toLocal8Bit(), dicFileName.toLocal8Bit());
  15. +   QTextCodec *pDC = QTextCodec::codecForName(pMS->get_dic_encoding());
  16.     QTextCharFormat highlightFormat;
  17.     highlightFormat.setUnderlineColor(Qt::red);
  18.     highlightFormat.setUnderlineStyle(QTextCharFormat::SpellCheckUnderline);
  19. @@ -1182,7 +1184,7 @@
  20.         QTextCursor highlightCursor(textEdit->document()->find(word, findCursor));
  21.         findCursor.setPosition(highlightCursor.position());
  22.         findCursor.movePosition(QTextCursor::EndOfWord);
  23. -       QByteArray ba = word.toUtf8();
  24. +       QByteArray ba = pDC->fromUnicode(word);
  25.         char * wordChar = ba.data();
  26.         int correct = pMS->spell(wordChar);
  27.         if ( !correct && isHighlighted )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement