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

Projects
None yet
3 participants
@lo48576
Copy link
Contributor

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 lo48576:feature/add-abort-to-latin-commands branch from 429f933 to b77fed7 Jan 20, 2018

@coveralls

This comment has been minimized.

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 lo48576:feature/add-abort-to-latin-commands branch from b77fed7 to cee92fc Jan 22, 2018

@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

@ueno
Copy link
Owner

ueno left a comment

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") {

This comment has been minimized.

@ueno

ueno Jan 22, 2018

Owner

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

@lo48576 lo48576 force-pushed the lo48576:feature/add-abort-to-latin-commands branch from cee92fc to f656399 Jan 22, 2018

lo48576 added a commit to lo48576/libskk that referenced this pull request Jan 22, 2018

Rename `*-passthrough` to `*-unhandled` and change variable name
  * 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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

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.

lo48576 added some commits Jan 20, 2018

Add `abort-to-latin` and `abort-to-latin-passthrough` command
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-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.
Rename `*-passthrough` to `*-unhandled` and change variable name
  * 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)>.

@lo48576 lo48576 force-pushed the lo48576:feature/add-abort-to-latin-commands branch from f656399 to 1495c4e Jan 22, 2018

@lo48576

This comment has been minimized.

Copy link
Contributor

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 approved these changes Jan 23, 2018

@ueno ueno merged commit 9ff1f89 into ueno:master Jan 23, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.09%) to 79.879%
Details

ueno added a commit that referenced this pull request Jan 23, 2018

Rename `*-passthrough` to `*-unhandled` and change variable name
  * 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

This comment has been minimized.

Copy link
Owner

ueno commented Jan 23, 2018

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

@lo48576 lo48576 deleted the lo48576:feature/add-abort-to-latin-commands branch Jan 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment