...I realize the last email patch was not covering -o fbdev and -o aa.

Now:
 svn diff http://svn.savannah.nongnu.org/svn/fbi-improved -r 1676:1678
should cover those, too.
Tarballs updated.

Feedback welcome,
m.

On 20221010@12:02, Michele Martone wrote:
> Dear d3fault,
> 
> Here is the upstream fix.
> 
> In patch form:
>  svn diff http://svn.savannah.nongnu.org/svn/fbi-improved -r 1676:1677
>  (also attached)
>  
> In 0.6 trunk tarball:
>  
> http://download.savannah.nongnu.org/releases/fbi-improved/fim-0.6-trunk.tar.gz
>  
> http://download.savannah.nongnu.org/releases/fbi-improved/fim-0.6-trunk.tar.gz.sig
> 
> Would be great if you could give it a try.
> 
> Cheers,
> Michele
> 
> On 20221010@08:05, Michele Martone wrote:
> > Dear d3fault,
> > 
> > Thanks for reporting of this defect.
> > 
> > Unfortunately it's also in the latest revision.
> > I'll let you know here once I attack the problem.
> > 
> > The good news in the last weeks I'm very active with fim, so 
> > *maybe* we get this solved soon-ish :-)
> > 
> > ciao,
> > Michele
> > 
> > On 20221009@09:57, d3fault wrote:
> > > Package: fim
> > > Version: 0.5.3-9+b1
> > > Severity: normal
> > > X-Debbugs-Cc: d3faultdot...@gmail.com
> > > 
> > > Dear Maintainer,
> > > 
> > >    * What led up to the situation?
> > >       fim --slideshow=5 ./*.jpg
> > >    * What exactly did you do (or not do) that was effective (or
> > >      ineffective)?
> > >       I looked at the screen. I also pressed 'q'.
> > >    * What was the outcome of this action?
> > >       The first image of the slideshow was just all black. The 2nd+
> > > images do show.
> > >       Also if you press 'q' while the slideshow is still running, the
> > > app doesn't quit
> > >       but instead it just progresses to the next image. After all the
> > > images have been
> > >       shown, then 'q' will quit. I would also expect slideshow mode to
> > > loop around
> > >       indefinitely, but that's not really a bug.
> > >    * What outcome did you expect instead?
> > >       I expected to see the first image. I also expected 'q' to quit the 
> > > app.
> > > 
> > > Also confirmed the bug exists on Bullseye.
> > > It works fine in fbi.
> > > 
> > > 
> > > -- System Information:
> > > Debian Release: bookworm/sid
> > >   APT prefers unstable
> > >   APT policy: (500, 'unstable')
> > > Architecture: amd64 (x86_64)
> > > 
> > > Kernel: Linux 5.10.0-18-amd64 (SMP w/4 CPU threads)
> > > Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE 
> > > not set
> > > Shell: /bin/sh linked to /usr/bin/dash
> > > Init: systemd (via /run/systemd/system)
> > > 
> > > Versions of packages fim depends on:
> > > ii  libaa1           1.4p5-50
> > > ii  libc6            2.35-3
> > > ii  libdjvulibre21   3.5.28-2
> > > ii  libexif12        0.6.24-1+b1
> > > ii  libgcc-s1        12.2.0-5
> > > ii  libgif7          5.2.1-2.5
> > > ii  libjpeg62-turbo  1:2.1.2-1+b1
> > > ii  libpng16-16      1.6.38-2
> > > ii  libreadline8     8.2-1
> > > ii  libsdl1.2debian  1.2.15+dfsg2-8
> > > ii  libstdc++6       12.2.0-5
> > > ii  libtiff5         4.4.0-4
> > > 
> > > fim recommends no packages.
> > > 
> > > fim suggests no packages.
> > > 
> > > -- no debconf information
> 
> 

> Index: trunk/src/CommandConsole.h
> ===================================================================
> --- trunk/src/CommandConsole.h        (revision 1676)
> +++ trunk/src/CommandConsole.h        (revision 1677)
> @@ -410,6 +410,7 @@
>       public:
>       void switch_if_needed(void);
>       fim::string getInfoCustom(const fim_char_t * ifsp)const;
> +     fim_int show_must_go_on(void) const;
>  };
>  }
>  
> Index: trunk/src/CommandConsole.cpp
> ===================================================================
> --- trunk/src/CommandConsole.cpp      (revision 1676)
> +++ trunk/src/CommandConsole.cpp      (revision 1677)
> @@ -645,7 +645,7 @@
>                       else
>  #endif /* FIM_ITERATED_COMMANDS */
>                               
> status=execute_internal(getBoundAction(c).c_str(),FIM_X_NULL);
> -                     if( show_must_go_on_ )
> +                     if( show_must_go_on_ > 0 )
>                               
> FIM_AUTOCMD_EXEC_POST(FIM_ACM_POSTINTERACTIVECOMMAND);
>               }
>  
> @@ -901,10 +901,14 @@
>                *      Allows user to press any key during loop.
>                *      Loop will continue its execution, unless pressed key is 
> exitBinding_.
>                *      If not, and if the key is bound to some action, this 
> action is executed.
> -              *      returns 1 if loop has to be broken.
> +              *      If loop has to be broken, returns 1 and changes 
> show_must_go_on_ to 2.
>                */
>               fim_key_t c;
>  
> +             if ( !show_must_go_on_ )
> +                     goto err;
> +             show_must_go_on_ = 1;
> +
>               if ( exitBinding_ == 0 )
>                       goto err;       /* any key triggers an exit */
>  
> @@ -931,7 +935,8 @@
>               }
>               return 0;       /* no chars read  */
>  err:
> -             return 1;       /* loop shall be broken */
> +             show_must_go_on_ = 2;
> +             return 1;       /* break any enclosing loop */
>       }
>               
>  #ifdef       FIM_USE_GPM
> @@ -1174,6 +1179,7 @@
>  #if FIM_WANT_BACKGROUND_LOAD
>               blt_.join();
>  #endif /* FIM_WANT_BACKGROUND_LOAD */
> +             show_must_go_on_ = -1; /* without this it would break loops in 
> postExecutionCommand_ aka -F */
>               FIM_AUTOCMD_EXEC(FIM_ACM_POSTEXECUTIONCYCLE,initial);
>               return quit(return_code_);
>       }
> @@ -2675,4 +2681,9 @@
>  labeldone:
>       return linebuffer;
>  }
> +
> +fim_int CommandConsole::show_must_go_on(void) const
> +{
> +     return show_must_go_on_;
> +}
>  } /* namespace fim */
> Index: trunk/src/fim.h
> ===================================================================
> --- trunk/src/fim.h   (revision 1676)
> +++ trunk/src/fim.h   (revision 1677)
> @@ -1082,7 +1082,7 @@
>  #define FIM_FLT_HELP_DISPLAY FIM_FLT_DISPLAY " ['reinit' {string}]|'resize' 
> {w} {h}]: display the current file contents." FIM_CNS_CMDSEP "If 'reinit' 
> switch is supplied, the '{string}' specifier will be used to reinitialize 
> (e.g.: change resolution, window system options) the display device." 
> FIM_CNS_CMDSEP "See documentation for the --" FIM_OSW_OUTPUT_DEVICE " command 
> line switch for allowed values of {string}." FIM_CNS_CMDSEP "If 'resize' and 
> no argument, will ask the window manager to size the window like the image." 
> FIM_CNS_CMDSEP "If 'resize' and two arguments, these will be used as width 
> and height of window, to set."
>  
>  /*  */
> -#define FIM_CNS_SLIDESHOW_CMD "while(" FIM_VID_FILEINDEX "<" 
> FIM_VID_FILELISTLEN "){sleep " FIM_VID_WANT_SLEEPS "; next;}"
> +#define FIM_CNS_SLIDESHOW_CMD FIM_FLT_RELOAD "; i:fresh=1; while(" 
> FIM_VID_FILEINDEX "<" FIM_VID_FILELISTLEN "){sleep " FIM_VID_WANT_SLEEPS "; 
> next;}"
>  #define FIM_CNS_QUIET_CMD FIM_VID_DISPLAY_STATUS "=0;" FIM_VID_DISPLAY_BUSY 
> "=0;"
>  
>  /*
> Index: trunk/src/testdir/test13.in
> ===================================================================
> --- trunk/src/testdir/test13.in       (revision 1676)
> +++ trunk/src/testdir/test13.in       (revision 1677)
> @@ -1,6 +1,6 @@
>  # file browsing test
>  # in order for this test to terminate, we need some files ..
> -if(_filelistlen>1){stdout "at least one file in the list.";quit 1;}
> +if(_filelistlen>1){stdout "at least one file in the list.";}
>  if(_filelistlen<1){stdout "probable problems with file browser.";quit 1;}
>  while(_filelistlen>1){list "pop";}
>  stdout _filelistlen;
> Index: trunk/src/fim.cpp
> ===================================================================
> --- trunk/src/fim.cpp (revision 1676)
> +++ trunk/src/fim.cpp (revision 1677)
> @@ -263,7 +263,11 @@
>      },
>      {"slideshow",     required_argument, FIM_NULL, 0x7373,
>       "interruptible slideshow mode", FIM_CNS_EX_NUM_STRING,
> -     "Interruptible slideshow mode; will wait for " FIM_CNS_EX_NUM_STRING " 
> of seconds (assigned to the " FIM_VID_WANT_SLEEPS " variable after each 
> loading; implemented by executing " FIM_CNS_SLIDESHOW_CMD " as a first 
> command."
> +     "Interruptible slideshow mode. "
> +     "Wait for " FIM_CNS_EX_NUM_STRING " of seconds (assigned to the " 
> FIM_VID_WANT_SLEEPS " variable) after each image. "
> +     "Implemented by executing " FIM_CNS_SLIDESHOW_CMD " as a first command. 
> "
> +     "Can be interrupted by " FIM_KBD_COLON " or " FIM_KBD_ESC ". "
> +     "The other keys will execute accordingly to their function but will not 
> interrupt the slideshow."
>      },
>      {"sanity-check",      no_argument,       FIM_NULL, 0x70617363,
>       "only perform a sanity check", FIM_NULL, /* Was -S until r1001 */
> Index: trunk/src/fim_interpreter.cpp
> ===================================================================
> --- trunk/src/fim_interpreter.cpp     (revision 1676)
> +++ trunk/src/fim_interpreter.cpp     (revision 1677)
> @@ -67,7 +67,7 @@
>  #define FIM_EC(CMD,ARGS) /* fim::cc.execute(CMD,ARGS) */ "result" 
> /*Var((fim_int)1)*/ /* FIXME: shall return Arg or Var or Val */
>  typedef nodeType * NodeType;
>  #else /* FIM_INDEPENDENT_NAMESPACE */
> -#define FIM_NO_BREAK fim::cc.catchLoopBreakingCommand(0)==0
> +#define FIM_NO_BREAK ( abs(fim::cc.show_must_go_on()) == 1 && ( 
> fim::cc.catchLoopBreakingCommand(0)==0) )
>  #define FIM_OPRND(P,N) ((P)->opr.op[(N)])
>  #define FIM_FACC(O)  (O)->fid.f
>  #define FIM_SACC(O)  (O)->scon.s
> Index: trunk/doc/fim.man.in
> ===================================================================
> --- trunk/doc/fim.man.in      (revision 1676)
> +++ trunk/doc/fim.man.in      (revision 1677)
> @@ -207,7 +207,7 @@
>  Set scroll steps for internal variable _steps (default is 20%).
>  .TP
>  .B  --slideshow {number}
> -Interruptible slideshow mode; will wait for {number} of seconds (assigned to 
> the _want_sleep_seconds variable after each loading; implemented by executing 
> while(_fileindex<_filelistlen){sleep _want_sleep_seconds; next;} as a first 
> command.
> +Interruptible slideshow mode. Wait for {number} of seconds (assigned to the 
> _want_sleep_seconds variable) after each image. Implemented by executing 
> reload; i:fresh=1; while(_fileindex<_filelistlen){sleep _want_sleep_seconds; 
> next;} as a first command. Can be interrupted by : or Esc. The other keys 
> will execute accordingly to their function but will not interrupt the 
> slideshow.
>  .TP
>  .B  --sanity-check
>  Perform a quick sanity check, just after the initialization, and terminate.
> Index: trunk/NEWS
> ===================================================================
> --- trunk/NEWS        (revision 1676)
> +++ trunk/NEWS        (revision 1677)
> @@ -3,6 +3,8 @@
>  
>                  Version 0.6-trunk
>  
> +# (r1677)
> + * Slideshow function (e.g `fim --slideshow=5 *.jpg`) now more responsive.
>  # (r1662)
>   * Arrow keys are now working in aalib (-o aa).
>  # (r1649)



Index: trunk/doc/fim.man.in
===================================================================
--- trunk/doc/fim.man.in	(revision 1676)
+++ trunk/doc/fim.man.in	(revision 1678)
@@ -207,7 +207,7 @@
 Set scroll steps for internal variable _steps (default is 20%).
 .TP
 .B  --slideshow {number}
-Interruptible slideshow mode; will wait for {number} of seconds (assigned to the _want_sleep_seconds variable after each loading; implemented by executing while(_fileindex<_filelistlen){sleep _want_sleep_seconds; next;} as a first command.
+Interruptible slideshow mode. Wait for {number} of seconds (assigned to the _want_sleep_seconds variable) after each image. Implemented by executing reload; i:fresh=1; while(_fileindex<_filelistlen){sleep _want_sleep_seconds; next;} as a first command. Can be interrupted by : or Esc. The other keys will execute accordingly to their function but will not interrupt the slideshow.
 .TP
 .B  --sanity-check
 Perform a quick sanity check, just after the initialization, and terminate.
Index: trunk/NEWS
===================================================================
--- trunk/NEWS	(revision 1676)
+++ trunk/NEWS	(revision 1678)
@@ -3,6 +3,8 @@
 
                 Version 0.6-trunk
 
+# (r1677,r1678)
+ * Slideshow function (e.g `fim --slideshow=5 *.jpg`) now more responsive.
 # (r1662)
  * Arrow keys are now working in aalib (-o aa).
 # (r1649)
Index: trunk/src/fim_interpreter.cpp
===================================================================
--- trunk/src/fim_interpreter.cpp	(revision 1676)
+++ trunk/src/fim_interpreter.cpp	(revision 1678)
@@ -67,7 +67,7 @@
 #define FIM_EC(CMD,ARGS) /* fim::cc.execute(CMD,ARGS) */ "result" /*Var((fim_int)1)*/ /* FIXME: shall return Arg or Var or Val */
 typedef nodeType * NodeType;
 #else /* FIM_INDEPENDENT_NAMESPACE */
-#define FIM_NO_BREAK fim::cc.catchLoopBreakingCommand(0)==0
+#define FIM_NO_BREAK ( abs(fim::cc.show_must_go_on()) == 1 && ( fim::cc.catchLoopBreakingCommand(0)==0) )
 #define FIM_OPRND(P,N) ((P)->opr.op[(N)])
 #define FIM_FACC(O)  (O)->fid.f
 #define FIM_SACC(O)  (O)->scon.s
Index: trunk/src/CommandConsole.h
===================================================================
--- trunk/src/CommandConsole.h	(revision 1676)
+++ trunk/src/CommandConsole.h	(revision 1678)
@@ -410,6 +410,7 @@
 	public:
 	void switch_if_needed(void);
 	fim::string getInfoCustom(const fim_char_t * ifsp)const;
+	fim_int show_must_go_on(void) const;
 };
 }
 
