zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>,
	zsh-workers@sunsite.auc.dk
Subject: Re: Better completion in quotes
Date: Fri, 4 Jun 1999 16:47:37 +0000	[thread overview]
Message-ID: <990604164737.ZM5692@candle.brasslantern.com> (raw)
In-Reply-To: <199906040933.LAA03117@beta.informatik.hu-berlin.de>

On Jun 4, 11:33am, Sven Wischnowsky wrote:
} Subject: Re: Better completion in quotes
}
} 1) We make get_comp_string() always return quoted strings as a whole,
}    in the form the lexer returns them. We could then look if the word
}    begins with a quote, remember that and use this information to
}    offer automatically inserted ending-quotes. But [...]
}    This means that we would have to keep information about quotes in
}    the word and we have to re-insert them the way we do it for braces
}    already.  [...]
}    So, as a much simpler solution I suggest to make the completion
}    code turn strings with quotes into a generic quoted form, using
}    backslashes. But it is a bit ugly that
} 
}      % ls 'foo b<TAB>
} 
}    would be turned into foo\ bar.

How about this:  We turn the string into whatever is the simplest generic
quoted form for the completion code to handle, which I take it is using
backslashes, and remember that the original was quoted.  After generating
the list of matches, we rewrite those to "beautified quote form" which
puts the entire word in some kind of outer quote marks, and use that for
the strings that get inserted on the command line.

So starting from
	'foo b
the completion system would work on
	foo\ b
and then the matches would get rewritten as
	'foo bar' 'foo blat'
before insertion.  This does mean that if you actually started with
	"foo b
you'd still get
	'foo bar'
on the command line, but that's not too bad (unless what you planned
to type was "foo bar $ding" -- but you can't have everything).

For "beautified form" I suggest starting with the assumption that single
quotes will work, and if you encounter a String token or a Qtick, simply
close the single quote and start again with double quote.  So something
like
	"this is a $parameter
becomes
	'this is a '"$parameter
which is IMO better than
	this\ is\ a\ $parameter
because for one thing that last is wrong when SH_WORD_SPLIT is set.

(Z-Mail uses an algorithm much like this for generating quoted strings
in its supposedly-human-readable saved-options files.)

} 2) I still like the option Bart suggested and would like to make it
}    work.

I don't know how what I just said about (1) might mess up what you've
said about (2).  As with most of the new completion stuff, I've have
to actually see some of it written down to judge how baroque it is, but
it sounds OK in theory.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  parent reply	other threads:[~1999-06-04 16:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-04  9:33 Sven Wischnowsky
1999-06-04  9:32 ` Peter Stephenson
1999-06-04 16:47 ` Bart Schaefer [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-06-01 10:37 Sven Wischnowsky
1999-05-27 11:10 Some possible bugs Sven Wischnowsky
1999-05-31 23:21 ` Better completion in quotes Bart Schaefer

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=990604164737.ZM5692@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).