Fixed 'More' crash on '..'. Added first pos for text editor context menu.

This commit is contained in:
TheFloW 2016-09-10 13:14:55 +02:00
parent f417a1d04e
commit 2f854631f0
2 changed files with 17 additions and 3 deletions

6
main.c
View File

@ -548,11 +548,13 @@ void setContextMenuMoreVisibilities() {
// Invisble entries when on '..'
if (strcmp(file_entry->name, DIR_UP) == 0) {
menu_entries[MENU_MORE_ENTRY_CALCULATE_SHA1].visibility = CTX_VISIBILITY_INVISIBLE;
menu_more_entries[MENU_MORE_ENTRY_INSTALL_ALL].visibility = CTX_VISIBILITY_INVISIBLE;
menu_more_entries[MENU_MORE_ENTRY_CALCULATE_SHA1].visibility = CTX_VISIBILITY_INVISIBLE;
}
// Invisble write operations in archives
// Invisble operations in archives
if (isInArchive()) {
menu_more_entries[MENU_MORE_ENTRY_INSTALL_ALL].visibility = CTX_VISIBILITY_INVISIBLE;
menu_more_entries[MENU_MORE_ENTRY_CALCULATE_SHA1].visibility = CTX_VISIBILITY_INVISIBLE;
}

14
text.c
View File

@ -442,6 +442,18 @@ static void setContextMenuVisibilities(TextEditorState *state) {
// Paste only visible when at least one line is in copy buffer
menu_entries[TEXT_MENU_ENTRY_PASTE].visibility = state->n_copied_lines == 0 ? CTX_VISIBILITY_INVISIBLE : CTX_VISIBILITY_VISIBLE;
// Go to first entry
int i;
for (i = 0; i < N_TEXT_MENU_ENTRIES; i++) {
if (menu_entries[i].visibility == CTX_VISIBILITY_VISIBLE) {
setContextMenuPos(i);
break;
}
}
if (i == N_TEXT_MENU_ENTRIES)
setContextMenuPos(-1);
}
static int count_lines_thread(SceSize args, CountParams *params) {
@ -958,7 +970,7 @@ int textViewer(char *file) {
float x = TEXT_START_X;
if (entry->selected) {
vita2d_draw_rectangle(x, START_Y + (i * FONT_Y_SPACE), MAX_WIDTH - TEXT_START_X + SHELL_MARGIN_X, FONT_Y_SPACE, MARKED_COLOR);
vita2d_draw_rectangle(x, START_Y + (i * FONT_Y_SPACE) + 3.0f, MAX_WIDTH - TEXT_START_X + SHELL_MARGIN_X, FONT_Y_SPACE, MARKED_COLOR);
}
while (*line) {