I always use 2 panels side-by-side and have code wrapping enabled. I'd like to disable wrapping and have a toggle-binding that "expands" the active panel, and then restores the split panels with their buffers if it is pressed a second time.
I came up with the following command which does what I want. The only problem is I'm not aware of way to tell if the active panel is at the left or right of the other panel. I currently have it set up to always open a new panel to the right.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | CUSTOM_COMMAND_SIG(toggle_expand_active_panel) { static bool expanded = false; int access = AccessAll; View_Summary view = get_active_view(app,access); static int32_t buffer_id; if (!expanded) { change_active_panel(app); view = get_active_view(app,access); buffer_id = view.buffer_id; close_view(app, &view); } else { View_Summary newview = open_view(app, &view, ViewSplit_Right); change_active_panel(app); view_set_buffer(app, &newview, buffer_id, 0); } expanded = !expanded; } |
So what I'm looking for is a way to pass ViewSplit_Right/ViewSplit_Left to the open_view() function, depending on which panel has been previously expanded.