On Wed, 5 Dec 2007 13:29:12 -0600, "Jeff Pohlmeyer" yetanothergeek@gmail.com wrote:
On Dec 5, 2007 1:11 PM, Enrico Tröger enrico.troeger@uvena.de wrote:
In the key-press event handler we look for any typed characters (or for a changed cursor position) and if found, we mark the VTE as "dirty" so that commands can't be run until the user marked the VTE as clean again (e.g. by restarting it).
That might be the best bet.
I implemented a similar way. The above hadn't recognised things like pasting in the contents of the clipboard. It could have been captured with the paste-clipboard signal but only when using the popup menu, when using Shift-Insert for pasting, the VTE didn't know this. So, I used the VTE commit signal which sets the VTE as not clean, only pressing Enter/Return and the restart of the VTE mark it as clean again. An error message is printed when vte_send_cmd() is called on a non-clean VTE(maybe the message could be improved?).
I hope this will work in all cases, at least it is independent from the shell which is running in the VTE.
Another way to mark it again as clean could be pressing Enter and Return, so we assume the entered command is executed and we have a clean prompt again.
Except if the user is in the middle of a multi-line command ( e.g. echo \ ) But I also notice my patch is won't work for this case either.
Yes, but I don't know how to catch such cases and the user should also take a little care of what he is doing.
Maybe for some shell "cd" means "crash drive" ? ;-)
Hehe, or a bored user define alias cd="rm -rf" I guess somewhere are limits of what we can do to work around user's negligence.
Regards, Enrico