Skip to content

Commit

Permalink
complete/mandb: fix BS contamination used by nroff to represent bold
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Dec 9, 2020
1 parent 98fbc1c commit b5c875a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
8 changes: 5 additions & 3 deletions lib/core-complete.sh
Expand Up @@ -2611,8 +2611,10 @@ function ble/complete/mandb/.generate-cache {
line = $0;
gsub(/\x1b\[[ -?]*[@-~]/, "", line); # CSI seq
gsub(/\x1b[ -/]*[0-~]/, "", line); # ESC seq
gsub(/\x0E/, "", line);
gsub(/\x0F/, "", line);
gsub(/.\x08/, "", line); # CHAR BS
gsub(/\x0E/, "", line); # SO
gsub(/\x0F/, "", line); # SI
gsub(/[\x00-\x1F]/, "", line); # 制御文字は結局全削除
gsub(/^[[:space:]]*|[[:space:]]*$/, "", line);
#gsub(/[[:space:]]+/, " ", line);
if (line == "") next;
Expand All @@ -2637,7 +2639,7 @@ function ble/complete/mandb/.generate-cache {
function ble/complete/mandb/load-cache {
local command=${1##*/}
local fcache=$_ble_base_cache/man/$command
if [[ ! -s $fcache ]]; then
if ! [[ -s $fcache && $fcache -nt $_ble_base/lib/core-complete.sh ]]; then
[[ -d $_ble_base_cache/man ]] ||
ble/bin/mkdir -p "$_ble_base_cache/man"
ble/complete/mandb/.generate-cache "$command" >| "$fcache" &&
Expand Down
5 changes: 3 additions & 2 deletions memo/ChangeLog.md
Expand Up @@ -9,8 +9,9 @@

## Fixes

- term: fix a bug that VTE based terminals are not recognized `#D1427` ad843b4
- complete: fix a problem that candidates are not updated after menu-filter (reported by 3ximus) `#D1428` 0000000
- term: fix a bug that VTE based terminals are not recognized `#D1427` 7e16d9d
- complete: fix a problem that candidates are not updated after menu-filter (reported by 3ximus) `#D1428` 98fbc1c
- complete/mandb: fix BS contamination used by nroff to represent bold `#D1429` 0000000

## Internal changes and fixes

Expand Down
11 changes: 11 additions & 0 deletions note.txt
Expand Up @@ -3691,9 +3691,20 @@ bash_tips
Done (実装ログ)
-------------------------------------------------------------------------------

2020-12-10

* complete/mandb: ^H が大量に挿入される (reported by rlanore) [#D1429]
https://github.com/akinomyoga/ble.sh/issues/75

これは nroff で太字を表現するのに <CHAR>^H<CHAR> を出力する物がある為。
なので、単に .\b を削除すれば良い。

取り敢えず修正してみたが本当に動くか微妙。複数の OS で試す必要があるのではないか。

2020-12-09

* complete: 補完候補が更新されない問題 (reported by 3ximus) [#D1428]
https://github.com/akinomyoga/ble.sh/issues/74

これは明らかに menu-filter で候補がなくなった時に、
元の候補を全て表示する様に変更したのが原因である。
Expand Down

0 comments on commit b5c875a

Please sign in to comment.