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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not move right when char is not valid for rule #357

Merged
merged 1 commit into from May 25, 2023

Conversation

bew
Copy link
Contributor

@bew bew commented May 16, 2023

The issue was that when checking if we should move right, the current char was never checked to be valid for the current rule.

Fixes #331

I didn't manage to run the tests locally, this is why I made many commits & used the CI to test 馃憖

Only 1 test is failing, and I don't understand why, see the comment below

@bew bew marked this pull request as draft May 16, 2023 21:52
end,
key = [[(]],
before = [[$|$]],
after = [[$(|)$]]
Copy link
Contributor Author

@bew bew May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test does not pass, the ( does not pair but I don't understand why..

Adding some debugs, it seems the can_pair call of ( returns false in this case, but looking at the code I don't understand why 馃

@windwp any insight?

Fail	||	autopairs  test do not move right on non-end-pair char	
            ./tests/test_utils.lua:67: 
            
             text error: do not move right on non-end-pair char
            
            Expected objects to be the same.
            Passed in:
            (string) '$($'
            Expected:
            (string) '$()$'
            
            stack traceback:
            	./tests/test_utils.lua:67: in function 'compare_text'
            	./tests/test_utils.lua:156: in function <./tests/test_utils.lua:95>

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ is include on default value ignored_next_char so that test case will not work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That finally explains it, thanks! I used another symbol for that test.

@bew bew marked this pull request as ready for review May 16, 2023 23:59
@bew bew changed the title Do not move right on non-end-pair char Do not move right when char is not valid for rule May 16, 2023
@bew bew mentioned this pull request May 18, 2023
@bew bew force-pushed the fix-move-with-other-pairs branch from 0f3e6bd to 37383a1 Compare May 19, 2023 10:44
@bew bew force-pushed the fix-move-with-other-pairs branch from 37383a1 to 8cda6c0 Compare May 19, 2023 10:57
@bew
Copy link
Contributor Author

bew commented May 19, 2023

I rebased this PR for a clean merge if you want.
What do you think?

@windwp windwp merged commit 59df87a into windwp:master May 25, 2023
1 check passed
@windwp
Copy link
Owner

windwp commented May 25, 2023

Ok thanks 馃憤

@bew bew deleted the fix-move-with-other-pairs branch May 26, 2023 07:40
bew added a commit to bew/dotfiles that referenced this pull request May 30, 2023
bew added a commit to bew/dotfiles that referenced this pull request Dec 17, 2023
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

Successfully merging this pull request may close these issues.

Move with other pairs
2 participants