Two questions I've come up with while doing this:

1. Is there a way to get the unescaped commandline?

'commandline' returns the escaped commandline, which is great if you
want to evaluate it, but not so good if you need to edit it or
manipulate the cursor based on the content in it. commandline -C
returns the cursor position of the unescaped version, which is
therefore inconsistent with commandline.

In my bindings this subtle difference can cause some minor issues with
the B, E and W commands (i.e. move FULL word, which no builtin command
provided). You can see how my script uses the difference between
commandline -C and the length of the string returned by commandline -c
to work out how many characters have been escaped. Obviously that
isn't a perfect solution, but it is close enough for now.

Directional commands may be more of a challenge as they will need the
ability to manipulate substrings of the commandline, and processing an
escaped version of the commandline won't really work very well at all.

2. Is there a way to get the key that was pressed to trigger a
binding? It seems that the only function that can do this is the
builtin self-insert. I wanted this to implement a mode that changes
the behaviour of all keys (replace mode causes the next key pressed to
replace a character and return to normal mode for instance). At the
moment I implement this by binding all the keys in the range
0x20..0x7e when entering replace mode, which is kind of nasty and not
very locale friendly.

Cheers,
-Ian

-- 
http://sites.google.com/site/DarkStarJunkSpace
--
http://darkstarshout.blogspot.com/
--
On the day *I* go to work for Microsoft, faint oinking sounds will be
heard from far overhead, the moon will not merely turn blue but
develop polkadots, and hell will freeze over so solid the brimstone
will go superconductive.
     -- Eric S. Raymond, 2005
--
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to