Bug 70726

Summary: one-letter text surrounded by * * does not appear in a bold style.
Product: knode Reporter: Rober <coirs>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 0.7.6   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Rober 2003-12-18 00:08:00 UTC
Version:           0.7.6 (using KDE Devel)
Installed from:    Compiled sources

i.e. *o* is printed as a *o* not <b>o</b> in the message window. Two- or more- letter words are printed correctly.x

PS: Forgive me my poor English.
Comment 1 Jakob Schröter 2004-11-11 13:53:53 UTC
CVS commit by schrot: 

- scroll the reader win back after rot13 (#76797)
- dito for switching from/to fixed font
- insert spelling correction at correct position (#76396)
- formatting of 1-letter words (bold etc.) (#70726)
- disable formatting of signatures (#59448)
- add %L as line break alias (#66772)

BUG: 76797
BUG: 76396
BUG: 70726
BUG: 59448
FEATURE: 66772


  M +1 -0      knarticlefactory.cpp   1.83
  M +10 -2     knarticlewidget.cpp   1.187
  M +10 -12    kncomposer.cpp   1.203
  M +1 -1      knconfigwidgets.cpp   1.120


--- kdepim/knode/knarticlefactory.cpp  #1.82:1.83
@@ -217,4 +217,5 @@ void KNArticleFactory::createReply(KNRem
   attribution.replace(QRegExp("%MSID"),a->messageID()->asUnicodeString());
   attribution.replace(QRegExp("%GROUP"),g->groupname());
+  attribution.replace(QRegExp("%L"),"\n");
   attribution+="\n\n";
 

--- kdepim/knode/knarticlewidget.cpp  #1.186:1.187
@@ -730,5 +730,5 @@ QString KNArticleWidget::toHtmlString(co
           if (regExp.search(text,idx)==(int)idx) {
             matchLen = regExp.matchedLength();
-            if (( matchLen > 3 ) &&
+            if (( matchLen >= 3 ) &&
                 ((idx==0)||text[idx-1].isSpace()||(text[idx-1] == '(')) &&
                 ((idx+matchLen==len)||text[idx+matchLen].isSpace()||(text[idx+matchLen]==',')||
@@ -1368,8 +1368,10 @@ void KNArticleWidget::createHtmlPage()
               }
             }
-          }
           html+=toHtmlString(line,true,true,true)+"<br>";
         }
         else
+            html+=toHtmlString(line,true,false,true)+"<br>";
+        }
+        else
           html+="<br>";
       }
@@ -1791,6 +1793,9 @@ void KNArticleWidget::slotToggleFullHdrs
 void KNArticleWidget::slotToggleRot13()
 {
+  int x = contentsX();
+  int y = contentsY();
   r_ot13=!r_ot13;
   updateContents();
+  setContentsPos(x, y);
 }
 
@@ -1798,8 +1803,11 @@ void KNArticleWidget::slotToggleRot13()
 void KNArticleWidget::slotToggleFixedFont()
 {
+  int x = contentsX();
+  int y = contentsY();
   // ok, this is a hack
   if (knGlobals.artWidget == this)
     knGlobals.configManager()->readNewsViewer()->setUseFixedFont(!knGlobals.configManager()->readNewsViewer()->useFixedFont());
   applyConfig();
+  setContentsPos(x, y);
 }
 

--- kdepim/knode/kncomposer.cpp  #1.202:1.203
@@ -345,6 +345,8 @@ KNComposer::KNComposer(KNLocalArticle *a
 
   if (firstEdit) {   // now we place the cursor at the end of the quoted text / below the attribution line
-    if (knGlobals.configManager()->postNewsComposer()->cursorOnTop())
-      v_iew->e_dit->setCursorPosition(1,0);
+    if (knGlobals.configManager()->postNewsComposer()->cursorOnTop()) {
+      int numLines = knGlobals.configManager()->postNewsComposer()->intro().contains("%L");
+      v_iew->e_dit->setCursorPosition(numLines+1,0);
+    }
     else
       v_iew->e_dit->setCursorPosition(v_iew->e_dit->numLines()-1,0);
@@ -2057,14 +2059,10 @@ bool KNComposer::Editor::eventFilter(QOb
           int parIdx = 1, txtIdx = 1;
           getCursorPosition(&parIdx, &txtIdx);
-
-          //Put in our replacement
-          QString txtContents = text();
-          QString newContents = txtContents.left(firstSpace) + m_replacements[word][id] +
-                                txtContents.right( txtContents.length() - lastSpace );
-          setText( newContents );
-
-          //Restore the cursor position
-          if( txtIdx > lastSpace )
-            txtIdx += newContents.length() - txtContents.length();
+          setSelection(para, firstSpace, para, lastSpace);
+          insert(m_replacements[word][id]);
+          // Restore the cursor position; if the cursor was behind the
+          // misspelled word then adjust the cursor position
+          if ( para == parIdx && txtIdx >= lastSpace )
+            txtIdx += m_replacements[word][id].length() - word.length();
           setCursorPosition(parIdx, txtIdx);
         }

--- kdepim/knode/knconfigwidgets.cpp  #1.119:1.120
@@ -2242,5 +2242,5 @@ KNConfig::PostNewsComposerWidget::PostNe
   replyL->addMultiCellWidget(new QLabel(i_ntro,i18n("&Introduction phrase:"), replyB),1,1,0,1);
   replyL->addMultiCellWidget(i_ntro, 2,2,0,1);
-  replyL->addMultiCellWidget(new QLabel(i18n("Placeholders: %NAME=name, %EMAIL=email address,\n%DATE=date, %MSID=message-id, %GROUP=group name"), replyB),3,3,0,1);
+  replyL->addMultiCellWidget(new QLabel(i18n("Placeholders: %NAME=name, %EMAIL=email address,\n%DATE=date, %MSID=message-id, %GROUP=group name, %L=line break"), replyB),3,3,0,1);
   connect(i_ntro, SIGNAL(textChanged(const QString&)), SLOT(slotEmitChanged()));