Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: "drop-in replacement" and transpose-words-match
- X-seq: zsh-workers 37698
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: "drop-in replacement" and transpose-words-match
- Date: Tue, 19 Jan 2016 19:56:08 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=M84WOu1exdytUrREvMfthZ3aJVPQe8AKi/4Mj8Lw+LE=; b=MpBm5peIEpRCuY9NZwx4Io3Q/hkgQaEmqf7ZwGaXclY8ife6rB8Vbto2+XZWxkRHed DNiSqAH/u7UNR+RGAWYzhSKnN7UdgxwF7ZzC5h8zZUuuI0X9JVTGSwBOgrbeBPpBqDr1 Nq3hJbQZ2aFs7RlQ/QbsLtsE9K5VieKHXCZs7mEzPq/KQ03KUgjV6qeNB/NsU8ExQGlb URXeG3MfgdF6aax6uPxR4uIIKVOpzJQQBw++QhkERb6aCJRDujO8KYuf5dATIAXyZvAS zMPhS/yBgqWZiLKF/xRFiAPdkuMMg54yAtMNpN/zMYuD2Ial4UuDjL6BRbS4Eb+MblTM QOVw==
- In-reply-to: <CAKc7PVB-X+DYVEHRqSoOiDAjNeTsVyz=EN72FHQuF=AnRmh65A@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <160111233259.ZM6719@torch.brasslantern.com> <CAKc7PVDhxbVgmV7WcGgyDzMmWSjwQ=7=LExXTwr7YvPzPpn2RA@mail.gmail.com> <160118223126.ZM28565@torch.brasslantern.com> <CAKc7PVB-X+DYVEHRqSoOiDAjNeTsVyz=EN72FHQuF=AnRmh65A@mail.gmail.com>
On Jan 19, 9:28am, Sebastian Gniazdowski wrote:
} Subject: Re: "drop-in replacement" and transpose-words-match
}
} On 19 January 2016 at 07:31, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > [I would probably save CURSOR and MARK, set CURSOR to zero, then loop
} > on "zle forward-word" until I reached or passed the old CURSOR, rather
} > than try to match up the results of (Z:n:) to $BUFFER. Then restore
} > CURSOR and MARK, of course.]
}
} This would miss spaces. zew-pb remembers white space before each word.
Forward-word advances past the whitespace, so you just have to split it
off the end of each region as you advance.
} My point is
} that Zsh could provide more information (besides LBUFFER) to Zle and
} compsys, and also zsh-syntax-highlighting.
Of course the $words array etc. is supplied to compsys for exactly this
reason; you are merely asking for a different scope and definition of
"word". In fact a huge amount of information is supplied to compsys,
way more than most completion functions need to use.
Beyond that, the information you're looking for doesn't exist. The
parser is not activated until accept-line or the equivalent occurs.
To get what you seem to want requires an entire separate-but-lesser
implementation of the parser, kept in sync with the real one.
Which I guess is what zsh-syntax-highlighting has attempted to do,
except by writing the second parser in the shell language itself.
} Zsh-syntax-highlighting can be slow, which can be seen by editing ~400
} lines function with zed -f. Maybe it's because it's doing various
} things to compensate not that rich information provided by Zsh.
It's mostly because it's re-analyzing the entire buffer every time any
change is made, if I recall correctly from the few times I've tried it.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author