@@ -48,6 +48,15 @@ ScreenListItem* ScreenListItem_new(const char* value, ScreenSettings* ss) {
4848
4949static const char * const ScreensFunctions [] = {" " , "Rename" , " " , " " , "New " , " " , "MoveUp" , "MoveDn" , "Remove" , "Done " , NULL };
5050static const char * const DynamicFunctions [] = {" " , "Rename" , " " , " " , " " , " " , "MoveUp" , "MoveDn" , "Remove" , "Done " , NULL };
51+ static const char * const ScreensRenamingFunctions [] = {"Cancel" , "Done " , " " , " " , " " , " " , " " , " " , " " , " " , NULL };
52+ static FunctionBar * Screens_renamingBar = NULL ;
53+
54+ void ScreensPanel_cleanup (void ) {
55+ if (Screens_renamingBar ) {
56+ FunctionBar_delete (Screens_renamingBar );
57+ Screens_renamingBar = NULL ;
58+ }
59+ }
5160
5261static void ScreensPanel_delete (Object * object ) {
5362 Panel * super = (Panel * ) object ;
@@ -88,7 +97,8 @@ static HandlerResult ScreensPanel_eventHandlerRenaming(Panel* super, int ch) {
8897 break ;
8998 case '\n' :
9099 case '\r' :
91- case KEY_ENTER : {
100+ case KEY_ENTER :
101+ case KEY_F (2 ): {
92102 ListItem * item = (ListItem * ) Panel_getSelected (super );
93103 if (!item )
94104 break ;
@@ -98,10 +108,12 @@ static HandlerResult ScreensPanel_eventHandlerRenaming(Panel* super, int ch) {
98108 this -> renamingItem = NULL ;
99109 super -> cursorOn = false;
100110 Panel_setSelectionColor (super , PANEL_SELECTION_FOCUS );
111+ Panel_setDefaultBar (super );
101112 ScreensPanel_update (super );
102113 break ;
103114 }
104- case 27 : { // Esc
115+ case 27 : // Esc
116+ case KEY_F (1 ): {
105117 ListItem * item = (ListItem * ) Panel_getSelected (super );
106118 if (!item )
107119 break ;
@@ -110,6 +122,7 @@ static HandlerResult ScreensPanel_eventHandlerRenaming(Panel* super, int ch) {
110122 this -> renamingItem = NULL ;
111123 super -> cursorOn = false;
112124 Panel_setSelectionColor (super , PANEL_SELECTION_FOCUS );
125+ Panel_setDefaultBar (super );
113126 break ;
114127 }
115128 }
@@ -134,6 +147,7 @@ static void startRenaming(Panel* super) {
134147 Panel_setSelectionColor (super , PANEL_EDIT );
135148 super -> selectedLen = strlen (this -> buffer );
136149 Panel_setCursorToSelection (super );
150+ super -> currentBar = Screens_renamingBar ;
137151}
138152
139153static void rebuildSettingsArray (Panel * super , int selected ) {
@@ -293,6 +307,9 @@ ScreensPanel* ScreensPanel_new(Settings* settings) {
293307 Panel * super = & this -> super ;
294308
295309 FunctionBar * fuBar = FunctionBar_new (settings -> dynamicScreens ? DynamicFunctions : ScreensFunctions , NULL , NULL );
310+ if (!Screens_renamingBar ) {
311+ Screens_renamingBar = FunctionBar_new (ScreensRenamingFunctions , NULL , NULL );
312+ }
296313 Panel_init (super , 1 , 1 , 1 , 1 , Class (ListItem ), true, fuBar );
297314
298315 Hashtable * columns = settings -> dynamicColumns ;
0 commit comments