We currently make the default arg 'replacable' so that typing any text
replaces it. This is sometimes useful, but sometime awkward.
1/ It is clumsy to edit the arg - you need to abort the 'replaceable'
state first
2/ it doesn't help with added option e.g. to grep.
So don't make it 'replaceable' but instead place the cursor before the
text. Then it is easy to insert options or edit the text, and replacing
it is as simple as ctrl-K.
Signed-off-by: NeilBrown <neil@brown.name>
if not p:
return edlib.Efail
if dflt_arg:
- # The '1' says to make this mark selection replaceable
- p.call("mode-set-mark", 1)
- p.call("Replace", dflt_arg)
+ pnt = p.call("doc:point", ret='mark')
+ mk = pnt.dup()
+ p.call("Replace", dflt_arg, mk)
+ # Move point to start of insertion, for easy editing.
+ pnt.to_mark(mk)
+
p.call("popup:set-callback", run_make)
p["prompt"] = "%s Command" % cmd
p["done-key"] = "N:%d:%s:%s" % (autosave, mode, dir)