Skip to content

Commit

Permalink
github/workflows (build): avoid using grep-3.0 which crashes in windo…
Browse files Browse the repository at this point in the history
…ws-latest
  • Loading branch information
akinomyoga committed Dec 11, 2022
1 parent 85b5828 commit fb7bd0b
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 26 deletions.
4 changes: 2 additions & 2 deletions GNUmakefile
Expand Up @@ -11,7 +11,7 @@ endif
# check gawk
GAWK := $(shell which gawk 2>/dev/null || type -p gawk 2>/dev/null)
ifneq ($(GAWK),)
GAWK_VERSION := $(shell LANG=C $(GAWK) --version 2>/dev/null | head -1 | grep -Fi 'GNU Awk')
GAWK_VERSION := $(shell LANG=C $(GAWK) --version 2>/dev/null | sed -n '1{/[Gg][Nn][Uu] [Aa][Ww][Kk]/p;}')
ifeq ($(GAWK_VERSION),)
$(error Sorry, gawk is found but does not seem to work. Please install a proper version of gawk (GNU Awk).)
endif
Expand All @@ -20,7 +20,7 @@ else
ifeq ($(GAWK),)
$(error Sorry, gawk/awk could not be found. Please check your PATH environment variable.)
endif
GAWK_VERSION := $(shell LANG=C $(GAWK) --version 2>/dev/null | head -1 | grep -Fi 'GNU Awk')
GAWK_VERSION := $(shell LANG=C $(GAWK) --version 2>/dev/null | sed -n '1{/[Gg][Nn][Uu] [Aa][Ww][Kk]/p;}')
ifeq ($(GAWK_VERSION),)
$(error Sorry, gawk could not be found. Please install gawk (GNU Awk).)
endif
Expand Down
15 changes: 15 additions & 0 deletions README-ja_JP.md
Expand Up @@ -543,6 +543,19 @@ $ ble-color-show
ble-bind -f 'C-x h' 'insert-string "Hello, world!"'
```

<kbd>C-x</kbd> 等のキー表記については
[マニュアル §3.1](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A73-%E3%82%AD%E3%83%BC%E3%83%90%E3%82%A4%E3%83%B3%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0#user-content-sec-kspecs) で詳細に説明されています。
スペース・タブ・エンター・バックスペース・エスケープなどの特殊キーの表記については
[マニュアル §3.1.1](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A73-%E3%82%AD%E3%83%BC%E3%83%90%E3%82%A4%E3%83%B3%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0#user-content-sec-kspecs-ret) で説明されています:
スペースは <kbd>SP</kbd> と表現します。
タブキーは端末によって <kbd>C-i</kbd> または <kbd>TAB</kbd> と表現します。
エンター・リターンキーは端末によって <kbd>C-m</kbd> または <kbd>RET</kbd> と表現します。
バックスペースは端末によって <kbd>C-?</kbd>, <kbd>DEL</kbd>, <kbd>C-h</kbd>, または <kbd>BS</kbd> 等様々な表現があります。
<kbd>Ctrl+Return</kbd> や <kbd>Shift+Return</kbd> などの修飾された特殊キーの取り扱いについては
[マニュアル §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A73-%E3%82%AD%E3%83%BC%E3%83%90%E3%82%A4%E3%83%B3%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0#sec-modifyOtherKeys-manual) で説明されています。
お使いの端末が `modifyOtherKeys` に対応していない場合、手動で各キーの組み合わせに対応するエスケープシーケンスを設定する必要があります。


<kbd>M-c</kbd> を入力した時にコマンドを実行するには以下のようにします。

```bash
Expand Down Expand Up @@ -609,6 +622,8 @@ Bash 4.0 以降では自動補完が有効になり、予測候補が表示さ
候補を確定するには <kbd>S-RET</kbd> を入力します (編集文字列の末尾にいる時は <kbd>right</kbd>, <kbd>C-f</kbd> または <kbd>end</kbd> でも確定できます)。
表示されている候補の初めの単語だけ部分的に確定する時は <kbd>M-f</kbd> または <kbd>M-right</kbd> を入力します。
現在の候補で確定しそのままコマンドを実行する場合には <kbd>C-RET</kbd> (※お使いの端末が対応している時) を入力します。
お使いの端末が対応していない時は [マニュアル §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#sec-modifyOtherKeys-manual) を参照して下さい。


## 3.4 静的略語展開

Expand Down
15 changes: 14 additions & 1 deletion README.md
Expand Up @@ -516,6 +516,17 @@ For example, with the following setting, "Hello, world!" will be inserted on typ
ble-bind -f 'C-x h' 'insert-string "Hello, world!"'
```

The details on the key representation like <kbd>C-x</kbd> is described in [Manual §3.1](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-kspecs).
The representations of space/tab/enter/backspace/escape, etc. are described in [Manual §3.1.1](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-kspecs-ret):
The space is represented as <kbd>SP</kbd>,
the tab key is represented as <kbd>C-i</kbd> or <kbd>TAB</kbd> depending on the terminal,
the enter/return key is represented as <kbd>C-m</kbd> or <kbd>RET</kbd> depending on the terminal,
and the backspace key is represented as <kbd>C-?</kbd>, <kbd>DEL</kbd>, <kbd>C-h</kbd>, or <kbd>BS</kbd> depending on the terminal.
The representations of modified special keys such as <kbd>Ctrl+Return</kbd> and <kbd>Shift+Return</kbd> are described
in [Manual §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#sec-modifyOtherKeys-manual):
If your terminal does not support `modifyOtherKeys`, you need to manually configure the escape sequences of modified special keys.


For another example, if you want to invoke a command on typing <kbd>M-c</kbd>, you can write as follows:

```bash
Expand Down Expand Up @@ -583,7 +594,9 @@ The feature `auto-complete` is available in Bash 4.0 or later. `auto-complete` a
The suggested contents can be inserted by typing <kbd>S-RET</kbd>
(when the cursor is at the end of the command line, you can also use <kbd>right</kbd>, <kbd>C-f</kbd> or <kbd>end</kbd> to insert the suggestion).
If you want to insert only first word of the suggested contents, you can use <kbd>M-right</kbd> or <kbd>M-f</kbd>.
If you want to accept the suggestion and immediately run the command, you can use <kbd>C-RET</kbd> (if your terminal supports this special key combination).
If you want to accept the suggestion and immediately run the command, you can use <kbd>C-RET</kbd>
(if your terminal does not support special key combinations like <kbd>C-RET</kbd>, please check
[Manual §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#sec-modifyOtherKeys-manual)).

## 3.4 Use `sabbrev` (static abbrev expansions)

Expand Down
2 changes: 1 addition & 1 deletion contrib
Submodule contrib updated 1 files
+5 −0 README.md
38 changes: 20 additions & 18 deletions docs/ChangeLog.md
Expand Up @@ -111,10 +111,10 @@
- history: support extension `HISTCONTROL=strip` (motivated by aiotter) `#D1874` 021e033
- benchmark (ble-measure): support an option `-V` `#D1881` 571ecec
- color: allow setting color filter by `_ble_color_color2sgr_filter` `#D1902` 88e74cc
- auto-complete: add `bleopt complete_auto_complete_opts` (motivated by DUOLabs333) `#D1901` `#D1911` 1478a04 xxxxxxx
- menu-complete: add `bleopt complete_menu_complete_opts` (requested by DUOLabs333) `#D1911` xxxxxxx
- edit (`magic-space`): support `bleopt edit_magic_expand=...:alias` (requested by telometto) `#D1912` xxxxxxx
- auto-complete: cancel auto-complete for `magic-space` `#D1913` xxxxxxx
- auto-complete: add `bleopt complete_auto_complete_opts` (motivated by DUOLabs333) `#D1901` `#D1911` 1478a04 6a21ebb
- menu-complete: add `bleopt complete_menu_complete_opts` (requested by DUOLabs333) `#D1911` 6a21ebb
- edit (`magic-space`): support `bleopt edit_magic_expand=...:alias` (requested by telometto) `#D1912` 63da2ac
- auto-complete: cancel auto-complete for `magic-space` `#D1913` 01b4f67

## Changes

Expand Down Expand Up @@ -145,8 +145,8 @@
- edit (`display-shell-version`): show information of the OS distribution and properly handle saved locales `#D1854` 066ec63 bdb7dd6
- edit (`display-shell-version`): show `gawk`, `make`, and `git` versions of the build time `#D1892` e618133
- edit (`display-shell-version`): support running as a user command (reported by DhruvaG2000) `#D1893` e618133
- edit (`display-shell-version`): show warnings for fzf-integration `#D1907` xxxxxxx
- edit (`display-shell-version`): show the `zoxide` version `#D1907` xxxxxxx
- edit (`display-shell-version`): show warnings for fzf-integration `#D1907` 3bc3bea
- edit (`display-shell-version`): show the `zoxide` version `#D1907` 3bc3bea
- complete (`ble-sabbrev`): support colored output `#D1546` 750ca38
- decode (`ble-bind`): support colored output `#D1547` 750ca38
- decode (`ble-bind`): output bindings of the specified keymaps with `ble-bind -m KEYMAP` (fixup 750ca38) `#D1559` 6e0245a
Expand Down Expand Up @@ -186,7 +186,7 @@
- complete: do not show option descriptions for the empty-word completion (requested by geekscrapy) `#D1846` 1c7f7a1
- syntax (`extract-command`): extract unexpected command names as commands `#D1848` 5b63459
- main (`ble-reload`): preserve the original initialization options `#D1852` d8c92cc
- main (`ble-reload`): fix a bug that the default rcfile is not loaded `#D1914` xxxxxxx
- main (`ble-reload`): fix a bug that the default rcfile is not loaded `#D1914` 85b5828
- blehook: print reusable code to restore the user hooks `#D1857` b763677
- blehook: separate internal and user hooks `#D1856` b763677
- blehook: prefer the uniq `!=` to the addition `+=` `#D1871` fe7abd4
Expand All @@ -207,13 +207,13 @@
- trap: work around possible interferences by recursive traps `#D1867` a22c25b
- trap: ignore `RETURN` for `ble/builtin/trap/.handler` `#D1867` a22c25b
- trap: fix a bug that `DEBUG` for internal commands clears `$?` `#D1867` a22c25b
- trap: use `ble/util/assign/.mktmp` to read the `DEBUG` trap `#D1910` xxxxxxx
- trap: use `ble/util/assign/.mktmp` to read the `DEBUG` trap `#D1910` 1de9a1e
- progcomp: reproduce arguments of completion functions passed by Bash `#D1872` 4d2dd35
- prompt: preserve transient prompt with `same-dir` after `clear-screen` `#D1876` 69013d9
- color: let `bleopt term_index_colors` override the default if specified `#D1878` 7d238c0
- canvas: update Unicode version 15.0.0 `#D1880` 49e55f4
- decode (`vi_imap-rlfunc.txt`): update the widget for `backward-kill-word` as `kill-backward-{u => c}word` `#D1896` e19b796
- term (`_ble_term_TERM`): detect wezterm-20220408 `#D1909` xxxxxxx
- term (`_ble_term_TERM`): detect wezterm-20220408 `#D1909` 486564a

## Fixes

Expand Down Expand Up @@ -329,7 +329,7 @@
- canvas (`ble/canvas/trace`): fix text justification for empty lines (reported by rashil2000) `#D1894` cdf74c2
- main: fix adjustments of bash options (reported by rashil2000) `#D1895` 138c476
- complete: suppress error messages for non-bash_completion `_parse_help` (reported by nik312123) `#D1900` 267de7f
- prompt: fix the marker position for the readline variable `show-mode-in-prompt` (reported by Strykar) `#D1903` xxxxxxx
- prompt: fix the marker position for the readline variable `show-mode-in-prompt` (reported by Strykar) `#D1903` 09bb4d3

## Documentation

Expand All @@ -341,7 +341,8 @@
- blerc: add frequently used keybindings (motivated by KiaraGrouwstra, micimize) `#D1896` `#D1897` e19b796
- wiki/Q&A: add item for defining a widget calling multiple widgets (motivated by micimize) `#D1898` e19b796
- blerc: rename from `blerc` to `blerc.template` `#D1899` e19b796
- README: add a link to the explanation on the "more reliable setup" of bashrc (motivated by telometto) `#D1905` xxxxxxx
- README: add a link to the explanation on the "more reliable setup" of bashrc (motivated by telometto) `#D1905` 09bb4d3
- README: add links to Manual pages for *kspec* and `modifyOtherKeys` `#D1917` xxxxxxx

## Optimization

Expand Down Expand Up @@ -437,7 +438,7 @@
- history: work around broken timestamps in `HISTFILE` (reported by johnyaku) `#D1831` 5ef28eb
- progcomp: disable `command_not_found_handle` (reported by telometto, wisnoskij) `#D1834` 64d471a d5fe1d1 973ae8c
- complete: add completion integration with `zoxide` (reported by ferdinandyb) `#D1838` a96bafe
- contrib/integration/zoxide: update `contrib/integration/zoxide` for zoxide v0.8.1 `#D1907` xxxxxxx
- contrib/integration/zoxide: update `contrib/integration/zoxide` for zoxide v0.8.1 `#D1907` 3bc3bea
- util (`modifyOtherKeys`): work around delayed terminal identification `#D1842` 14f3c81
- util (`modifyOtherKeys`): fix a bug that kitty protocol is never activated `#D1842` 14f3c81
- util (`modifyOtherKeys`): pass-through kitty protocol sequences (motivated by ferdinandyb) `#D1845` f66e0c1
Expand All @@ -463,6 +464,7 @@
- util (ble/util/s2c): work around intermediate mbstate of bash <= 5.2 `#D1881` 2e1a7c1
- util (ble/util/s2bytes): clear locale cache `#D1881` 2e1a7c1
- complete: fix syntax error for bash-3.0 `#D1881` 0b3e611
- github/workflows: work around grep-3.0 which crashes in windows-latest `#D1915` xxxxxxx
- test (ble/util/writearray): use `ble/file#hash` instead of `sha256sum` `#D1882` b76e21e
- test (ble/util/readlink): work around external aliases `#D1890` 0c6291f

Expand Down Expand Up @@ -506,7 +508,7 @@
- benchmark (zsh): fix for `KSH_ARRAYS` `#D1886` a144ffa 8cb9b84
- benchmark: support for ksh as `benchmark.ksh` `#D1886` 5dae4da
- github/workflows (build): rename directory in `ble-nightly.tar.xz` to `ble-nightly` (reported by Harduex) `#D1891` f20854f 4ea2e23 43c6d4b
- edit: update prompts on g2sgr change `#D1906` xxxxxxx
- edit: update prompts on g2sgr change `#D1906` 40625ac

## Contrib

Expand All @@ -516,11 +518,11 @@
- prompt-git: ignore untracked files in submodules `#D1829` 4d24f84
- fzf-completion: fix integration (reported by ferdinandyb) `#D1837` 12c022b
- fzf-completion: remove `noquote` (reported by MK-Alias) `#D1889` 0c6291f
- README: update description on `_ble_contrib_fzf_base` (reported by Strykar) `#D1904` xxxxxxx
- fzf-initialize: check directory existence before adding it to `PATH` (reported by Strykar) `#D1904` xxxxxxx
- colorglass: add color filter `#D1902` xxxxxxx
- colorglass: add `bleopt colorglass_{saturation,brightness}` (motivated by auwsom) `#D1906` xxxxxxx
- fzf-key-bindings: fix a problem that `modifyOtherKeys` is not reflected (reported by SuperSandro2000) `#D1908` xxxxxxx
- README: update description on `_ble_contrib_fzf_base` (reported by Strykar) `#D1904` 09bb4d3
- fzf-initialize: check directory existence before adding it to `PATH` (reported by Strykar) `#D1904` 09bb4d3
- colorglass: add color filter `#D1902` 88e74cc
- colorglass: add `bleopt colorglass_{saturation,brightness}` (motivated by auwsom) `#D1906` 40625ac
- fzf-key-bindings: fix a problem that `modifyOtherKeys` is not reflected (reported by SuperSandro2000) `#D1908` 486564a

<!---------------------------------------------------------------------------->
# ble-0.4.0-devel2
Expand Down
53 changes: 50 additions & 3 deletions note.txt
Expand Up @@ -1855,6 +1855,10 @@ bash_tips
- leakvars
- keymap の移動 (これは別 commit にする?)

2022-12-09

* edit,complete: alias expansion で alias sudo='sudo ' 等による引数の展開に対応?

2022-12-03

* declare -f の出力は特殊関数名には使えないのではないか?
Expand Down Expand Up @@ -1889,8 +1893,6 @@ bash_tips
https://github.com/akinomyoga/ble.sh/issues/246#issuecomment-1294893636
ここでも少し言及している。

* colorglass: オプションで指定した時に256色(またはより少ない色に)に減色する機能?

* colorglass: face から読み取る時に作用する色設定?

現在は全ての出力に対して色を変更しているが、プロンプトのテーマを別に指定し
Expand Down Expand Up @@ -6662,6 +6664,51 @@ bash_tips
Done (実装ログ)
-------------------------------------------------------------------------------

2022-12-11

* colorglass: オプションで指定した時に256色(またはより少ない色に)に減色する機能? [#D1918]

→よく考えたら bleopt term_true_colors が設定されていなければ自動的に減色さ
れるのではないか。実際に実装を確認してみた所そうなっている。この事を
colorglass の説明に書いておくべきではないか? → 記述した。これで十分である。

* README: RET や C-RET 等について 3.1.1 及び 3.3.6 に対するリンクを含めておく [#D1917]
https://github.com/akinomyoga/ble.sh/issues/262

取り敢えずリンクと説明を書いた。

* _ble_term_TERM (comment): wezterm の commit id は 8 文字では足りない (requested by SuperSandro2000) [#D1916]
https://github.com/akinomyoga/ble.sh/commit/486564ad314cef3f95317e88cf26879378dae507

うーん。行(特に120列)に収まり切らない様な気がするが面倒なので気にしない事にする。

* github/workflows: 何故か grep が windows-latest でクラッシュする [#D1915]

別のリポジトリで試しに実行してみたがやはり再現する。最終的に以下の単純な
workflow の定義ですらクラッシュするという事が分かった。

---- .github/workflows/build.yml ------
name: grep-in-windows
on:
push:
branches:
- master

jobs:
check:
runs-on: windows-latest
steps:
- name: Check out
uses: actions/checkout@v3
- name: Check
run: echo 'GNU Awk' | grep -Fi 'GNU Awk'
---------------------------------------

grep -i や grep -F だけでは問題は発生しない。 grep -Fi や grep -F -i 等、-F
と -i を組み合わせた時にクラッシュする様だ。grep の version は GNU grep 3.0
(2017) の様である。よく分からないが面倒なので grep を使わずに実装する事にす
る。head -1 による処理も一緒に sed で処理すれば良い。

2022-12-08

* ble-reload した時に M-z が効かなくなる [#D1914]
Expand Down Expand Up @@ -6776,6 +6823,7 @@ bash_tips
[1] https://github.com/wez/wezterm/commit/ad91e3776808507cbef9e6d758b89d7ca92a4c7e

* contrib/fzf-key-bindings: C-r で呼び出した fzf で modifyOtherKeys の状態が変 (reported by SuperSandro2000) [#D1908]
https://github.com/akinomyoga/ble.sh/issues/259

xterm ですらちゃんと動いていない。以前はちゃんと動いていた筈なので
regression の可能性が高い。うーん。ちゃんと hook はできている。つまり、
Expand Down Expand Up @@ -6834,7 +6882,6 @@ bash_tips

https://github.com/ajeetdsouza/zoxide/commit/d106f4e3580d5594d8f1c96c256a8f085e2781a4


* colorglass: saturation (彩度) についての設定を追加する (motivated by auwsom) [#D1906]
https://github.com/akinomyoga/ble.sh/issues/258

Expand Down
2 changes: 1 addition & 1 deletion src/util.sh
Expand Up @@ -5721,7 +5721,7 @@ function ble/term/DA2/initialize-term {
# が付かないが、ちょうど該当 xterm version (2012-01-08) を使っている可能性は
# 低いと見て取り敢えず wezterm とする。
('0;0;0') _ble_term_TERM[depth]=wezterm:0 ;;
('1;277;0') _ble_term_TERM[depth]=wezterm:20220408 ;; # 2022-04-07 https://github.com/wez/wezterm/commit/ad91e377
('1;277;0') _ble_term_TERM[depth]=wezterm:20220408 ;; # 2022-04-07 https://github.com/wez/wezterm/commit/ad91e3776808507cbef9e6d758b89d7ca92a4c7e

('0;10;1') # Windows Terminal
# 現状ハードコードされている。
Expand Down

0 comments on commit fb7bd0b

Please sign in to comment.