zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: "drop-in replacement" and transpose-words-match
Date: Tue, 19 Jan 2016 19:56:08 -0800	[thread overview]
Message-ID: <160119195608.ZM31931@torch.brasslantern.com> (raw)
In-Reply-To: <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@brasslantern.com> 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.


  reply	other threads:[~2016-01-20  3:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12  7:32 Bart Schaefer
2016-01-18  2:25 ` Daniel Shahaf
2016-01-18 16:29   ` Bart Schaefer
2016-01-18 17:04 ` Sebastian Gniazdowski
2016-01-19  6:31   ` Bart Schaefer
2016-01-19  8:28     ` Sebastian Gniazdowski
2016-01-20  3:56       ` Bart Schaefer [this message]
2016-01-23 23:53         ` Daniel Shahaf
2016-01-24  6:20           ` Slow highlighting (Re: "drop-in replacement" and transpose-words-match) Bart Schaefer
2016-01-26 22:50             ` Daniel Shahaf
2016-01-27  4:31               ` Bart Schaefer
2016-01-27  5:10                 ` Mikael Magnusson
2016-01-29  9:18                 ` Daniel Shahaf
2016-02-10 16:32             ` Sebastian Gniazdowski
2016-02-10 18:18               ` Bart Schaefer
2016-02-10 18:37                 ` Sebastian Gniazdowski
2016-02-11 10:43                 ` Sebastian Gniazdowski
2016-02-11 12:07                   ` Sebastian Gniazdowski
2016-02-14 14:34                     ` Daniel Shahaf
2016-02-11 16:11                   ` Sebastian Gniazdowski
2016-02-12  7:34                     ` Sebastian Gniazdowski
2016-02-12 10:05                     ` Bart Schaefer
2016-02-14 14:34                     ` Daniel Shahaf
2016-02-12  9:41                   ` Bart Schaefer
2016-05-06 13:15                     ` Sebastian Gniazdowski
2016-02-14 14:34                   ` Avoiding github link bitrot " Daniel Shahaf
2016-01-20  7:47       ` "drop-in replacement" and transpose-words-match Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=160119195608.ZM31931@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).