hitode909の日記

趣味はマリンスポーツですの日記です

シェルスクリプト書いてたけど難しすぎてあきらめた.疲れた.


あとは誰かよろしくお願いします.

diff --git a/functions/filter-select b/functions/filter-select
index f2ac1e7..c0853a3 100644
--- a/functions/filter-select
+++ b/functions/filter-select
@@ -137,6 +137,9 @@ function filter-select() {
     integer max_lines
     zstyle -s ':filter-select' max-lines max_lines || max_lines=0
 
+    integer limit_lines
+    zstyle -s ':filter-select' limit-lines limit_lines || limit_lines=0
+
     _filter-select-init-keybind
 
     candidates=()
@@ -201,6 +204,12 @@ function filter-select() {
         matched_desc_keys=("${(Oa@)matched_desc_keys}")
     fi
 
+    if (( limit_lines > 0 )); then
+        candidates=("${(@kv)candidates:0:((limit_lines * 2))}")
+        descriptions=("${(@kv)descriptions:0:((limit_lines * 2))}")
+        matched_desc_keys=("${(@oa)matched_desc_keys:0:((limit_lines))}")
+    fi
+
     key=''
     bounds=''