Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libedit: 20191025 -> 20191231 #77148

Merged
merged 1 commit into from Jan 7, 2020
Merged

Conversation

dtzWill
Copy link
Member

@dtzWill dtzWill commented Jan 6, 2020

Motivation for this change

Bump! Diff incoming...

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

(cherry picked from commit 716b064)
@dtzWill
Copy link
Member Author

dtzWill commented Jan 6, 2020

diff --git a/ChangeLog b/ChangeLog
index b54cd3d..a9cea10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,20 @@
    * See also NetBSD changelog:
 	http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit
 
+2019-12-31 Jess Thrysoee
+
+   * version-info: 0:63:0
+
+   * configure.ac: Support -ltinfo as split in newer ncurses
+	The newer versions of ncurses support building terminfo routines as a split -ltinfo library.
+	Patch by Michał Górny
+
+2019-12-11 Jess Thrysoee
+
+   * version-info: 0:62:0
+
+   * all: sync with upstream source
+
 2019-10-25 Jess Thrysoee
 
    * version-info: 0:61:0
diff --git a/config.h.in b/config.h.in
index 9e85673..2db98cf 100644
--- a/config.h.in
+++ b/config.h.in
@@ -51,6 +51,9 @@
 /* Define to 1 if you have the `termcap' library (-ltermcap). */
 #undef HAVE_LIBTERMCAP
 
+/* Define to 1 if you have the `tinfo' library (-ltinfo). */
+#undef HAVE_LIBTINFO
+
 /* Define to 1 if you have the <limits.h> header file. */
 #undef HAVE_LIMITS_H
 
diff --git a/configure b/configure
index 94e4ca6..5f20ebe 100755
--- a/configure
+++ b/configure
@@ -586,7 +586,7 @@ MAKEFLAGS=
 
 # Identity of this package.
 PACKAGE_NAME='libedit'
-PACKAGE_TARNAME='libedit-20191025'
+PACKAGE_TARNAME='libedit-20191231'
 PACKAGE_VERSION='3.1'
 PACKAGE_STRING='libedit 3.1'
 PACKAGE_BUGREPORT=''
@@ -1374,7 +1374,7 @@ Fine tuning of the installation directories:
   --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
   --mandir=DIR            man documentation [DATAROOTDIR/man]
   --docdir=DIR            documentation root
-                          [DATAROOTDIR/doc/libedit-20191025]
+                          [DATAROOTDIR/doc/libedit-20191231]
   --htmldir=DIR           html documentation [DOCDIR]
   --dvidir=DIR            dvi documentation [DOCDIR]
   --pdfdir=DIR            pdf documentation [DOCDIR]
@@ -4223,7 +4223,7 @@ fi
 
 
 # Define the identity of the package.
- PACKAGE='libedit-20191025'
+ PACKAGE='libedit-20191231'
  VERSION='3.1'
 
 
@@ -12118,7 +12118,7 @@ CC=$lt_save_CC
 
 
 # libtool -version-info
-LT_VERSION=0:61:0
+LT_VERSION=0:63:0
 
 
 # Check whether --enable-silent-rules was given.
@@ -12580,7 +12580,54 @@ _ACEOF
   LIBS="-ltermcap $LIBS"
 
 else
