From a6eeeca9635652f025f38281f152c650036f8b33 Mon Sep 17 00:00:00 2001 From: Marcel Rodrigues Date: Sun, 18 Dec 2016 10:58:38 -0200 Subject: [PATCH] Add 'y' & 'p' to copy & paste location. --- config.h | 2 ++ rover.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/config.h b/config.h index ef7ad98..b6c33b7 100644 --- a/config.h +++ b/config.h @@ -14,6 +14,8 @@ #define RVK_CD_UP "h" #define RVK_HOME "H" #define RVK_TARGET "t" +#define RVK_COPY_PATH "y" +#define RVK_PASTE_PATH "p" #define RVK_REFRESH "r" #define RVK_SHELL "^M" #define RVK_VIEW " " diff --git a/rover.c b/rover.c index 640d0d5..a942d88 100644 --- a/rover.c +++ b/rover.c @@ -36,6 +36,7 @@ static char BUF1[BUFLEN]; static char BUF2[BUFLEN]; static char INPUT[BUFLEN]; +static char CLIPBOARD[BUFLEN]; static wchar_t WBUF[BUFLEN]; /* Paths to external programs. */ @@ -1080,6 +1081,8 @@ main(int argc, char *argv[]) rover.window = subwin(stdscr, LINES - 2, COLS, 1, 0); init_marks(&rover.marks); cd(1); + strcpy(CLIPBOARD, CWD); + strcat(CLIPBOARD, ENAME(ESEL)); while (1) { ch = rover_getch(); key = keyname(ch); @@ -1181,6 +1184,17 @@ main(int argc, char *argv[]) try_to_sel(bname); *bname = '\0'; update_view(); + } else if (!strcmp(key, RVK_COPY_PATH)) { + strcpy(CLIPBOARD, CWD); + strcat(CLIPBOARD, ENAME(ESEL)); + } else if (!strcmp(key, RVK_PASTE_PATH)) { + strcpy(BUF1, CLIPBOARD); + strcpy(CWD, dirname(BUF1)); + strcat(CWD, "/"); + cd(1); + strcpy(BUF1, CLIPBOARD); + try_to_sel(basename(BUF1)); + update_view(); } else if (!strcmp(key, RVK_REFRESH)) { reload(); } else if (!strcmp(key, RVK_SHELL)) { -- 2.11.4.GIT