4coder » Forums » Hook For Switching A Buffer Within A Panel
EightBitBoot
Adin W-T
3 posts
#15940 Hook For Switching A Buffer Within A Panel
3 months, 2 weeks ago Edited by Adin W-T on Aug. 7, 2018, 8:04 p.m. Reason: Initial post

I'm currently working on my own modal custom layer and I'm trying to set key maps per panel. I have it setup so that there's two different key maps, each for inserting and executing commands respectively. The problem I'm running into is that the key maps are bound to the buffers and not the panels. I could keep track of each panel myself and set the key map when switching buffers, but I can't find a way to hook EVERY time a panel switches a buffer. Is there some solution that I'm overlooking or a hook that I'm not seeing?
Mr4thDimention
Allen Webster
428 posts / 2 projects

Heyo

#15943 Hook For Switching A Buffer Within A Panel
3 months, 1 week ago

Yeah you've pointed out one of the serious design flaws with the current custom layer API :(

You'll have more success if you use a single command map for everything and do your own if/else or switch type dispatching on global state variables that you create yourself.
1
4coder_casey.cpp
is the best example of how it looks when you use this method and contains handy macros that you might be able to use as-written to setup your bindings.