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

Add abort-to-latin and abort-to-latin-unhandled command #48

Merged
merged 3 commits into from
Jan 23, 2018

Conversation

lo48576
Copy link
Contributor

@lo48576 lo48576 commented Jan 20, 2018

This change and PR #47 (Escape keymap) enables us to use
"vi-cooperative" keymap.

abort-to-latin does "abort, then change to latin input mode".
If the state changes on abort or mode change, key event is consumed.

abort-to-latin-unhandled does "abort, then change to latin input
mode, and let key event pass-through when no input string is discarded".

"vi-cooperative" keymap will be achived by config such as the code below:

{
  "include": [
    "default"
  ],
  "define": {
    "keymap": {
      "Escape": "abort-to-latin-unhandled",
    }
  }
}

abort-to-latin-unhandled does not consume the key event even if the
state changed.
So, when the user type "C-j Esc" under the config above, application
will receive "Esc" key event, in contrast to abort-to-latin command.

@lo48576 lo48576 force-pushed the feature/add-abort-to-latin-commands branch from 429f933 to b77fed7 Compare January 20, 2018 18:17
@coveralls
Copy link

coveralls commented Jan 20, 2018

Coverage Status

Coverage increased (+0.09%) to 79.879% when pulling 1495c4e on lo48576:feature/add-abort-to-latin-commands into 94e57ba on ueno:master.

@lo48576 lo48576 changed the title Add abort-to-latin and abort-to-latin-passthrough command [WIP] Add abort-to-latin and abort-to-latin-passthrough command Jan 22, 2018
@lo48576 lo48576 force-pushed the feature/add-abort-to-latin-commands branch from b77fed7 to cee92fc Compare January 22, 2018 14:52
@lo48576 lo48576 changed the title [WIP] Add abort-to-latin and abort-to-latin-passthrough command Add abort-to-latin and abort-to-latin-passthrough command Jan 22, 2018
Copy link
Owner

@ueno ueno left a comment

Choose a reason for hiding this comment

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

I would like to have a test case for this; you can put a custom rule in tests/rules and check it with check_transitions.

bool retval;
if (command == "abort" ||
command == "abort-to-latin" ||
command == "abort-to-latin-passthrough") {
Copy link
Owner

Choose a reason for hiding this comment

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

There is commit-unhandled where -unhandled means the same thing as -passthrough here. I rather like the latter, though.

@lo48576 lo48576 force-pushed the feature/add-abort-to-latin-commands branch from cee92fc to f656399 Compare January 22, 2018 15:26
lo48576 pushed a commit to lo48576/libskk that referenced this pull request Jan 22, 2018
  * Renamed `abort-to-latin-passthrough` command to
    `abort-to-latin-unhandled`
  * Renamed a variable `allow_passthrough` to `event_handled`.
    Note that they use inverse values to represent states,
    i.e. "event is handled" means "passthrough is *NOT* allowed",
    and vice versa.

See <ueno#48 (comment)>.
@lo48576
Copy link
Contributor Author

lo48576 commented Jan 22, 2018

  • Amended commit message a bit.
  • Renamed to abort-to-latin-unhandled.
  • Used more appropriate variable name (see the 2nd commit message).

I'm going to write a test.

@lo48576
Copy link
Contributor Author

lo48576 commented Jan 22, 2018

I realized that I can't write complete tests because of #49 (it prevents me from using custom rule during dict edit)... orz
I'll fix it first.

YOSHIOKA Takuma added 3 commits January 23, 2018 02:11
This change and PR ueno#47 (`Escape` keymap) enables us to use
"vi-cooperative" keymap.

`abort-to-latin` does "`abort`, then change to latin input mode".
If the state changes on abort or mode change, key event is consumed.

`abort-to-latin-passthrough` does "`abort`, then change to latin input
mode, and let key event pass-through when no input string is discarded".

"vi-cooperative" keymap will be achived by config such as the code below:

```json
{
  "include": [
    "default"
  ],
  "define": {
    "keymap": {
      "Escape": "abort-to-latin-passthrough",
    }
  }
}
```

`abort-to-latin-passthrough` does not consume the key event even if the
state changed.
So, when the user type "C-j Esc" under the config above, application
will receive "Esc" key event, in contrast to `abort-to-latin` command.
  * Renamed `abort-to-latin-passthrough` command to
    `abort-to-latin-unhandled`
  * Renamed a variable `allow_passthrough` to `event_handled`.
    Note that they use inverse values to represent states,
    i.e. "event is handled" means "passthrough is *NOT* allowed",
    and vice versa.

See <ueno#48 (comment)>.
@lo48576 lo48576 force-pushed the feature/add-abort-to-latin-commands branch from f656399 to 1495c4e Compare January 22, 2018 17:11
@lo48576
Copy link
Contributor Author

lo48576 commented Jan 22, 2018

Added tests, but they can't (or I don't know how to) represent "unhandled" key event behaviour.

@lo48576 lo48576 changed the title Add abort-to-latin and abort-to-latin-passthrough command Add abort-to-latin and abort-to-latin-unhandled command Jan 22, 2018
@ueno ueno merged commit 9ff1f89 into ueno:master Jan 23, 2018
ueno pushed a commit that referenced this pull request Jan 23, 2018
  * Renamed `abort-to-latin-passthrough` command to
    `abort-to-latin-unhandled`
  * Renamed a variable `allow_passthrough` to `event_handled`.
    Note that they use inverse values to represent states,
    i.e. "event is handled" means "passthrough is *NOT* allowed",
    and vice versa.

See <#48 (comment)>.
@ueno
Copy link
Owner

ueno commented Jan 23, 2018

OK, I will adjust the test later; thanks anyway!

@lo48576 lo48576 deleted the feature/add-abort-to-latin-commands branch January 23, 2018 11:17
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.

3 participants