so I'm playing around and trying to customize 4coder, and one of the things I'd like to do is to change the way I move up or down into listers.
As far as I can tell, it seems like the KeyCode_Up and KeyCode_Down are just hardcoded into the run_lister function.
Sure I can add the two KeyCodes I want in there, but then I would have to modify the code everytime a new 4coder version comes out.
Is there a better way to do this?
I was thinking about two possible solutions, but idn if any of these two are implemented:
1) some sort of hook that gets attached to all listeners, and in there I just handle my two special cases
2) a way to detect if there's an active listener, so that in my custom command I can:
1 2 3 4 5 6 | CUSTOM_COMMAND_SIG(move_lister_up) Listener* listener = detect_active_listener(); if(listener) { MoveUp(listener); } |
For reference, here's the part of the run_lister function that I'm talking about:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | case KeyCode_Up: { if (lister->handlers.navigate != 0){ lister->handlers.navigate(app, view, lister, -1); } else if (lister->handlers.key_stroke != 0){ result = lister->handlers.key_stroke(app); } else{ handled = false; } }break; case KeyCode_Down: { if (lister->handlers.navigate != 0){ lister->handlers.navigate(app, view, lister, 1); } else if (lister->handlers.key_stroke != 0){ result = lister->handlers.key_stroke(app); } else{ handled = false; } }break; |
Leonardo