nnn: Terminal display is broken after mounting a remote folder with rclone

Environment details

[x] Operating System: Solus 4 [x] Desktop Environment: Budgie Desktop [x] Terminal Emulator: Tilix and Gnome terminal [x] Shell: Bash [ ] Custom desktop opener (if applicable): [x] Issue exists on nnn master: yes

Exact steps to reproduce the issue

  1. Mount a remote folder using c, then r for rclone and type relevant user1@ip and password.
  2. See the terminal display being broken, with text disappearing and issues with refreshing text.

Before:

Screenshot from 2020-01-31 23:57:49

After:

Screenshot from 2020-01-31 23:59:25

Note the white text at the bottom that won’t disappear unless I enter a folder with more text to cover it and refresh those lines. Note also that one folder and part of another one are highlighted in the second screenshot. The contexts are also hidden by some text that will not be refreshed.

It happens for both Tilix and Gnome terminal on my computer.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 28 (13 by maintainers)

Most upvoted comments

I can repro it. Just pass an invalid remote name and an error occurs.

Copy the diff as file.patch in src dir.

Then within nnn directory: patch -p1 < src/file.patch

@0xACE please take a look. It appears this has something to do with KEY_RESIZE handling.

I’ll take a look. None of my machines have rclone and I can’t get it tested atm (machine crashed earlier this week, and I’m dealing with other issues).

Is anyone else capable to reproducing this? I’ve had similiar bugs appear before, and to my understanding it is usually related to a CLI app being run as a GUI

@Kabouik If you do get a chance to try master try also applying this patch and see if it helps:

diff --git a/src/nnn.c b/src/nnn.c
index 1a07dce..2d73ce6 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -695,16 +695,6 @@ static void clearinfoln(void)
 	addch('\n');
 }
 
-#ifdef KEY_RESIZE
-/* Clear the old prompt */
-static void clearoldprompt(void)
-{
-	clearinfoln();
-	tolastln();
-	addch('\n');
-}
-#endif
-
 /* Messages show up at the bottom */
 static void printmsg(const char *msg)
 {
@@ -751,18 +741,7 @@ static int get_input(const char *prompt)
 	if (prompt)
 		printprompt(prompt);
 	cleartimeout();
-#ifdef KEY_RESIZE
-	do {
-		r = getch();
-		if (r == KEY_RESIZE && prompt) {
-			clearoldprompt();
-			xlines = LINES;
-			printprompt(prompt);
-		}
-	} while (r == KEY_RESIZE);
-#else
 	r = getch();
-#endif
 	settimeout();
 	return r;
 }
@@ -2229,13 +2208,6 @@ static int filterentries(char *path, char *lastname)
 		//DPRINTF_S(keyname(*ch));
 
 		switch (*ch) {
-#ifdef KEY_RESIZE
-		case KEY_RESIZE:
-			clearoldprompt();
-			redraw(path);
-			showfilter(ln);
-			continue;
-#endif
 		case KEY_DC: // fallthrough
 		case KEY_BACKSPACE: // fallthrough
 		case '\b': // fallthrough
@@ -2379,7 +2351,7 @@ end:
 static char *xreadline(const char *prefill, const char *prompt)
 {
 	size_t len, pos;
-	int x, r;
+	int x, y, r;
 	const int WCHAR_T_WIDTH = sizeof(wchar_t);
 	wint_t ch[2] = {0};
 	wchar_t * const buf = malloc(sizeof(wchar_t) * READLINE_MAX);
@@ -2401,13 +2373,13 @@ static char *xreadline(const char *prefill, const char *prompt)
 		len = pos = 0;
 	}
 
-	x = getcurx(stdscr);
+	getyx(stdscr, y, x);
 	curs_set(TRUE);
 
 	while (1) {
 		buf[len] = ' ';
-		mvaddnwstr(xlines - 1, x, buf, len + 1);
-		move(xlines - 1, x + wcswidth(buf, pos));
+		mvaddnwstr(y, x, buf, len + 1);
+		move(y, x + wcswidth(buf, pos));
 
 		r = get_wch(ch);
 		if (r == ERR)
@@ -2493,13 +2465,6 @@ static char *xreadline(const char *prefill, const char *prompt)
 			}
 		} else {
 			switch (*ch) {
-#ifdef KEY_RESIZE
-			case KEY_RESIZE:
-				clearoldprompt();
-				xlines = LINES;
-				printprompt(prompt);
-				break;
-#endif
 			case KEY_LEFT:
 				if (pos > 0)
 					--pos;

Edit: mixed cli vs gui