Index: trunk/src/fim.h
===================================================================
--- trunk/src/fim.h	(revision 1676)
+++ trunk/src/fim.h	(revision 1678)
@@ -1082,7 +1082,7 @@
 #define FIM_FLT_HELP_DISPLAY FIM_FLT_DISPLAY " ['reinit' {string}]|'resize' {w} {h}]: display the current file contents." FIM_CNS_CMDSEP "If 'reinit' switch is supplied, the '{string}' specifier will be used to reinitialize (e.g.: change resolution, window system options) the display device." FIM_CNS_CMDSEP "See documentation for the --" FIM_OSW_OUTPUT_DEVICE " command line switch for allowed values of {string}." FIM_CNS_CMDSEP "If 'resize' and no argument, will ask the window manager to size the window like the image." FIM_CNS_CMDSEP "If 'resize' and two arguments, these will be used as width and height of window, to set."
 
 /*  */
-#define FIM_CNS_SLIDESHOW_CMD "while(" FIM_VID_FILEINDEX "<" FIM_VID_FILELISTLEN "){sleep " FIM_VID_WANT_SLEEPS "; next;}"
+#define FIM_CNS_SLIDESHOW_CMD FIM_FLT_RELOAD "; i:fresh=1; while(" FIM_VID_FILEINDEX "<" FIM_VID_FILELISTLEN "){sleep " FIM_VID_WANT_SLEEPS "; next;}"
 #define FIM_CNS_QUIET_CMD FIM_VID_DISPLAY_STATUS "=0;" FIM_VID_DISPLAY_BUSY "=0;"
 
 /*
Index: trunk/src/DisplayDevice.cpp
===================================================================
--- trunk/src/DisplayDevice.cpp	(revision 1676)
+++ trunk/src/DisplayDevice.cpp	(revision 1678)
@@ -126,7 +126,10 @@
 		tcsetattr (0, TCSAFLUSH, &tattr);
 		//r=read(fim_stdin_,&c,4);
 		// FIXME : read(.,.,3) is NOT portable. DANGER
-		r=read(cc.fim_stdin_,&c,1); if(r>0&&c==0x1b){rc=read(0,&c,3);if(rc)c=(0x1b)+(c<<8);/* we should do something with rc now */}
+		unsigned char uc;
+		r = read(cc.fim_stdin_,&uc,1);
+		c = uc;
+		if(r>0&&c==0x1b){rc=read(0,&c,3);if(rc)c=(0x1b)+(c<<8);/* we should do something with rc now */}
 		//we restore the previous console attributes
 		tcsetattr (0, TCSAFLUSH, &sattr);
 		if( r<=0 )
