Bug 95696 - Cursor navigation should not trigger code completion window
Summary: Cursor navigation should not trigger code completion window
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: 3.0.4
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-22 22:41 UTC by Fabio Gomes de Souza
Modified: 2004-12-23 03:04 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Gomes de Souza 2004-12-22 22:41:02 UTC
Version:           3.0.4 (using KDE KDE 3.2.3)
Installed from:    Debian testing/unstable Packages
OS:                Linux

I am using KDevelop to code PHP projects. When I navigate through the code with the arrow keys, KDevelop has the following weird behaviors:

1. When I walk on the end of a word, it displays the Code Completion Window with symbols that begin with that word, as if I was typing that word. For example, if I walk to the end of an "if", it offers me ifx_connect(), ifx_close(), etc.

2. Whem I walk to the beginning of a line that begins with tabs or an empty line, it displays the same window, offering me class names, probably thinking I created that line, offering me classes to instantiate.

In both cases, the code completion pop-up window grabs the keyboard focus, so when I press Up and Down, I move the selection of the listbox instead of moving the cursor of the text editor. In case "2", if I want to go down, walking through a lot of empty or indented lines, I must press an Esc for every Down Arrow.

This kind of behavior gets in the way when you are waking through the code and is a real showstopper, at least for those developing PHP applications. Imagine a text editor that prevents you from using the arrow keys. :P

My humble opinion is:
The code completion window should not be triggered by cursor navigation. Instead, the window should be triggered only by typing text or by hitting Ctrl+Space.
Comment 1 Jens Dagerbo 2004-12-23 00:45:05 UTC
CVS commit by dagerbo: 

Make PHP code completion react to textChanged() instead of cursorPositionChanged(),
this to avoid trapping the cursor keys when simply navigating the code. 
Also added CTRL+SPACE shortcut to manually call up the completion dialog.

BUG: 95696


  M +4 -1      kdevphpsupport.rc   1.7
  M +2 -2      phpcodecompletion.cpp   1.31
  M +3 -1      phpcodecompletion.h   1.12
  M +3 -0      phpsupportpart.cpp   1.63


--- kdevelop/languages/php/kdevphpsupport.rc  #1.6:1.7
@@ -1,5 +1,8 @@
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="KPHPSupport" version="2">
+<kpartgui name="KPHPSupport" version="3">
 <MenuBar>
+  <Menu name="edit">
+    <Action name="edit_complete_text"/>
+  </Menu>
   <Menu name="build" >
     <Action name="build_execute" />

--- kdevelop/languages/php/phpcodecompletion.cpp  #1.30:1.31
@@ -124,6 +124,6 @@ void PHPCodeCompletion::setActiveEditorP
 
   disconnect(part->widget(), 0, this, 0 ); // to make sure that it is't connected twice
-  connect(part->widget(), SIGNAL(cursorPositionChanged()),
-          this, SLOT(cursorPositionChanged()));
+//  connect(part->widget(), SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged()));
+  connect( part, SIGNAL(textChanged()), this, SLOT(cursorPositionChanged()) );
   connect(part->widget(), SIGNAL(argHintHidden()), this, SLOT(argHintHided()));
   connect(part->widget(), SIGNAL(completionAborted()), this, SLOT(completionBoxHided()));

--- kdevelop/languages/php/phpcodecompletion.h  #1.11:1.12
@@ -52,6 +52,8 @@ public:
   void setActiveEditorPart(KParts::Part *part);
 
-protected slots:
+public slots:
   void cursorPositionChanged();
+  
+protected slots:  
   void argHintHided();
   void completionBoxHided();

--- kdevelop/languages/php/phpsupportpart.cpp  #1.62:1.63
@@ -116,4 +116,7 @@ PHPSupportPart::PHPSupportPart(QObject *
   m_codeCompletion = new  PHPCodeCompletion(configData, core(),codeModel());
 
+  new KAction(i18n("Complete Text"), CTRL+Key_Space, m_codeCompletion, SLOT(cursorPositionChanged()),
+        actionCollection(), "edit_complete_text");
+  
   connect(partController(), SIGNAL(activePartChanged(KParts::Part*)),
           this, SLOT(slotActivePartChanged(KParts::Part *)));


Comment 2 Fabio Gomes de Souza 2004-12-23 03:04:08 UTC
Thank you very much for this quick fix. You rock, dude!

Greetings from Brazil!