Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: meow-search auto reverse direction when enter grab-selection in backward search #373

Closed
liuyinz opened this issue Nov 30, 2022 · 6 comments

Comments

@liuyinz
Copy link
Contributor

liuyinz commented Nov 30, 2022

Reproduce:

  • text example:
  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

   To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
  1. meow-grab 2nd paragraph
  2. meow-mark-word text "or" in 4th paragraph
  3. meow-reverse change direction, meow-search backward
  4. when you jump onto last "or" in the grab region, then press meow-search again, it will reverse the direction automatically. you need to meow-reverse again to continue search backward.
  5. if you search into grab region from the first paragraph with direction forward, it won't change direction.
  6. I guess maybe in grab region, it may reset the search direction automatically.
@eshrh
Copy link
Member

eshrh commented Dec 1, 2022

reproduced. that's really wacky, I'll investigate... if i had to guess this is an edge case coming from recent changes to meow--direction-backward-p.

Edit:

Here's the problem

  1. cursor enters the beacon area
  2. tries to switch to beacon state
  3. meow--cancel-selection is called: this disables the region, and sets meow--backward-p (the no-region fallback var) to nil.
  4. meow--direction-backward-p returns nil
  5. searches forward.

I think the answer here then is to not set meow--backward-p to nil when entering beacon? Not sure if this has other consequences.

@liuyinz
Copy link
Contributor Author

liuyinz commented Dec 1, 2022

And face weired too. When you search forward into grab-region, the match candidates keep meow-search-highlght face don't change. But if you enter in backward search and stick on direction, it suddenly switch to region face.

What I think reasonable logic should be:

  1. when you meow-search into beacon area, don't change direction.
  2. when you meow-mark-* and meow-visit something, all matchs should be highlighted with meow-search-highlight, but when meow-search into beacon area, matchs inside area change to region face automatically; and when you search out, restore highlight.

@DogLooksGood
Copy link
Collaborator

There are two cases when entering BEACON.

  1. The secondary selection is already there, cursor just enters the region.
  2. The secondary selection is just created.

I guess preserving the direction variable doesn't work.

@liuyinz
Copy link
Contributor Author

liuyinz commented Dec 2, 2022

Sorry, I mistake region face and secondary-selection face in last comment. What I test is case one.

@DogLooksGood
Copy link
Collaborator

DogLooksGood commented Dec 2, 2022

@eshrh It seems that the L90 in meow-core.el is not necessary. We don't have to cancel selection there.

@eshrh eshrh closed this as completed in 3247b9d Dec 17, 2023
@eshrh
Copy link
Member

eshrh commented Dec 17, 2023

Did some testing and i don't think it causes any problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants