about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2021-04-09 21:51:31 +0200
committerOliver Kiddle <opk@zsh.org>2021-04-09 21:51:31 +0200
commitf3caff1536c4a4061d353314eef2628bcd1c8403 (patch)
tree910af7e4641f3e2fb0eba1389180ee8e8a29b01d
parent69ffb0bf0aa6c59e3c0529e540f67a26a6cdc541 (diff)
downloadzsh-f3caff1536c4a4061d353314eef2628bcd1c8403.tar.gz
zsh-f3caff1536c4a4061d353314eef2628bcd1c8403.tar.xz
zsh-f3caff1536c4a4061d353314eef2628bcd1c8403.zip
48437: fix pid completion when cursor is in the middle of the line
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_gdb4
2 files changed, 5 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 058834e39..416745cd2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2021-04-09  Oliver Kiddle  <opk@zsh.org>
 
+	* 48437: Completion/Unix/Command/_gdb: fix pid completion when
+	cursor is in the middle of the line
+
 	* Felipe Contreras: 47786: aclocal.m4, aczsh.m4: prepare for
 	autoconf 2.70
 
diff --git a/Completion/Unix/Command/_gdb b/Completion/Unix/Command/_gdb
index 18f797633..6bdd55946 100644
--- a/Completion/Unix/Command/_gdb
+++ b/Completion/Unix/Command/_gdb
@@ -40,9 +40,9 @@ else
   (-b)     _baudrates && return 0 ;;
   esac
 
-  w=( "${(@)words[2,-1]}" )
+  w=( "${(@)words[2,CURRENT-1]}" )
   while [[ "$w[1]" = -* ]]; do
-    [[ "$w[1]" = -[decsxb] ]] && shift 1 w
+    [[ "$w[1]" = -(cd|se|tty|[decsxb]) ]] && shift 1 w
     shift 1 w
   done