Skip to content

Commit

Permalink
Reset clipboard if user tries to select items from a different dir
Browse files Browse the repository at this point in the history
  • Loading branch information
joel16 committed Jun 29, 2018
1 parent a1208fe commit 74b0d38
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/menus/menu_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define COPY_KEEP_ON_FINISH 0
#define NOTHING_TO_COPY -1

void FileOptions_ResetClipboard(void);
void Menu_ControlDeleteDialog(u64 input);
void Menu_TouchDeleteDialog(TouchInfo touchInfo);
void Menu_DisplayDeleteDialog(void);
Expand Down
11 changes: 8 additions & 3 deletions source/menus/menu_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@

#define MENUBAR_X_BOUNDARY 0
static int menubar_x = -400;
static char multi_select_dir_old[256];

static void Menu_ControlMenuBar(u64 input)
{
if (input & KEY_A)
MENU_DEFAULT_STATE = MENU_STATE_SETTINGS;

if ((input & KEY_Y) || (input & KEY_B))
if ((input & KEY_MINUS) || (input & KEY_B))
MENU_DEFAULT_STATE = MENU_STATE_HOME;
}

Expand Down Expand Up @@ -52,12 +53,16 @@ static void Menu_DisplayMenuBar(void)

static void Menu_HandleMultiSelect(void)
{
// multi_select_dir can only hold one dir
strcpy(multi_select_dir_old, cwd);
if (strcmp(multi_select_dir_old, multi_select_dir) != 0)
FileOptions_ResetClipboard();

char path[256];
File *file = Dirbrowse_GetFileIndex(position);
strcpy(path, cwd);
strcpy(path + strlen(path), file->name);

snprintf(multi_select_dir, 256, cwd);
strcpy(multi_select_dir, cwd);

if (!multi_select[position])
{
Expand Down
2 changes: 1 addition & 1 deletion source/menus/menu_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static int properties_ok_width = 0, properties_ok_height = 0;

static int options_cancel_width = 0, options_cancel_height = 0;

static void FileOptions_ResetClipboard(void)
void FileOptions_ResetClipboard(void)
{
multi_select_index = 0;
memset(multi_select, 0, sizeof(multi_select));
Expand Down

0 comments on commit 74b0d38

Please sign in to comment.