help / color / mirror / code / Atom feed
* (z) word splitting on one word
@ 2022-09-22 13:44 Julian Prein
  2022-09-22 15:16 ` Mikael Magnusson
  0 siblings, 1 reply; 3+ messages in thread
From: Julian Prein @ 2022-09-22 13:44 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1.1: Type: text/plain, Size: 576 bytes --]


I am trying to get the last word of LBUFFER.

What I did previously was:


This worked flawlessly until I noticed today that it misbehaves if LBUFFER
contains only one word. In this case it seems like `[-1]` acts on a scalar, as
it expands to the last character instead of LBUFFER as I would expect.

Is this expected behaviour?

I now work around it by prepending LBUFFER with a dummy word so that it always
has at least two words (I know that it is not empty). But this feels very hacky.

Do you know of a better way?


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-24  0:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-22 13:44 (z) word splitting on one word Julian Prein
2022-09-22 15:16 ` Mikael Magnusson
2022-09-24  0:38   ` Julian Prein

Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).