-  as_fn_error $? "libncurses, libcurses, or libtermcap is required!" "$LINENO" 5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltinfo" >&5
+$as_echo_n "checking for tgetent in -ltinfo... " >&6; }
+if ${ac_cv_lib_tinfo_tgetent+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltinfo  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char tgetent ();
+int
+main ()
+{
+return tgetent ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_tinfo_tgetent=yes
+else
+  ac_cv_lib_tinfo_tgetent=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_tgetent" >&5
+$as_echo "$ac_cv_lib_tinfo_tgetent" >&6; }
+if test "x$ac_cv_lib_tinfo_tgetent" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBTINFO 1
+_ACEOF
+
+  LIBS="-ltinfo $LIBS"
+
+else
+  as_fn_error $? "libncurses, libcurses, libtermcap or libtinfo is required!" "$LINENO" 5
+
+fi
+
 
 fi
 
diff --git a/configure.ac b/configure.ac
index f07d42e..6aaac0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,7 +35,7 @@ AM_INIT_AUTOMAKE
 AC_PROG_LIBTOOL
 
 # libtool -version-info
-AC_SUBST(LT_VERSION, [0:61:0])
+AC_SUBST(LT_VERSION, [0:63:0])
 
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
@@ -49,7 +49,9 @@ EL_MANTYPE
 AC_CHECK_LIB(ncurses, tgetent,,
   [AC_CHECK_LIB(curses, tgetent,,
     [AC_CHECK_LIB(termcap, tgetent,,
-      [AC_MSG_ERROR([libncurses, libcurses, or libtermcap is required!])]
+      [AC_CHECK_LIB(tinfo, tgetent,,
+        [AC_MSG_ERROR([libncurses, libcurses, libtermcap or libtinfo is required!])]
+      )]
     )]
   )]
 )
diff --git a/src/filecomplete.c b/src/filecomplete.c
index 189798c..f1d2c57 100644
--- a/src/filecomplete.c
+++ b/src/filecomplete.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecomplete.c,v 1.61 2019/10/09 14:31:07 christos Exp $	*/
+/*	$NetBSD: filecomplete.c,v 1.62 2019/12/10 19:42:09 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "config.h"
 
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.61 2019/10/09 14:31:07 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.62 2019/12/10 19:42:09 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -698,107 +698,110 @@ fn_complete(EditLine *el,
 	if (over != NULL)
 		*over = 0;
 
-	if (matches) {
-		int i;
-		size_t matches_num, maxlen, match_len, match_display=1;
-		int single_match = matches[2] == NULL &&
-			(matches[1] == NULL || strcmp(matches[0], matches[1]) == 0);
-
-		retval = CC_REFRESH;
-
-		if (matches[0][0] != '\0') {
-			el_deletestr(el, (int)len);
-			if (!attempted_completion_function)
-				completion = escape_filename(el, matches[0],
-				    single_match, app_func);
-			else
-				completion = strdup(matches[0]);
-			if (completion == NULL)
-				goto out;
-			if (single_match) {
-				/* We found exact match. Add a space after it,
-				 * unless we do filename completion and the
-				 * object is a directory. Also do necessary
-				 * escape quoting
-				 */
-				el_winsertstr(el,
-				    ct_decode_string(completion, &el->el_scratch));
-			} else {
-				/* Only replace the completed string with
-				 * common part of possible matches if there is
-				 * possible completion.
-				 */
-				el_winsertstr(el,
-				    ct_decode_string(completion, &el->el_scratch));
-			}
-			free(completion);
-		}
+	if (matches == NULL) {
+		goto out;
+	}
+	int i;
+	size_t matches_num, maxlen, match_len, match_display=1;
+	int single_match = matches[2] == NULL &&
+		(matches[1] == NULL || strcmp(matches[0], matches[1]) == 0);
+
+	retval = CC_REFRESH;
+
+	if (matches[0][0] != '\0') {
+		el_deletestr(el, (int)len);
+		if (!attempted_completion_function)
+			completion = escape_filename(el, matches[0],
+			    single_match, app_func);
+		else
+			completion = strdup(matches[0]);
+		if (completion == NULL)
+			goto out;
 
+		/*
+		 * Replace the completed string with the common part of
+		 * all possible matches if there is a possible completion.
+		 */
+		el_winsertstr(el,
+		    ct_decode_string(completion, &el->el_scratch));
 
-		if (!single_match && (what_to_do == '!' || what_to_do == '?')) {
+		if (single_match && attempted_completion_function) {
 			/*
-			 * More than one match and requested to list possible
-			 * matches.
+			 * We found an exact match. Add a space after
+			 * it, unless we do filename completion and the
+			 * object is a directory. Also do necessary
+			 * escape quoting
 			 */
+			el_winsertstr(el, ct_decode_string(
+			    (*app_func)(completion), &el->el_scratch));
+		}
+		free(completion);
+	}
 
-			for(i = 1, maxlen = 0; matches[i]; i++) {
-				match_len = strlen(matches[i]);
-				if (match_len > maxlen)
-					maxlen = match_len;
-			}
-			/* matches[1] through matches[i-1] are available */
-			matches_num = (size_t)(i - 1);
 
-			/* newline to get on next line from command line */
-			(void)fprintf(el->el_outfile, "\n");
+	if (!single_match && (what_to_do == '!' || what_to_do == '?')) {
+		/*
+		 * More than one match and requested to list possible
+		 * matches.
+		 */
 
-			/*
-			 * If there are too many items, ask user for display
-			 * confirmation.
-			 */
-			if (matches_num > query_items) {
-				(void)fprintf(el->el_outfile,
-				    "Display all %zu possibilities? (y or n) ",
-				    matches_num);
-				(void)fflush(el->el_outfile);
-				if (getc(stdin) != 'y')
-					match_display = 0;
-				(void)fprintf(el->el_outfile, "\n");
-			}
+		for(i = 1, maxlen = 0; matches[i]; i++) {
+			match_len = strlen(matches[i]);
+			if (match_len > maxlen)
+				maxlen = match_len;
+		}
+		/* matches[1] through matches[i-1] are available */
+		matches_num = (size_t)(i - 1);
 
-			if (match_display) {
-				/*
-				 * Interface of this function requires the
-				 * strings be matches[1..num-1] for compat.
-				 * We have matches_num strings not counting
-				 * the prefix in matches[0], so we need to
-				 * add 1 to matches_num for the call.
-				 */
-				fn_display_match_list(el, matches,
-				    matches_num+1, maxlen, app_func);
-			}
-			retval = CC_REDISPLAY;
-		} else if (matches[0][0]) {
+		/* newline to get on next line from command line */
+		(void)fprintf(el->el_outfile, "\n");
+
+		/*
+		 * If there are too many items, ask user for display
+		 * confirmation.
+		 */
+		if (matches_num > query_items) {
+			(void)fprintf(el->el_outfile,
+			    "Display all %zu possibilities? (y or n) ",
+			    matches_num);
+			(void)fflush(el->el_outfile);
+			if (getc(stdin) != 'y')
+				match_display = 0;
+			(void)fprintf(el->el_outfile, "\n");
+		}
+
+		if (match_display) {
 			/*
-			 * There was some common match, but the name was
-			 * not complete enough. Next tab will print possible
-			 * completions.
+			 * Interface of this function requires the
+			 * strings be matches[1..num-1] for compat.
+			 * We have matches_num strings not counting
+			 * the prefix in matches[0], so we need to
+			 * add 1 to matches_num for the call.
 			 */
-			el_beep(el);
-		} else {
-			/* lcd is not a valid object - further specification */
-			/* is needed */
-			el_beep(el);
-			retval = CC_NORM;
+			fn_display_match_list(el, matches,
+			    matches_num+1, maxlen, app_func);
 		}
-
-		/* free elements of array and the array itself */
-		for (i = 0; matches[i]; i++)
-			el_free(matches[i]);
-		el_free(matches);
-		matches = NULL;
+		retval = CC_REDISPLAY;
+	} else if (matches[0][0]) {
+		/*
+		 * There was some common match, but the name was
+		 * not complete enough. Next tab will print possible
+		 * completions.
+		 */
+		el_beep(el);
+	} else {
+		/* lcd is not a valid object - further specification */
+		/* is needed */
+		el_beep(el);
+		retval = CC_NORM;
 	}
 
+	/* free elements of array and the array itself */
+	for (i = 0; matches[i]; i++)
+		el_free(matches[i]);
+	el_free(matches);
+	matches = NULL;
+
 out:
 	el_free(temp);
 	return retval;
diff --git a/src/terminal.c b/src/terminal.c
index 1f734e5..2e62f7b 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: terminal.c,v 1.40 2019/09/15 21:09:11 christos Exp $	*/
+/*	$NetBSD: terminal.c,v 1.41 2019/11/12 20:59:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)term.c	8.2 (Berkeley) 4/30/95";
 #else
-__RCSID("$NetBSD: terminal.c,v 1.40 2019/09/15 21:09:11 christos Exp $");
+__RCSID("$NetBSD: terminal.c,v 1.41 2019/11/12 20:59:46 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -497,7 +497,7 @@ terminal_move_to_line(EditLine *el, int where)
 	if (where == el->el_cursor.v)
 		return;
 
-	if (where > el->el_terminal.t_size.v) {
+	if (where >= el->el_terminal.t_size.v) {
 #ifdef DEBUG_SCREEN
 		(void) fprintf(el->el_errfile,
 		    "%s: where is ridiculous: %d\r\n", __func__, where);
@@ -647,7 +647,8 @@ terminal_overwrite(EditLine *el, const wchar_t *cp, size_t n)
 	if (el->el_cursor.h >= el->el_terminal.t_size.h) {	/* wrap? */
 		if (EL_HAS_AUTO_MARGINS) {	/* yes */
 			el->el_cursor.h = 0;
-			el->el_cursor.v++;
+			if (el->el_cursor.v + 1 < el->el_terminal.t_size.v)
+				el->el_cursor.v++;
 			if (EL_HAS_MAGIC_MARGINS) {
 				/* force the wrap to avoid the "magic"
 				 * situation */

@dtzWill
Copy link
Member Author

dtzWill commented Jan 6, 2020

In case you find it useful, I sometimes maintain: https://github.com/dtzWill/libedit-releases for comparing posted libedit tarballs and such. Can't convince GitHub to compare the tags nicely since "unrelated histories" but local git tools work as expected :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant