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

List:       kde-commits
Subject:    kdevelop/parts/qeditor
From:       Roberto Raggi <raggi () cli ! di ! unipi ! it>
Date:       2003-01-30 17:37:29
[Download RAW message or body]

CVS commit by raggi: 

now you can use Tab or Space to complete a word


  M +13 -5     gotolinedialog.ui.h   1.3
  M +8 -2      qeditorcodecompletion.cpp   1.8


--- kdevelop/parts/qeditor/gotolinedialog.ui.h  #1.2:1.3
@@ -21,4 +21,12 @@ void GotoLineDialog::setEditor( QEditor*
 {
         m_editor = editor;
+    
+    if( !m_editor )
+        return;
+    
+    int line, col;
+    m_editor->getCursorPosition( &line, &col );
+    spinLineNumber->setValue( line+1 );
+    spinLineNumber->selectAll();
 }
 

--- kdevelop/parts/qeditor/qeditorcodecompletion.cpp  #1.7:1.8
@@ -203,5 +203,5 @@ bool QEditorCodeCompletion::eventFilter(
             return false;
         }
-        if( ke->key() == Key_Enter || ke->key() == Key_Return ) {
+        if( ke->key() == Key_Enter || ke->key() == Key_Return || ke->key() == \
Key_Space || ke->key() == Key_Tab ) {  CompletionItem* item = \
                static_cast<CompletionItem*>(
                 m_completionListBox->item(m_completionListBox->currentItem()));
@@ -237,5 +237,11 @@ bool QEditorCodeCompletion::eventFilter(
         // redirect the event to the editor
         QApplication::sendEvent( m_view->editor(), e );
-        if( m_colCursor + m_offset > m_view->cursorColumnReal() ) {
+        
+        QString currentLine = m_view->currentTextLine();
+        int len = m_view->cursorColumnReal() - m_colCursor;
+        QString currentComplText = currentLine.mid( m_colCursor, len );
+        
+        if( m_colCursor + m_offset > m_view->cursorColumnReal() ||
+            (m_completionListBox->count() == 1 && m_completionListBox->currentText() \
== currentComplText) ) {  // the cursor is too far left
             kdDebug(9032) << "Aborting Codecompletion after sendEvent" << endl;


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

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