Index: trunk/src/testdir/test13.in
===================================================================
--- trunk/src/testdir/test13.in	(revision 1676)
+++ trunk/src/testdir/test13.in	(revision 1678)
@@ -1,6 +1,6 @@
 # file browsing test
 # in order for this test to terminate, we need some files ..
-if(_filelistlen>1){stdout "at least one file in the list.";quit 1;}
+if(_filelistlen>1){stdout "at least one file in the list.";}
 if(_filelistlen<1){stdout "probable problems with file browser.";quit 1;}
 while(_filelistlen>1){list "pop";}
 stdout _filelistlen;
Index: trunk/src/CommandConsole.cpp
===================================================================
--- trunk/src/CommandConsole.cpp	(revision 1676)
+++ trunk/src/CommandConsole.cpp	(revision 1678)
@@ -645,7 +645,7 @@
 			else
 #endif /* FIM_ITERATED_COMMANDS */
 				status=execute_internal(getBoundAction(c).c_str(),FIM_X_NULL);
-			if( show_must_go_on_ )
+			if( show_must_go_on_ > 0 )
 				FIM_AUTOCMD_EXEC_POST(FIM_ACM_POSTINTERACTIVECOMMAND);
 		}
 
@@ -901,10 +901,14 @@
 		 *	Allows user to press any key during loop.
 		 *	Loop will continue its execution, unless pressed key is exitBinding_.
 		 *	If not, and if the key is bound to some action, this action is executed.
