From 97df70e81db324e2574b2bfc8c906d5ff9e142f9 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Sat, 25 Apr 2009 21:42:18 -0400 Subject: [PATCH] Patch-ID: bash40-023 Bug-Reported-by: Andreas Schwab Bug-Reference-ID: Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-04/msg00160.html Bug-Description: If the prompt length exactly matches the screen width, and the prompt ends with invisible characters, readline positions the cursor incorrectly. This patch, in file bash40-023, was downloaded from ftp.gnu.org on 2011-05-29, and bash40-023.sig was furthermore verified, yielding the following output: gpg: Signature made Sat 16 May 2009 04:27:48 PM EDT using DSA key ID 64EA74AB gpg: Good signature from "Chet Ramey " --- lib/readline/display.c | 8 ++++++-- patchlevel.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/readline/display.c b/lib/readline/display.c index 9ac420a..3d3f11b 100644 --- a/lib/readline/display.c +++ b/lib/readline/display.c @@ -1894,6 +1894,10 @@ _rl_move_cursor_relative (new, data) woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset); cpos = _rl_last_c_pos; + + if (cpos == 0 && cpos == new) + return; + #if defined (HANDLE_MULTIBYTE) /* If we have multibyte characters, NEW is indexed by the buffer point in a multibyte string, but _rl_last_c_pos is the display position. In @@ -1907,9 +1911,9 @@ _rl_move_cursor_relative (new, data) prompt string, since they're both buffer indices and DPOS is a desired display position. */ if ((new > prompt_last_invisible) || /* XXX - don't use woff here */ - (prompt_physical_chars > _rl_screenwidth && + (prompt_physical_chars >= _rl_screenwidth && _rl_last_v_pos == prompt_last_screen_line && - wrap_offset >= woff && + wrap_offset >= woff && dpos >= woff && new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset))) /* XXX last comparison might need to be >= */ { diff --git a/patchlevel.h b/patchlevel.h index bda1592..262b541 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -25,6 +25,6 @@ regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh looks for to find the patch level (for the sccs version string). */ -#define PATCHLEVEL 22 +#define PATCHLEVEL 23 #endif /* _PATCHLEVEL_H_ */ -- 2.11.4.GIT