Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Copy and paste with automatic replace

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
charfeddine.ahmed Posted - Nov 17 2008 : 08:41:30 AM
A very often thing done in code editing, is to copy a snippet of code, a line or even a whole bloc,let's say blocA (the source bloc to be copied) then paste it on top of a certain code bloc (let's say blocB) before it will be corrected by replacing a certain keyword from blocA by a keyword from blocB.

To do that I often use notepad as extra storage to the clipboard.

Let's formalize this :

We have a codeblocB that need be changed : for instance :

..
pParentEngine->getIntelligenceBase()->getRuleByID(ruleID)
..

codeBlocB is function of a keyword keywordB (here it is ruleID)

codeblocB=codeBlocB[keywordB]


codeblocA is as follows :
GetDirectRule(id);

so :
codeblocA=codeblocA[keywordA] where keywordA=id in this sample.


So I select codeblockA, copy it, then select codeblockB, paste codeblocA, then replace keywordA with keywordB.


To do this easily we can add a sort of "smart paste and replace" command that is shown in the popup menu when we click on the hovering button when, we select codeblockB.

when we choose the command, I expect VAssistX to ask me about the keywordB when there is an ambiguity. When things are OK then codeblockB is just in memory.

To apply the final thing, I go to codeblockA, select it, prompt the pp menu from the hovring button, then choose another smart command that will do the replacing and if there is an ambiguity about the keywordA to be restored in place of keywordB then it just but asks me to help it.

Or so do I see things. 'dreaming ? Then let Whole Tomato let the dreams come true !


5   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Nov 28 2008 : 08:23:00 AM
I still have no idea what you actually want VA to do here, or how VA could do anything helpful here.
charfeddine.ahmed Posted - Nov 27 2008 : 10:45:13 AM
Exactly.
As of how VAssist would work out the thing...I believe given some existing refactoring possibilities in VAssistX, it is also possible to do that,too..
Well, I would not imagine the thing you supposed. Because what I'm talking about is a simple theme, a simple programming process that is often repeted.
feline Posted - Nov 25 2008 : 09:17:59 AM
So the code would change from:

pParentEngine->getIntelligenceBase()->getRuleByID(ruleID)

and become:

GetDirectRule(ruleID);

?

if so then I do not understand how VA is supposed to work out what you intend. You are changing the name of the function call. You are preserving the parameters of the final function, but what if the code line had read:

pParentEngine->getIntelligenceBase(oldRuleID)->getRuleByID(ruleID)

before the paste? Then what?
charfeddine.ahmed Posted - Nov 25 2008 : 03:27:18 AM
I'd like to copy the code bloc A :
GetDirectRule(id); 


and replace the following code bloc B with it :
pParentEngine->getIntelligenceBase()->getRuleByID(ruleID)


Finally I have to change the id keyword by the ruleID one since it is the one that goes with the current context.
The above suggestion is a way to do that fast without the need to make multiple cut/pastes or the need to recorrect the replacing code.
feline Posted - Nov 24 2008 : 12:53:26 PM
I don't understand. Can you post the code you are copying, the code before the paste and the code after the paste. Then maybe I will be able to see and understand what you are asking VA to do.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000