Fix off-by-one error in term replacement
Support active term widgets properly

Now they encode their buffer, making right-clicks reliable. They can
also be added using a menu item.

The active term commands are also documented.