Inside ui_draw_aligned_panel we should to change if(panel->sortorder != 0) { to if(ar->winx < ar->winy && panel->sortorder != 0) {, or something like this and draw that the line above panels only when it is in vertical. Not a big deal but. Joilnen