[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Readline fencepost error with long prompt
From: |
Chet Ramey |
Subject: |
Re: Readline fencepost error with long prompt |
Date: |
Sat, 25 Apr 2009 22:19:31 -0400 |
User-agent: |
Thunderbird 2.0.0.21 (Macintosh/20090302) |
Andreas Schwab wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: powerpc
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='powerpc-suse-linux-gnu'
> -DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
> -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -O2 -g
> uname output: Linux igel 2.6.30-rc3 #5 SMP Thu Apr 23 11:56:14 CEST 2009
> ppc64 ppc64 ppc64 GNU/Linux
> Machine Type: powerpc-suse-linux-gnu
>
> Bash Version: 4.0
> Patch Level: 17
> Release Status: release
>
> Description:
> If the length of $PS1 exactly matches the screen width and it ends
> in invisible characters the cursor is placed to far to the right
> by the number of invisible characters.
>
> Repeat-By:
> $ PS1="$(printf %80s .)\[\033[m\]"
Try the attached patch. It should fix the problem without introducing any
regressions.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.0-patched/lib/readline/display.c 2009-01-04 14:32:32.000000000
-0500
--- lib/readline/display.c 2009-04-25 21:42:18.000000000 -0400
***************
*** 1893,1896 ****
--- 1895,1902 ----
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
***************
*** 1906,1912 ****
desired display position. */
if ((new > prompt_last_invisible) || /* XXX - don't use woff
here */
! (prompt_physical_chars > _rl_screenwidth &&
_rl_last_v_pos == prompt_last_screen_line &&
! wrap_offset >= woff &&
new >
(prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
/* XXX last comparison might need to be >= */
--- 1912,1918 ----
desired display position. */
if ((new > prompt_last_invisible) || /* XXX - don't use woff
here */
! (prompt_physical_chars >= _rl_screenwidth &&
_rl_last_v_pos == prompt_last_screen_line &&
! wrap_offset >= woff && dpos >= woff &&
new >
(prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
/* XXX last comparison might need to be >= */