in-place search-and-replace

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

in-place search-and-replace

Chris Muller-3
Squeak's ingenius solution to the search-and-replace problem has been
fixed and then improved.

The way it's supposed to work is:

  1) user selects some text
  2) user overtypes the selected text with new text
  3) then uses any combinations of cmd+g, j, or J to conduct global
search and replace operations.

         cmd+g finds the next occurrence of the original text.

         cmd+j (first press) presents the next occurrence of the
original text, scrolling it into view and selecting it.

          cmd+j (subsequent press) with the original text selected,
cmd+j now effects the replacement and then finds and selects the next
occurrence of it in the text.

         cmd+J (with Shift key) replaces all further occurrences of
the original text to the replacement text.

What changed?  Before, both cmd+j AND cmd+g used to perform the
replacement.  Cmd+g was never supposed to do that, it was a bug,
Marcel fixed it so that it only does Find Next.  That fix exposed an
awkwardness to the legacy usage of cmd+j which renders it unable to be
used in conjunction with cmd+g.  Now, it can.

Reply | Threaded
Open this post in threaded view
|

Re: in-place search-and-replace

Masato Sumi
Chris,

I also reported the find-again bug but about 10 years ago.
http://bugs.squeak.org/view.php?id=5506

I love "again" function that is a long life Smalltalk-80's feature.
I'm very happy to hear the bug was fixed.

sumim


2015-11-17 13:30 GMT+09:00 Chris Muller <[hidden email]>:

> Squeak's ingenius solution to the search-and-replace problem has been
> fixed and then improved.
>
> The way it's supposed to work is:
>
>   1) user selects some text
>   2) user overtypes the selected text with new text
>   3) then uses any combinations of cmd+g, j, or J to conduct global
> search and replace operations.
>
>          cmd+g finds the next occurrence of the original text.
>
>          cmd+j (first press) presents the next occurrence of the
> original text, scrolling it into view and selecting it.
>
>           cmd+j (subsequent press) with the original text selected,
> cmd+j now effects the replacement and then finds and selects the next
> occurrence of it in the text.
>
>          cmd+J (with Shift key) replaces all further occurrences of
> the original text to the replacement text.
>
> What changed?  Before, both cmd+j AND cmd+g used to perform the
> replacement.  Cmd+g was never supposed to do that, it was a bug,
> Marcel fixed it so that it only does Find Next.  That fix exposed an
> awkwardness to the legacy usage of cmd+j which renders it unable to be
> used in conjunction with cmd+g.  Now, it can.
>

Reply | Threaded
Open this post in threaded view
|

Re: in-place search-and-replace

David T. Lewis
Ten years, wow.

I set the issue to "resolved" in Mantis, with links to this email.

:-)

Dave

On Tue, Nov 17, 2015 at 03:10:00PM +0900, Masato Sumi wrote:

> Chris,
>
> I also reported the find-again bug but about 10 years ago.
> http://bugs.squeak.org/view.php?id=5506
>
> I love "again" function that is a long life Smalltalk-80's feature.
> I'm very happy to hear the bug was fixed.
>
> sumim
>
>
> 2015-11-17 13:30 GMT+09:00 Chris Muller <[hidden email]>:
> > Squeak's ingenius solution to the search-and-replace problem has been
> > fixed and then improved.
> >
> > The way it's supposed to work is:
> >
> >   1) user selects some text
> >   2) user overtypes the selected text with new text
> >   3) then uses any combinations of cmd+g, j, or J to conduct global
> > search and replace operations.
> >
> >          cmd+g finds the next occurrence of the original text.
> >
> >          cmd+j (first press) presents the next occurrence of the
> > original text, scrolling it into view and selecting it.
> >
> >           cmd+j (subsequent press) with the original text selected,
> > cmd+j now effects the replacement and then finds and selects the next
> > occurrence of it in the text.
> >
> >          cmd+J (with Shift key) replaces all further occurrences of
> > the original text to the replacement text.
> >
> > What changed?  Before, both cmd+j AND cmd+g used to perform the
> > replacement.  Cmd+g was never supposed to do that, it was a bug,
> > Marcel fixed it so that it only does Find Next.  That fix exposed an
> > awkwardness to the legacy usage of cmd+j which renders it unable to be
> > used in conjunction with cmd+g.  Now, it can.
> >

Reply | Threaded
Open this post in threaded view
|

Re: in-place search-and-replace

David T. Lewis
In reply to this post by Chris Muller-3
Thanks very much for this summary. I actually did not even know how
it was supposed to work.

Dave

On Mon, Nov 16, 2015 at 10:30:05PM -0600, Chris Muller wrote:

> Squeak's ingenius solution to the search-and-replace problem has been
> fixed and then improved.
>
> The way it's supposed to work is:
>
>   1) user selects some text
>   2) user overtypes the selected text with new text
>   3) then uses any combinations of cmd+g, j, or J to conduct global
> search and replace operations.
>
>          cmd+g finds the next occurrence of the original text.
>
>          cmd+j (first press) presents the next occurrence of the
> original text, scrolling it into view and selecting it.
>
>           cmd+j (subsequent press) with the original text selected,
> cmd+j now effects the replacement and then finds and selects the next
> occurrence of it in the text.
>
>          cmd+J (with Shift key) replaces all further occurrences of
> the original text to the replacement text.
>
> What changed?  Before, both cmd+j AND cmd+g used to perform the
> replacement.  Cmd+g was never supposed to do that, it was a bug,
> Marcel fixed it so that it only does Find Next.  That fix exposed an
> awkwardness to the legacy usage of cmd+j which renders it unable to be
> used in conjunction with cmd+g.  Now, it can.

Reply | Threaded
Open this post in threaded view
|

Re: in-place search-and-replace

marcel.taeumel
*hehe* I did not know that Squeak was able to search-replace everything until I saw that code. :)

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: in-place search-and-replace

Chris Muller-3
Oh my, I just noticed the possibility of a lock up (interruptable)
when using the new cmd+J.

It appears the whileTrue: loop in TextEditor>>#againUpToEnd cannot escape...

Reverting TextEditor>>#findReplaceAgain (to
TextEditor>>#findReplaceAgain) will avoid the lockup temporarily until
I can figure out a fix.

On Tue, Nov 17, 2015 at 9:15 AM, marcel.taeumel <[hidden email]> wrote:

> *hehe* I did not know that Squeak was able to search-replace everything until
> I saw that code. :)
>
> Best,
> Marcel
>
>
>
> --
> View this message in context: http://forum.world.st/in-place-search-and-replace-tp4861383p4861475.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>