[tin-dev] [tin-bugs] BUG REPORT tin 2.6.0 release 20210823 ("Coleburn") - saving an article takes about 4 seconds

Urs Janßen urs at tin.org
Thu Sep 23 17:04:51 CEST 2021


On Thu, Sep 23, 2021 at 03:53:35PM +0200, Vincent Lefevre wrote:

[print_save_summary()]
>>> I've tried, and in my case, the message remains permanently on screen.
>> I can't reproduce that, it get's whiped after the delay, that's why the
>> delay is there.
> So, the fact the message isn't whiped after the delay on my machine is
> another issue.

I also use linux + ncursesw so this is a bit confusing

> But a user operation (such as the left arrow key in my example) should
> interrupt the delay.

something like the following - HIGHLY UNTESTED - SHOULD BE REVIEWED! -
may work (simpler solutions highly appreciated):

--- screen.c	2021-08-23 12:58:19.427594000 +0200
+++ /tmp/urs/screen.c	2021-09-23 16:55:00.798985976 +0200
@@ -169,10 +169,49 @@
 #endif /* HAVE_COLOR */
 	cursoron();
 	my_flush();
+	va_end(ap);
+
+#ifdef HAVE_SELECT
+	{
+		int nfds;
+		fd_set readfds;
+		struct timeval tv;
+
+		forever {
+			FD_ZERO(&readfds);
+			FD_SET(STDIN_FILENO, &readfds);
+			tv.tv_sec = sdelay;
+			tv.tv_usec = 0;
 
+#	ifdef HAVE_SELECT_INTP
+			if ((nfds = select(STDIN_FILENO, (int *) &readfds, NULL, NULL, &tv)) == -1) {
+#	else
+			if ((nfds = select(STDIN_FILENO, &readfds, NULL, NULL, &tv)) == -1) {
+#	endif /* HAVE_SELECT_INTP */
+
+				if (errno != EINTR) {
+					perror_message("wait_message(select()) failed");
+					free(tin_progname);
+					giveup();
+				} else
+					return;
+			} else
+				break;
+                }
+
+		if (nfds > 0) {
+			if (FD_ISSET(STDIN_FILENO, &readfds))
+#	if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
+				ReadWch();
+#	else
+				ReadCh();
+#	endif /* MULTIBYTE_ABLE && !NO_LOCALE */
+		}
+	}
+#else
 	(void) sleep(sdelay);
+#endif /* HAVE_SELECT */
 /*	clear_message(); would be nice, but tin doesn't expect this yet */
-	va_end(ap);
 }
 
 



More information about the tin-dev mailing list