Skip to content

Commit

Permalink
history, syntax: use "mapfile -d ''" in bash-5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Jun 12, 2021
1 parent 9badb5f commit 72c274e
Show file tree
Hide file tree
Showing 5 changed files with 539 additions and 108 deletions.
12 changes: 5 additions & 7 deletions lib/core-syntax.sh
Expand Up @@ -1329,13 +1329,11 @@ function ble/syntax:bash/simple-word/eval/.print-result {
# でデータを親シェルに転送する。Cygwin では mapfile/read が unbuffered で遅
# いので、ファイル数が遅くても quote&eval を使う。

# # もし mapfile -d "" が buffered になったら以下のコードを使用したい。
# if ((_ble_bash>=50200)); then
# printf '%s\0' "$@" >| "$__ble_simple_word_tmpfile"
# ble/util/print 'ble/util/readarray -d "" __ble_ret < "$__ble_simple_word_tmpfile"'
# return 0
# fi
if ((_ble_bash>=40000)); then
if ((_ble_bash>=50200)); then
printf '%s\0' "$@" >| "$__ble_simple_word_tmpfile"
ble/util/print 'ble/util/readarray -d "" __ble_ret < "$__ble_simple_word_tmpfile"'
return 0
elif ((_ble_bash>=40000)); then
ret=("$@")
ble/util/writearray --nlfix ret >| "$__ble_simple_word_tmpfile"
ble/util/print 'ble/util/readarray --nlfix __ble_ret < "$__ble_simple_word_tmpfile"'
Expand Down
50 changes: 28 additions & 22 deletions memo/ChangeLog.md
Expand Up @@ -29,7 +29,7 @@
- syntax: properly support case patterns `#D1474` `#D1475` `#D1476` 64b55b7
- keymap/vi: add `ble/keymap:vi/script/get-mode` for user-defined mode strings `#D1488` f25a6e8 462918d
- prompt: support multiline `prompt_rps1` `#D1502` 4fa139a
- canvas: fix wrong coordinate calculation on linefolding `#D1602` 0000000
- canvas: fix wrong coordinate calculation on linefolding (reported by telometto) `#D1602` 9badb5f
- syntax: support tilde expansions in parameter expansions `#D1513` 0506df2
- decode: support `ble-bind -m KEYMAP --cursor DECSCUSR` (motivated by jmederosalvarado) `#D1514` `#D1515` `#D1516` 79d671d
- edit: support `nsearch` options (motivated by Alyetama, rashil2000, carv-silva) `#D1517` 9125795
Expand All @@ -42,18 +42,18 @@
- syntax: support undocumented `${a~}` and `${a~~}` `#D1561` 4df29a6
- lib: support `lib/vim-airline` (motivated by huresche) `#D1565` da1d0ff
- util (`ble/gdict`): refactor `#D1569` 7732eed
- vim-airline: support `bleopt vim_airline_theme` `#D1589` 0000000
- prompt: track dependencies and detect changes `#D1590` `#D1591` 0000000
- prompt: preserve `LINES` and `COLUMNS` for custom sequences `#D1592` 0000000
- color: fix the face initialiation order for uses in prompts (motivated by jmederosalvarado) `#D1593` 0000000
- prompt: support `contrib/prompt-git` dirty checking `#D1601` 0000000
- vim-airline: support `bleopt vim_airline_theme` `#D1589` 73b037f
- prompt: track dependencies and detect changes `#D1590` `#D1591` cf8d949
- prompt: preserve `LINES` and `COLUMNS` for custom sequences `#D1592` 040016d
- color: fix the face initialiation order for uses in prompts (motivated by jmederosalvarado) `#D1593` 321371f
- prompt: support `contrib/prompt-git` dirty checking `#D1601` b2713d9
- util, color: refactor configuration interfaces (`bleopt`, `blehook`, `ble-face`) `#D1568` c94d292
- color: support new face setting function `ble-face`
- util (`bleopt`): support option `-r` and `-u` and wildcards in option names
- util (`blehook`): hide internal hooks by default and support option `-a`
- util, color: fix argument analysis of `bleopt`, `blehook`, and `ble-face` (fixup c94d292) `#D1571` bb53271
- util (`blehook`): show explicitly specified internal hooks `#D1594` 0000000
- util (`bleopt`): do no select obsoleted options by wildcards `#D1595` 0000000
- util (`blehook`): show explicitly specified internal hooks `#D1594` f4312df
- util (`bleopt`): do no select obsoleted options by wildcards `#D1595` f4312df
- progcomp: support quoted commands and better `progcomp_alias` `#D1581` `#D1583` dbe87c3
- syntax: highlight quotes of the `\?` form `#D1584` 5076a03

Expand All @@ -63,13 +63,6 @@
- complete: do not quote `:` and `=` in non-filename completions generated by progcomp (reported by 3ximus) `#D1434` d82535e
- edit: preserve the state of `READLINE_{LINE,POINT,MARK}` `#D1437` 8379d4a
- edit: change default behavior of <kbd>C-w</kbd> and <kbd>M-w</kbd> to operate on backward words `#D1448` 47a3301
- syntax (`layer:syntax/word`): perform pathname expansions in background subshells (motivated by 3ximus) `#D1449` 13e7bdd
- syntax (`simple-word/is-simple-noglob`): suppress error messages on expansions `#D1461` a56873f
- syntax (`simple-word/eval`): fix unperformed tilde expansions in the background (reported by 3ximus) `#D1463` 6ebec48
- syntax (`simple-word/eval`): propagate timeouts in sync highlighting (reported by 3ximus) `#D1465` c2555e2
- edit: change the priority of `render-defer` and `menu-filter` `#D1501` aae553c
- complete: perform pathname expansions in subshells (motivated by 3ximus) `#D1450` d511896
- complete: support `bleopt complete_timeout_compvar` to time out pathname expansions for `COMP_WORDS` / `COMP_LINE` `#D1457` cc2881a
- prompt: rename `bleopt prompt_{status_line => term_status}` `#D1462` cca1cbc
- edit (`ble/builtin/read`): cancel by <kbd>C-d</kbd> on an empty line `#D1473` ecb8888
- syntax: change syntax context after `time ;` and `! ;` for Bash 4.4 `#D1477` 4628370
Expand All @@ -80,12 +73,10 @@
- util (`bleopt`): validate initial user settings `#D1511` 82c5ece
- util (`bleopt`): fix a bug that old values are double-expanded on init (fixup 82c5ece) `#D1521` f795c07
- util (`bleopt`): do not validate obsoleted initial settings `#D1527` 032f6b2
- complete (`ble/complete/source:file`): remove slow old codes (reported by timjrd) `#D1512` e5be0c1
- main: preserve user-space overridden builtins `#D1519` 0860be0
- util (`ble/util/type`): fix a bug that aliases are not properly highlighted (reported by 3ximus) `#D1526` 45b30a7
- main: preserve user's `expand_aliases` and allow aliases in internal space (fixup 0860be0) `#D1574` afc4112
- main: main: fix expand_aliases unset on ble-reload (fixup afc4112) `#D1577` 3417388
- syntax (`ble/syntax:bash/simple-word/eval`): optimize large array passing (motivated by timjrd) `#D1522` c89aa23
- main: accept non-regular files as `blerc` and add option `--norc` `#D1530` 7244e2f
- prompt: let `stderr` pass through to tty in evaluating `PS0` (reported by tycho-kirchner) `#D1541` 24a88ce
- prompt: adjust behavior of `LINENO` and prompt sequence `\#` (reported by tycho-kirchner) `#D1542` 8b0257e
Expand Down Expand Up @@ -137,8 +128,26 @@
- syntax: fix a bug that argument completion is attempted in nested commands (reported by huresche) `#D1579` 301d40f
- edit (brackated-paste): fix incomplete `CR => LF` conversion (reported by alborotogarcia) `#D1587` 8d6da16
- main (adjust-bash-options): adjust `LC_COLLATE=C` `#D1588` e87ac21
- highlight (`layer:region`): fix blocked lower-layer changes without selection changes `#D1596` 0000000
- complete (`auto-menu`): fix sleep loops by clock/sclock difference `#D1597` 0000000
- highlight (`layer:region`): fix blocked lower-layer changes without selection changes `#D1596` 5ede3c6
- complete (`auto-menu`): fix sleep loops by clock/sclock difference `#D1597` 53dd018
- history: fix a bug that history data is cleared on `history -r` `#D1605` 0000000

## Optimization

- syntax (`layer:syntax/word`): perform pathname expansions in background subshells (motivated by 3ximus) `#D1449` 13e7bdd
- syntax (`simple-word/is-simple-noglob`): suppress error messages on expansions `#D1461` a56873f
- syntax (`simple-word/eval`): fix unperformed tilde expansions in the background (reported by 3ximus) `#D1463` 6ebec48
- syntax (`simple-word/eval`): propagate timeouts in sync highlighting (reported by 3ximus) `#D1465` c2555e2
- edit: change the priority of `render-defer` and `menu-filter` `#D1501` aae553c
- complete: perform pathname expansions in subshells (motivated by 3ximus) `#D1450` d511896
- complete: support `bleopt complete_timeout_compvar` to time out pathname expansions for `COMP_WORDS` / `COMP_LINE` `#D1457` cc2881a
- complete (`ble/complete/source:file`): remove slow old codes (reported by timjrd) `#D1512` e5be0c1
- syntax (`ble/syntax:bash/simple-word/eval`): optimize large array passing (motivated by timjrd) `#D1522` c89aa23
- syntax (`ble/syntax:bash/simple-word/eval`): use `mapfile -d ''` for Bash 5.2 `#D1604` 0000000
- main: prefer `nawk` over `mawk` and `gawk` `#D1523` `#D1524` c89aa23
- main (`ble/bin/.freeze-utility-path`): fix unupdated temporary implementations `#D1528` c70a3b4
- util (`ble/util/assign`): work around subshell conflicts `#D1578` 6e4bb12
- history: use `mapfile -d ''` to load history in Bash 5.2 `#D1603` 0000000

## Compatibility

Expand Down Expand Up @@ -170,9 +179,6 @@
- util, etc: ensure each function to work with arbitrary `IFS` `#D1490` `#D1491` 5f9adfe
- tui, canvas (`ble/canvas/trace`): support `opts=clip` `#D1493` 61ce90c
- tui, edit: add a new render mode for full-screen applications 817889d
- main: prefer `nawk` over `mawk` and `gawk` `#D1523` `#D1524` c89aa23
- main (`ble/bin/.freeze-utility-path`): fix unupdated temporary implementations `#D1528` c70a3b4
- util (`ble/util/assign`): work around subshell conflicts `#D1578` 6e4bb12
- test (`test-canvas`): fix dependency on `ext/contra` `#D1525` c89aa23
- util: inherit special file descriptors `#D1552` 98835b5
- util: fix a bug that old tty is used in new sessions `#D1586` 0e55b8e
Expand Down

0 comments on commit 72c274e

Please sign in to comment.