Bug 55276 - autocompletion part has strange behavior
Summary: autocompletion part has strange behavior
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 52746 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-02-27 15:22 UTC by Caleb Tennis
Modified: 2006-10-31 21:05 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Fix to katepart for unhelpful code completion / undo behaviour (1.12 KB, patch)
2003-11-22 10:13 UTC, Hamish Rodda
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Caleb Tennis 2003-02-27 15:22:41 UTC
Version:           cvs (using KDE KDE 3.1)
Installed from:    Compiled From Sources
Compiler:          gcc 2.95 
OS:          Linux

The autocompletion is very annoying now. It's nice that it remembers the typed 
 strings, but: 
 a. ctrl-space does not give me the autocompletion list in some cases (eg. 
 I have a class Foo with static method foo_method), after I type Foo::f and 
 ctrl-space, it will not give me a list with foo_method inside 
 
 b. pops up automatically after the 3rd entered char, which is nice sometimes, 
 but why cannot I get the same after the first letter with ctrl-space? 
 
 c. the automatic popup if more than 3 chars are entered is annoyin when you 
 try to undo what you have typed (with Ctrl-Z). It pops up after every Ctrl-Z 
 step and you must press ESC to disappears, otherwise CTRL-Z will not work 
 again. :-( 
 
(From Mantia Andras)
Comment 1 Amilcar do Carmo Lucas 2003-06-30 11:25:16 UTC
This is related to 52746 
Comment 2 Amilcar do Carmo Lucas 2003-11-03 14:21:12 UTC
a) Fixed
b) Fixed
c) Not fixed, but you can use backspace!

AFAIK Roberto was the one that fixed it.
Comment 3 Jens Dagerbo 2003-11-03 16:21:49 UTC
After some arguing we reopen this bug...
Comment 4 Jens Dagerbo 2003-11-03 16:23:59 UTC
... and reassign it to katepart.

If Kate has a completion box open, and the user produces an undo event, should it not be up to Kate to do the correct thing here? (Which would be to close the completion box and execute one undo step.)
Comment 5 Jens Dagerbo 2003-11-04 04:41:44 UTC
*** Bug 52746 has been marked as a duplicate of this bug. ***
Comment 6 Jason Keirstead 2003-11-04 04:50:38 UTC
>If Kate has a completion box open, and the user produces an undo event, should
>it not be up to Kate to do the correct thing here? (Which would be to close
>the completion box and execute one undo step.) 

Actually IMHO this isn't even close to the right behaviour. An auto-complete box should not be being generated from an undo in the first place IMO, that will just result in a myrid of boxes appearing and disappearing all over the place while you hold down Ctrl+z to undo a bunch of stuff, thus slowing the UI down needlessly.

I don't know why an atuo-complete box should be created for any text that wasn't the result of the user typing.

Comment 7 Jens Dagerbo 2003-11-14 05:27:30 UTC
I agree that KDevelop doesn't do this gracefully, but I still think the main part of the problem 
Comment 8 Jens Dagerbo 2003-11-14 05:37:46 UTC
bleh. hit the wrong button.. :)

I agree that KDevelop doesn't do this gracefully, but I still think the main part of the problem lies with Kate, as:

1. KDevelop doesn't immediately trigger the autocompletion box after an undo, it's only after the regular timeout it happens, and so it is quite possible to undo past a triggerpoint - you only need to be quick enough :)

2. It's very hard, if not impossible, for KDevelop to know that the textChanged() signal it receives is a result of an undo operation.

3. The "multiple undo" case isn't the only to hit upon this issue. It's quite possible to mistype and receive an autocomplete box as a result and then, again, you can't undo your way out of it (using ctrl+z or whatever the shortcut happens to be, it is possible with the toolbar button).

So, IMHO and without knowing anything about the Kate code in question, if katepart simply closes the autocompletion box when the user hits the undo shortcut, the major part of this problem is solved.

Comment 9 Jason Keirstead 2003-11-14 05:50:13 UTC
Subject: Re:  autocompletion part has strange behavior

On November 14, 2003 12:37 am, Jens Dagerbo wrote:
> So, IMHO and without knowing anything about the Kate code in question, if
> katepart simply closes the autocompletion box when the user hits the undo
> shortcut, the major part of this problem is solved.
 

Yes... when the user hits undo, the autocompletion box should close and the last char
typed should be reverted. This would totally solve the bug.

Comment 10 Hamish Rodda 2003-11-22 10:13:12 UTC
Created attachment 3336 [details]
Fix to katepart for unhelpful code completion / undo behaviour

Not a particularly nice looking patch, but this does the job - can someone
review?  Apply in kdelibs/kate/part.  Thanks.
Comment 11 Christoph Cullmann 2003-11-22 14:34:13 UTC
Subject: Re:  autocompletion part has strange behavior

> ------- Additional Comments From rodda@kde.org  2003-11-22 10:13 -------
> Created an attachment (id=3336)
>  --> (http://bugs.kde.org/attachment.cgi?id=3336&action=view)
> Fix to katepart for unhelpful code completion / undo behaviour
>
> Not a particularly nice looking patch, but this does the job - can someone
> review?  Apply in kdelibs/kate/part.  Thanks.
solves the problem, at least for the moment ;) please commit

Comment 12 Hamish Rodda 2003-11-23 06:17:49 UTC
Subject: kdelibs/kate/part

CVS commit by rodda: 

Fix undo functionality with code completion active.

Reviewed by Christoph Cullmann <cullmann@babylon2k.de>

CCMAIL: 55276-done@bugs.kde.org


  M +10 -4     katecodecompletion.cpp   1.32


--- kdelibs/kate/part/katecodecompletion.cpp  #1.31:1.32
@@ -203,7 +203,11 @@ bool KateCodeCompletion::eventFilter( QO
     }
 
+    int qtKeyCode = ke->key() | ((ke->state() & Qt::ShiftButton) ? Qt::SHIFT : 0) | ((ke->state() & Qt::ControlButton) ? Qt::CTRL : 0) | ((ke->state() & Qt::AltButton) ? Qt::ALT : 0) | ((ke->state() & Qt::MetaButton) ? Qt::META : 0);
+
     // redirect the event to the editor
     if( ke->key() == Key_Backspace) {
       m_view->backspace();
+    } else if (qtKeyCode == m_view->m_editUndo->shortcut().keyCodeQt()) {
+      m_view->m_editUndo->activate();
     } else {
       QApplication::sendEvent( m_view->m_viewInternal, e );


Comment 13 Henry Stanaland 2006-10-31 21:05:04 UTC
It seems like this problem is back.  With Kate 2.5.5 (KDE 3.5.5), when I hit Ctrl-Z to undo a word I just typed, the autocompletion box stays open.