return r;
}
+static bool isselfileempty(void)
+{
+ struct stat sb;
+
+ return (stat(selpath, &sb) == -1) || (!sb.st_size);
+}
+
static int get_cur_or_sel(void)
{
- if (selbufpos && ndents) {
- if (cfg.prefersel)
+ /* Check both local buffer and selection file for external selection */
+ if ((selbufpos || !isselfileempty()) && ndents) {
+ /* If selection is preferred and we have a local selection, return selection.
+ * Always show the prompt in case of an external selection.
+ */
+ if (cfg.prefersel && selbufpos)
return 's';
int choice = get_input(messages[MSG_CUR_SEL_OPTS]);
return pos;
}
-static bool isselfileempty(void)
-{
- struct stat sb;
-
- return (stat(selpath, &sb) == -1) || (!sb.st_size);
-}
-
/* List selection from selection file (another instance) */
static bool listselfile(void)
{