Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

widget special PREFIX variable and cursor position with complete_in_word



I was writing a zstyle widget, and wanted to use the variable PREFIX to
have the first part of the string before the cursor.

From the docs:

      PREFIX Initially  this will be set to the part of the current word
from the beginning of the word
              up to the position of the cursor; it may be altered  to
give  a  common  prefix  for  all
              matches.

Without complete_in_word it works fine, PREFIX contains the word up to
the cursor indeed. However, with complete_in_word, the following:

$ ls //x<TAB>
dev/ etc/ lib/ sbin/

moves the cursor to the first slash (/):

$ ls //x
      ^
dev/ etc/ lib/ sbin/

In this case, PREFIX contains //x, and not '/' as I would expect.
Fine with that as long as I can know where the cursor is, but I was
looking into the $compstate hash and found nothing. I was hoping for
some offset.

Any help?



Messages sorted by: Reverse Date, Date, Thread, Author