Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

Preprocessor Completion

(1/1)

Alpha:
Attached is a patch that modifies CC's behavior for preprocessor completion.

* Completing headers and PP directives have icons
* PP tokens are available after an #ifdef (and such)
* Typing a "#" in, for example, Python (any non C-family language), will not trigger PP directive listing
* Comments on the same line as a completing PP directive are not deleted
* Completing headers and PP directives activates/works more reliably
* Undo actions are not unnecessarily generated when CC makes no change
* Auto-completion box refines its listing of header files every directory
* Keyboard shortcuts Ctrl-Enter and Shift-Enter do not conflict with auto-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 :).)

ollydbg:
Question on the documents:

--- Quote ---Undo actions are not unnecessarily generated when CC makes no change
--- End quote ---
What does this means?
Undo actions are necessarily generated when CC makes no change?

Alpha:

--- Quote from: ollydbg on December 02, 2012, 04:58:54 am ---Undo actions are necessarily generated when CC makes no change?

--- End quote ---

--- 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)

--- End code ---
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.

Alpha:
As it seems not much discussion has been generated, submitted patch 3391 (contains a few extra in-line comments, and prevents Undo Ctrl-Z from conflicting with auto-completion, but no other changes).

Navigation

[0] Message Index

Go to full version