[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE_3_3_BRANCH: kdelibs/kate/part
From:       Kazuki Ohta <mover () hct ! zaq ! ne ! jp>
Date:       2004-10-10 7:13:09
Message-ID: 20041010071309.6463716B79 () office ! kde ! org
[Download RAW message or body]

CVS commit by kzk: 

This commit fixes the problem of setting wrong microFocusHint
for ASIAN input method. Current code sets it at the cursor pos,
but it should be at the start pos of selected preedit.
Please have a look at the comment below.

  // Cursor placement code is changed for Asian input method that
  // shows candidate window. This behavior is same as Qt/E 2.3.7
  // which supports Asian input methods. Asian input methods need
  // start point of IM selection text to place candidate window as
  // adjacent to the selection text.


  M +32 -2     kateviewinternal.cpp   1.304.2.5
  M +3 -0      kateviewinternal.h   1.101.4.1


--- kdelibs/kate/part/kateviewinternal.h  #1.101:1.101.4.1
@@ -261,4 +261,6 @@ class KateViewInternal : public QWidget
     void paintCursor();
 
+    void updateMicroFocusHint();
+
     void placeCursor( const QPoint& p, bool keepSelection = false, bool \
updateSelection = true );  bool isTargetSelected( const QPoint& p );
@@ -429,4 +431,5 @@ class KateViewInternal : public QWidget
    int m_imPreeditStart;
    int m_imPreeditLength;
+   int m_imPreeditSelStart;
 };
 

--- kdelibs/kate/part/kateviewinternal.cpp  #1.304.2.4:1.304.2.5
@@ -86,4 +86,5 @@ KateViewInternal::KateViewInternal(KateV
   , m_imPreeditStart(0)
   , m_imPreeditLength(0)
+  , m_imPreeditSelStart(0)
 {
   setMinimumSize (0,0);
@@ -892,4 +893,30 @@ QPoint KateViewInternal::cursorCoordinat
 }
 
+
+void KateViewInternal::updateMicroFocusHint()
+{
+  int line = 0;
+  if (m_imPreeditStartLine)
+    line = m_imPreeditStartLine;
+  else
+    line = displayViewLine(displayCursor, true);
+
+  if (line == -1)
+      return;
+  
+  uint y = line * m_view->renderer()->fontHeight();
+  
+  // Cursor placement code is changed for Asian input method that
+  // shows candidate window. This behavior is same as Qt/E 2.3.7
+  // which supports Asian input methods. Asian input methods need
+  // start point of IM selection text to place candidate window as
+  // adjacent to the selection text.
+  uint preeditStrLen = m_view->renderer()->textWidth(textLine(line), cursor.col()) - \
m_view->renderer()->textWidth(textLine(line), m_imPreeditSelStart); +  uint x = cXPos \
- m_startX - lineRanges[line].startX + lineRanges[line].xOffset() - preeditStrLen; +  \
 +  setMicroFocusHint( x, y, 0, m_view->renderer()->fontHeight() );  
+}
+
+
 void KateViewInternal::doReturn()
 {
@@ -2063,6 +2090,5 @@ void KateViewInternal::updateCursor( con
   tagLine(displayCursor);
 
-  QPoint cursorP = cursorCoordinates();
-  setMicroFocusHint( cursorP.x(), cursorP.y(), 0, m_view->renderer()->fontHeight() \
); +  updateMicroFocusHint();
 
   if (m_cursorTimer.isActive ())
@@ -2970,4 +2996,5 @@ void KateViewInternal::imStartEvent( QIM
   m_imPreeditStart = cursor.col();
   m_imPreeditLength = 0;
+  m_imPreeditSelStart = m_imPreeditStart;
 
   m_doc->setIMSelectionValue( m_imPreeditStartLine, m_imPreeditStart, 0, 0, 0, true \
); @@ -2994,5 +3021,7 @@ void KateViewInternal::imComposeEvent( Q
   updateView( true );
   updateCursor( cursor, true );
+  
   m_imPreeditLength = e->text().length();
+  m_imPreeditSelStart = m_imPreeditStart + e->cursorPos();
 }
 
@@ -3024,4 +3053,5 @@ void KateViewInternal::imEndEvent( QIMEv
   m_imPreeditStart = 0;
   m_imPreeditLength = 0;
+  m_imPreeditSelStart = 0;
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic