From 4c6a47756a1296f7f30d6d26648f59fd2a01d4c3 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Sun, 26 Mar 2023 09:25:06 +0900 Subject: [PATCH] menu-complete (menu-style:linewise): fix clipping of long line --- docs/ChangeLog.md | 1 + lib/core-complete.sh | 5 +++-- note.txt | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index 58670e8b..b2f6a7d6 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -381,6 +381,7 @@ - keymap/vi (`operator:filter`): do not append newline at the end of line `#D1994` bce2033 - highlight: fix shifted error marks after delayed `core-syntax` `#D2000` f4145f16 - syntax: fix unrecognized variable assignment of the form `echo arr[i]+=rhs` `#D2007` 41faa494 +- menu (linewise): fix clipping of long line (reported by bkerin) `#D2025` xxxxxxxx ## Documentation diff --git a/lib/core-complete.sh b/lib/core-complete.sh index 9cbafd90..ee22c228 100644 --- a/lib/core-complete.sh +++ b/lib/core-complete.sh @@ -407,8 +407,9 @@ function ble/complete/menu-style:linewise/construct-page { ((x=prefix_width)) ((x0=x,y0=y)) - lines=1 cols=$max_icon_width y=0 ble/complete/menu#render-item "$item"; esc1=$ret - _ble_complete_menu_style_icons[index]=$x0,$y0,$x,$y,${#item},${#esc1}:$item$esc1 + local lines1=1 cols1=$max_icon_width + lines=$lines1 cols=$cols1 y=0 ble/complete/menu#render-item "$item"; esc1=$ret + _ble_complete_menu_style_icons[index]=$x0,$y0,$x,$y,${#item},${#esc1},"$x0 0 $cols1 $lines1":$item$esc1 ((index++)) esc=$esc$esc1 diff --git a/note.txt b/note.txt index 799ee2d9..24a7b594 100644 --- a/note.txt +++ b/note.txt @@ -6714,6 +6714,22 @@ bash_tips Done (実装ログ) ------------------------------------------------------------------------------- +2023-03-26 + + * menu-complete (linewise): 長い行がある時に表示が崩れる (reported by bkerin) [#D2025] + https://github.com/akinomyoga/ble.sh/issues/307 + + これは実装を詳しく調べてみたら選択時の部分更新の時の幾何を記録する部分で、 + 描画範囲を限定した時の記録が残っていないのが原因だった。そもそも linewise + は試験的に最初に実装したもので余り真面目に実装されていない感じがする。その + 後で desc の実装でもっとちゃんと実装されてその時に限定された描画範囲につい + てちゃんと対応が行われている。その desc に使われた仕組みを linewise からも + 使うだけで良かった。 + + 然しそれとは別に長い候補を入力した時に panel の高さが変わった時に menu の高 + さを制限した上で再描画を行う仕組みが欲しい。これについては簡単ではなさそう + なので別の項目で議論する事にする。 + 2023-03-16 * edit: bind -x で PS1 も一時的に復元する (requested by adoyle-h) [#D2024]