edwood
edwood copied to clipboard
Context aware Look
I first saw this in https://github.com/as/a, but the idea is that Look (and maybe even Edit) would operate differently depending on the context it is executed in, so using Look in a window tag searches that window, doing a Look inside a column searches all windows in the column and finally doing a Look in the main tag bar searches every opened window.
Edit could do this as well, editing all windows in the context by default, with the possibility to filter with the X command.
Can this be implemented with plumb
?
Maybe for Look
? Does the plumb message know that it's being sent from a column or row?
In the row/column tag, $winid
is always set to the last active window, so wouldn't Look and Edit operate on that window?
As it is right now, I think that's how it works, though in practice it can be pretty easy to forget what the last active window was.
But I dont think we would want to change the behaviour for other commands, if I click on |fmt
in a column / row I only want it to affect the last active window. If I did want it to affect many windows I'd call it through Edit
.
Switched my newa script to use edwood, seems to be working fine for now. How does one read every plumb message sent to the plumber?
@Superpat 9p read plumb/edit
? Row/column information is not sent to the plumber, and even if it did, I don't see how it would help you.
I was wondering if there was a way to read plumber messages on their way out, but if none of that information is sent out anyways, it's moot.
If row / column info was sent alongside, then a context aware Look could be implemented through plumb rules. But I'm not sure that's the best way to go.
Regarding the active window: it seems reasonable to show the active window in a slightly different colour.