-		 *	returns 1 if loop has to be broken.
+		 *	If loop has to be broken, returns 1 and changes show_must_go_on_ to 2.
 		 */
 		fim_key_t c;
 
+		if ( !show_must_go_on_ )
+		       	goto err;
+		show_must_go_on_ = 1;
+
 		if ( exitBinding_ == 0 )
 		       	goto err;	/* any key triggers an exit */
 
@@ -931,7 +935,8 @@
 		}
 		return 0;	/* no chars read  */
 err:
-		return 1;	/* loop shall be broken */
+		show_must_go_on_ = 2;
+		return 1;	/* break any enclosing loop */
 	}
 		
 #ifdef	FIM_USE_GPM
@@ -1174,6 +1179,7 @@
 #if FIM_WANT_BACKGROUND_LOAD
 		blt_.join();
 #endif /* FIM_WANT_BACKGROUND_LOAD */
+		show_must_go_on_ = -1; /* without this it would break loops in postExecutionCommand_ aka -F */
 		FIM_AUTOCMD_EXEC(FIM_ACM_POSTEXECUTIONCYCLE,initial);
 		return quit(return_code_);
 	}
@@ -2675,4 +2681,9 @@
 labeldone:
 	return linebuffer;
 }
+
+fim_int CommandConsole::show_must_go_on(void) const
+{
+	return show_must_go_on_;
+}
 } /* namespace fim */
