about summary refs log tree commit diff
diff options
context:
space:
mode:
-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