Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix patterns of provide_context gets panicked#37

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Manishearth merged 1 commit intounicode-rs:masterfromjmuk:fix_panic
Mar 19, 2018

Conversation

jmuk
Copy link
Contributor

This PR fixes two cases where provide_context panics even though the previous call ofis_boundary returns a PreContext error.

The primary cause isprovide_context assumes its state as Regional or Emoji; otherwise it gets panicked with 'invalid state!'
However:

  • if the chunk starts with the cursor position, it requires pre-context forcat_before regardless of its state (and that's necessary for some cases indeed). so provide_context should fillcat_before in such case.
  • if bothcat_before andcat_after are RIS and the boundary is undecided by the chunk, it requires pre-context but it does not set its state to Regional. This is done by setting state withinhandle_regional.

This PR fixes two cases where provide_context panics even thoughthe previous call of `is_boundary` returns a PreContext error.The primary cause is `provide_context` assumes its state asRegional or Emoji; otherwise it gets panicked with 'invalid state!'However:- if the chunk starts with the cursor position, it requires  pre-context for `cat_before` (and that's necessary for some  cases indeed). so provide_context should fill `cat_before`  in such case.- if both `cat_before` and `cat_after` are RIS and the boundary  is undecided by the chunk, it requires pre-context but it does  not set its state to Regional. This is done by setting state  within `handle_regional`.
Copy link
Contributor

@raphlinusraphlinus left a comment

Choose a reason for hiding this comment

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

These changes look good to me. Thanks to jmuk for testing more thoroughly, clearly that's something I should have done.

@ManishearthManishearth merged commitc3db7a7 intounicode-rs:masterMar 19, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@raphlinusraphlinusraphlinus approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@jmuk@raphlinus@Manishearth

[8]ページ先頭

©2009-2025 Movatter.jp