commit f499f7c795a9363b63dc548229e30616b5a4de80 from: Marcel Rodrigues date: Wed Dec 03 22:40:26 2014 UTC Fix problems with rename and selection. commit - dbb53e688c7b233eb214106e4d002f5b1ae057e6 commit + f499f7c795a9363b63dc548229e30616b5a4de80 blob - 27d1876b236caaad7b2b088b6db0be96a2a0c7a5 blob + d4d9b7779192d0c57410fae5e0c322aba8c71f03 --- rover.c +++ rover.c @@ -429,6 +429,9 @@ static void try_to_sel(const char *target) { ESEL = 0; + if (!ISDIR(target)) + while ((ESEL+1) < rover.nfiles && ISDIR(ENAME(ESEL))) + ESEL++; while ((ESEL+1) < rover.nfiles && strcoll(ENAME(ESEL), target) < 0) ESEL++; if (rover.nfiles > HEIGHT) { @@ -897,7 +900,12 @@ main(int argc, char *argv[]) } else if (!strcmp(key, RVK_RENAME)) { int ok = 0; char *prompt = "rename: "; + char *last; + int isdir; strcpy(INPUT, ENAME(ESEL)); + last = INPUT + strlen(INPUT) - 1; + if ((isdir = *last == '/')) + *last = '\0'; update_input(prompt, RED); while (igetstr(INPUT, INPUTSZ)) { int length = strlen(INPUT); @@ -916,6 +924,8 @@ main(int argc, char *argv[]) } clear_message(); if (strlen(INPUT)) { + if (isdir) + strcat(INPUT, "/"); if (ok) { if (!rename(ENAME(ESEL), INPUT) && MARKED(ESEL)) { del_mark(&rover.marks, ENAME(ESEL));