mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
Fix crash on deleting entries in ssh/run.
Fix bang for custom run.
This commit is contained in:
parent
683632c36c
commit
1b425c7bd0
3 changed files with 27 additions and 6 deletions
|
@ -159,6 +159,25 @@ static SwitcherMode combi_mode_result ( int mretv, char **input, unsigned int se
|
|||
Switcher *sw )
|
||||
{
|
||||
CombiModePrivateData *pd = sw->private_data;
|
||||
if ( *input[0] == '!' ) {
|
||||
int switcher = -1;
|
||||
for ( unsigned i = 0; switcher == -1 && i < pd->num_switchers; i++ ) {
|
||||
if ( ( *input )[1] == pd->switchers[i]->name[0] ) {
|
||||
switcher = i;
|
||||
}
|
||||
}
|
||||
if ( switcher >= 0 ) {
|
||||
char *n = strchr ( *input, ' ' );
|
||||
// skip whitespace
|
||||
if( n != NULL) {
|
||||
n++;
|
||||
return pd->switchers[switcher]->result ( mretv, &n,
|
||||
selected_line - pd->starts[switcher],
|
||||
pd->switchers[switcher] );
|
||||
}
|
||||
return MODE_EXIT;
|
||||
}
|
||||
}
|
||||
|
||||
for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
|
||||
if ( selected_line >= pd->starts[i] &&
|
||||
|
|
|
@ -282,7 +282,9 @@ static char ** run_mode_get_data ( unsigned int *length, Switcher *sw )
|
|||
rmpd->cmd_list_length = 0;
|
||||
rmpd->cmd_list = get_apps ( &( rmpd->cmd_list_length ) );
|
||||
}
|
||||
if(length != NULL) {
|
||||
*length = rmpd->cmd_list_length;
|
||||
}
|
||||
return rmpd->cmd_list;
|
||||
}
|
||||
|
||||
|
@ -333,8 +335,7 @@ static void run_mode_destroy ( Switcher *sw )
|
|||
|
||||
static const char *mgrv ( unsigned int selected_line, void *sw, G_GNUC_UNUSED int *state )
|
||||
{
|
||||
RunModePrivateData *rmpd = ( (Switcher *) sw )->private_data;
|
||||
return rmpd->cmd_list[selected_line];
|
||||
return run_mode_get_data(NULL, sw)[selected_line];
|
||||
}
|
||||
|
||||
Switcher run_mode =
|
||||
|
|
|
@ -335,7 +335,9 @@ static char ** ssh_mode_get_data ( unsigned int *length, Switcher *sw )
|
|||
rmpd->cmd_list_length = 0;
|
||||
rmpd->cmd_list = get_ssh ( &( rmpd->cmd_list_length ) );
|
||||
}
|
||||
if( length != NULL ) {
|
||||
*length = rmpd->cmd_list_length;
|
||||
}
|
||||
return rmpd->cmd_list;
|
||||
}
|
||||
static SwitcherMode ssh_mode_result ( int mretv, char **input, unsigned int selected_line,
|
||||
|
@ -381,8 +383,7 @@ static void ssh_mode_destroy ( Switcher *sw )
|
|||
|
||||
static const char *mgrv ( unsigned int selected_line, void *sw, G_GNUC_UNUSED int *state )
|
||||
{
|
||||
SSHModePrivateData *rmpd = ( (Switcher *) sw )->private_data;
|
||||
return rmpd->cmd_list[selected_line];
|
||||
return ssh_mode_get_data(NULL, sw)[selected_line];
|
||||
}
|
||||
|
||||
Switcher ssh_mode =
|
||||
|
|
Loading…
Reference in a new issue