Bug 132790

Summary: input box grows when canceling spellchecker dialog
Product: [Applications] konversation Reporter: Niek Beernink <n.beernink>
Component: generalAssignee: Konversation Developers <konversation-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Niek Beernink 2006-08-22 10:49:12 UTC
Version:           0.19+ #3130 (using KDE 3.5.4, Kubuntu Package 4:3.5.4-0ubuntu3 )
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.15-25-k7

How to reproduce:

1. Type some misspelled words in the input box.
2. Right-click the input box and select "Check spelling..."
3. In the dialog that pops up, select either "Finished" or "Cancel".
4. Notice how the input box grows by two extra lines.
5. Focus the input box and press the delete key twice to get it back to the normal size of 1 row.

I can reproduce this bug regardless of having the following options on or off;
-Auto Spell Check
-input box expands with text
Comment 1 Eike Hein 2006-08-26 17:26:55 UTC
SVN commit 577398 by hein:

Add workaround against KSpell handing us trailing newlines.
Boils down to a forgotten FIXME in KSpell::chec. Sigh.
BUG:132790


 M  +13 -0     ircinput.cpp  
 M  +1 -0      ircinput.h  


--- trunk/extragear/network/konversation/src/ircinput.cpp #577397:577398
@@ -112,7 +112,20 @@
 {
     setCheckSpellingEnabled(false);
 }
+void IRCInput::slotSpellCheckDone(const QString& s)
+{
+    // NOTE: kdelibs 3.5's KSpell stupidly adds newlines to its
+    // buffer at some point for god-knows-what-reason, and for-
+    // gets to remove them again before handing the result back.
+    // There's a FIXME to the effect in KSpell::check. This is
+    // a workaround.
 
+    if (s == text() || s == (text() + '\n'+'\n'))
+        return;
+
+    setText(s.simplifyWhiteSpace());
+}
+
 void IRCInput::updateAppearance()
 {
     m_multiRow = Preferences::useMultiRowInputBox();
--- trunk/extragear/network/konversation/src/ircinput.h #577397:577398
@@ -65,6 +65,7 @@
         void getHistory(bool up);
         void insertCompletion(const QString& nick);
         void disableSpellChecking();
+        virtual void slotSpellCheckDone(const QString& s);
 
     protected:
         bool eventFilter(QObject *object,QEvent *event);