The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Neil on November 10, 2010, 12:11:53 PM

Title: Qeditor text replacement
Post by: Neil on November 10, 2010, 12:11:53 PM
I have used REPLACE TEXT many times  (Successfully) in the past but now I've come across a problem replacing text in my current program. I am renaming a label used a lot of times & qeditor only renames some of them. I've tried it many times with the same result, my question, is there a limit as to how many can be renamed at any one time? I was implementing an idea that Dave came up with a couple of days ago, so it's his fault :bg
Title: Re: Qeditor text replacement
Post by: jj2007 on November 10, 2010, 12:55:11 PM
How many times? I just tried with 370k and 76 items to be replaced, no problem.
Title: Re: Qeditor text replacement
Post by: Neil on November 10, 2010, 01:09:47 PM
One Hundred & Fifty (150)
Title: Re: Qeditor text replacement
Post by: hutch-- on November 10, 2010, 01:26:37 PM
Neil,

The replace will work up to the limit of memory on your machine. I have used it on files over 100 megabyte.
Title: Re: Qeditor text replacement
Post by: Neil on November 10, 2010, 03:15:24 PM
I've just tried again & it's now working O.K. I'm a bit baffled why it wasn't working before. I'll try it again later & see what happens.
Title: Re: Qeditor text replacement
Post by: dedndave on November 10, 2010, 03:25:49 PM
sounds like user error to me, Neil   :P
perhaps case-sensitivity is the culprit
Title: Re: Qeditor text replacement
Post by: Neil on November 10, 2010, 03:56:39 PM
Dave, you could be right but that doesn't explain why it replaced 75% of text in the first pass through & when run again it replaced the remainder. One of life's little mysteries ::)
By the way your FlagTable method works a treat & I've found another part of the program that can use it :U
Title: Re: Qeditor text replacement
Post by: hutch-- on November 10, 2010, 11:54:28 PM
Neil,

The algo does a number of things, if the replacement is the same length or shorter it simply allocates a buffer the same length as the selection, does the replacements them writes it back to the edit control. If the replacement is longer than the text being replaced it does a text count in the selection, calculates the extra length required and allocates a bigger bufffer first then it does the replacement. It will then run one of two replacement algos, a simple text replace or a whole word replace. In every case it only works on the complete selection and does the replace from beginning to end, there are no partial limitations with either algo.
Title: Re: Qeditor text replacement
Post by: Neil on November 11, 2010, 08:31:34 AM
Thanks for the explanation hutch. Can you clear up one final point, I was replacing a 4 character word with an 8 character one should I have used Normal Text Replace or Whole Word?
Title: Re: Qeditor text replacement
Post by: hutch-- on November 11, 2010, 08:50:48 AM
Neil,

Whichever you need. They are two separate algos that perform different tasks.