lexdrill 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ef368252ef581d3e56aadeef48302fef93cae68d52e95a5bb199977ffdf30fd
4
- data.tar.gz: 7fb96023b0940dbce09e0cdb60d6561cc50ab52050c73536f777ca879f6f8c8d
3
+ metadata.gz: 5cc865e919348867e13b05201ac159f40f7f7fce166f44d31b98cd92d0db757b
4
+ data.tar.gz: c3a93dc3474fe2cafcddb60d4cd25ee3350e66c4f487c8f99878a9d09e71f01f
5
5
  SHA512:
6
- metadata.gz: 9f0786367ac59cf02606f3c6a59dec98787bb54fc938924c90321d122e8e793bff09a357220c59f4d8a3d2e705ab621ae5fbbb46fc3cc02b787aac9e38063049
7
- data.tar.gz: d7ec11ee093daff986f0dd1a08ac521bf6067f0e7debf682a8183cb940c17d5a58c5f5ef7aa68c257fdd184b09017734b03dfaad7c6c357e3f92ee64c09919bb
6
+ metadata.gz: df405a270f001707c86ad9e9e0d3104bb822e3eb337c7ab6afb0ad3a320aaf4fece4b1f727ccabfaf09f3fc804903876012f1ef348dd613473aeb962b2a1cbd4
7
+ data.tar.gz: 6849d9d157bd2c634f5687b4ac194bf3d38b2357092d1344ebc38533708723009d52e93a4445988aafe36fcfa3a61b1ec589716588c925f9115fe9d0571f0ae0
data/README.md CHANGED
@@ -110,6 +110,17 @@ everything looks correctly configured.
110
110
  hook block above, so it runs first) instead of relying on it only being in
111
111
  `~/.zlogin` / `~/.bash_profile`. It's safe to leave it in both places.
112
112
 
113
+ #### Word only shows once per session, then stops (bash)
114
+
115
+ The bash hook works by appending a `$(drill_precmd)` command substitution to
116
+ `PS1`, which bash re-evaluates on every prompt render — this is deliberate,
117
+ since some environments (notably Google Cloud Shell's `bashrc.google`)
118
+ snapshot and unconditionally overwrite `PROMPT_COMMAND` after your `.bashrc`
119
+ runs, silently dropping anything hooked in that way. If you installed an
120
+ older version of the hook and see the word print exactly once and never
121
+ again, re-run `drill hook bash` and update the line in your `.bashrc` to the
122
+ current snippet.
123
+
113
124
  ### Rhythm (`beat`)
114
125
 
115
126
  By default `next` just advances one word at a time. You can instead have it
@@ -12,14 +12,21 @@ module Lexdrill::ShellSnippet
12
12
  fi
13
13
  SNIPPET
14
14
 
15
+ # Hooks via PS1 (re-evaluated on every prompt) rather than PROMPT_COMMAND,
16
+ # since some environments (e.g. Google Cloud Shell's bashrc.google) snapshot
17
+ # and overwrite PROMPT_COMMAND after the fact, silently dropping anything
18
+ # appended to it. Output goes straight to /dev/tty so the word is never
19
+ # captured into the PS1 string itself (which would need readline's `\[..\]`
20
+ # non-printing markers to avoid cursor/line-wrap glitches from the color
21
+ # codes).
15
22
  BASH = <<~SNIPPET
16
23
  drill_precmd() {
17
24
  [ -f "$HOME/.drill.disabled" ] && return
18
- command drill next 2>/dev/null
25
+ command drill next >/dev/tty 2>/dev/null
19
26
  }
20
- case ";${PROMPT_COMMAND:-};" in
21
- *";drill_precmd;"*) ;;
22
- *) PROMPT_COMMAND="drill_precmd;${PROMPT_COMMAND}" ;;
27
+ case "$PS1" in
28
+ *'$(drill_precmd)'*) ;;
29
+ *) PS1="${PS1}"'$(drill_precmd)' ;;
23
30
  esac
24
31
  SNIPPET
25
32
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lexdrill
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lexdrill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siarhei Kisliak