1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

[Script] Reset highlighting when reload view

Issue: #767
This commit is contained in:
Dave Davenport 2018-02-08 17:56:31 +01:00
parent 521843e9be
commit 0f1717f829
2 changed files with 40 additions and 14 deletions

View file

@ -1,17 +1,28 @@
#!/usr/bin/env bash
echo -en "\x00prompt\x1ftesting\n"
echo -en "\0urgent\x1f0,2\n"
echo -en "\0active\x1f1\n"
echo -en "\0markup-rows\x1ftrue\n"
echo -en "\0message\x1fSpecial <b>bold</b>message\n"
echo "aap"
echo "noot"
echo "mies"
echo "testing"
echo "<b>Bold</b>"
if [ -n "$@" ]
if [ x"$@" = x"quit" ]
then
echo "$@"
exit 0
fi
if [ "$@" ]
then
for a in {1..10}
do
echo "$a"
done
echo "quit"
else
echo -en "\x00prompt\x1ftesting\n"
echo -en "\0urgent\x1f0,2\n"
echo -en "\0active\x1f1\n"
echo -en "\0markup-rows\x1ftrue\n"
echo -en "\0message\x1fSpecial <b>bold</b>message\n"
echo "aap"
echo "noot"
echo "mies"
echo "testing"
echo "<b>Bold</b>"
echo "quit"
fi

View file

@ -78,7 +78,7 @@ static void parse_header_entry ( Mode *sw, char *line, ssize_t length )
char *value = line + length_key + 1;
if ( strcasecmp ( line, "message" ) == 0 ) {
g_free ( pd->message );
pd->message = g_strdup ( value );
pd->message = strlen(value)? g_strdup ( value ):NULL;
}
else if ( strcasecmp ( line, "prompt" ) == 0 ) {
g_free ( pd->prompt );
@ -187,6 +187,19 @@ static unsigned int script_mode_get_num_entries ( const Mode *sw )
return rmpd->cmd_list_length;
}
static void script_mode_reset_highlight ( Mode *sw )
{
ScriptModePrivateData *rmpd = (ScriptModePrivateData *) sw->private_data;
rmpd->num_urgent_list = 0;
g_free ( rmpd->urgent_list );
rmpd->urgent_list = NULL;
rmpd->num_active_list = 0;
g_free ( rmpd->active_list );
rmpd->active_list = NULL;
}
static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned int selected_line )
{
ScriptModePrivateData *rmpd = (ScriptModePrivateData *) sw->private_data;
@ -204,9 +217,11 @@ static ModeMode script_mode_result ( Mode *sw, int mretv, char **input, unsigned
retv = ( mretv & MENU_LOWER_MASK );
}
else if ( ( mretv & MENU_OK ) && rmpd->cmd_list[selected_line] != NULL ) {
script_mode_reset_highlight ( sw );
new_list = execute_executor ( sw, rmpd->cmd_list[selected_line], &new_length );
}
else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) {
script_mode_reset_highlight ( sw );
new_list = execute_executor ( sw, *input, &new_length );
}