@@ -45,6 +45,7 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) {
4545 }
4646
4747 NumberItem * numItem = (OptionItem_kind (selected ) == OPTION_ITEM_NUMBER ) ? (NumberItem * )selected : NULL ;
48+ StringItem * strItem = (OptionItem_kind (selected ) == OPTION_ITEM_STRING ) ? (StringItem * )selected : NULL ;
4849
4950 /* Helper: position the hardware cursor right after the edit buffer.
5051 * +1 on Y for the panel header row; +1 on X for the leading '[' bracket. */
@@ -54,8 +55,19 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) {
5455 super->cursorOn = true; \
5556 } while (0)
5657
58+ #define SET_STR_CURSOR () do { \
59+ super->cursorY = super->y + 1 + (super->selected - super->scrollV); \
60+ super->cursorX = super->x + 1 + (int)LineEditor_getCursor(&strItem->editor); \
61+ super->cursorOn = true; \
62+ } while (0)
63+
5764 switch (ch ) {
5865 case 27 : /* Escape: cancel editing */
66+ if (numItem && numItem -> editing ) {
67+ NumberItem_cancelEditing (numItem );
68+ super -> cursorOn = false;
69+ return HANDLED ;
70+ }
5971 if (numItem && numItem -> editing ) {
6072 NumberItem_cancelEditing (numItem );
6173 super -> cursorOn = false;
@@ -64,6 +76,11 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) {
6476 break ;
6577 case KEY_BACKSPACE :
6678 case KEY_DEL_MAC :
79+ if (strItem && strItem -> editing ) {
80+ LineEditor_handleKey (& strItem -> editor , KEY_BACKSPACE );
81+ SET_STR_CURSOR ();
82+ return HANDLED ;
83+ }
6784 if (numItem ) {
6885 if (!numItem -> editing ) {
6986 NumberItem_startEditingFromValue (numItem );
@@ -76,6 +93,19 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) {
7693 case '\n' :
7794 case '\r' :
7895 case KEY_ENTER :
96+ if (strItem && strItem -> editing ) {
97+ StringItem_applyEditing (strItem );
98+ super -> cursorOn = false;
99+ settingsChanged = true;
100+ result = HANDLED ;
101+ break ;
102+ }
103+ if (strItem && !strItem -> editing ) {
104+ StringItem_startEditing (strItem );
105+ SET_STR_CURSOR ();
106+ result = HANDLED ;
107+ break ;
108+ }
79109 if (numItem && numItem -> editing ) {
80110 if (NumberItem_applyEditing (numItem )) {
81111 settingsChanged = true;
@@ -219,6 +249,12 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) {
219249 SET_EDIT_CURSOR ();
220250 return HANDLED ;
221251 }
252+ } else if (strItem ) {
253+ if (strItem -> editing ) {
254+ LineEditor_handleKey (& strItem -> editor , ch );
255+ SET_STR_CURSOR ();
256+ return HANDLED ;
257+ }
222258 }
223259 break ;
224260 }
@@ -282,6 +318,7 @@ DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager*
282318 Panel_add (super , (Object * ) CheckItem_newByRef ("Highlight program \"basename\"" , & (settings -> highlightBaseName )));
283319 Panel_add (super , (Object * ) CheckItem_newByRef ("Highlight out-dated/removed programs (red) / libraries (yellow)" , & (settings -> highlightDeletedExe )));
284320 Panel_add (super , (Object * ) CheckItem_newByRef ("Shadow distribution path prefixes" , & (settings -> shadowDistPathPrefix )));
321+ Panel_add (super , (Object * ) StringItem_newByRef ("- Custom path prefixes (colon-separated)" , & (settings -> distPathPrefixes ), NULL ));
285322 Panel_add (super , (Object * ) CheckItem_newByRef ("Merge exe, comm and cmdline in Command" , & (settings -> showMergedCommand )));
286323 Panel_add (super , (Object * ) CheckItem_newByRef ("- Try to find comm in cmdline (when Command is merged)" , & (settings -> findCommInCmdline )));
287324 Panel_add (super , (Object * ) CheckItem_newByRef ("- Try to strip exe from cmdline (when Command is merged)" , & (settings -> stripExeFromCmdline )));
0 commit comments