Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: Alpha on November 29, 2012, 12:11:54 am

Title: Preprocessor Completion
Post by: Alpha on November 29, 2012, 12:11:54 am
Attached is a patch that modifies CC's behavior for preprocessor completion.

If anyone has time to test, I would appreciate some feedback on these modifications.  (My local copy seems to have been accumulating some changes, so I thought I would share :).)
Title: Re: Preprocessor Completion
Post by: ollydbg on December 02, 2012, 04:58:54 am
Question on the documents:
Quote
Undo actions are not unnecessarily generated when CC makes no change
What does this means?
Undo actions are necessarily generated when CC makes no change?

Title: Re: Preprocessor Completion
Post by: Alpha on December 03, 2012, 04:06:20 am
Undo actions are necessarily generated when CC makes no change?
Code
@@ -1435,7 +1518,8 @@
                     itemText << _T('>');
             }
 
-            control->ReplaceTarget(itemText);
+            if (control->GetTextRange(startPos, curPos) != itemText)
+                control->ReplaceTarget(itemText);
             control->GotoPos(startPos + itemText.Length());
 
             if (needReparse)
The current system can create two undo actions when completing a PP command (1: delete rest of line, 2: insert new token), this is now condensed to one step.
The current system also will create an undo action if the resulting text is no different than what it first was.  For example, open a source file, click on a token, press Ctrl-Space (call CC), and select the same token from the list.  The current line looks no different, but an undo action is generated, and the line/file is marked as modified.
Title: Re: Preprocessor Completion
Post by: Alpha on December 06, 2012, 02:32:29 am
As it seems not much discussion has been generated, submitted patch 3391 (http://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=3391&group_id=5358) (contains a few extra in-line comments, and prevents Undo Ctrl-Z from conflicting with auto-completion, but no other changes).