Index: trunk/src/fim.cpp
===================================================================
--- trunk/src/fim.cpp	(revision 1676)
+++ trunk/src/fim.cpp	(revision 1678)
@@ -263,7 +263,11 @@
     },
     {"slideshow",     required_argument, FIM_NULL, 0x7373,
 	"interruptible slideshow mode", FIM_CNS_EX_NUM_STRING,
-	"Interruptible slideshow mode; will wait for " FIM_CNS_EX_NUM_STRING " of seconds (assigned to the " FIM_VID_WANT_SLEEPS " variable after each loading; implemented by executing " FIM_CNS_SLIDESHOW_CMD " as a first command."
+	"Interruptible slideshow mode. "
+	"Wait for " FIM_CNS_EX_NUM_STRING " of seconds (assigned to the " FIM_VID_WANT_SLEEPS " variable) after each image. "
+	"Implemented by executing " FIM_CNS_SLIDESHOW_CMD " as a first command. "
+	"Can be interrupted by " FIM_KBD_COLON " or " FIM_KBD_ESC ". "
+	"The other keys will execute accordingly to their function but will not interrupt the slideshow."
     },
     {"sanity-check",      no_argument,       FIM_NULL, 0x70617363,
 	"only perform a sanity check", FIM_NULL, /* Was -S until r1001 */

Attachment: signature.asc
Description: PGP signature

Reply via email to