Re: regression with color prompt + utf8
On Sun, Feb 05, 2006 at 03:49:38PM -0500, Chet Ramey wrote: > If I'm reading this right, it's not a regression, per se. It's always > possible to fool the redisplay code by violating the assumptions it > starts with, e.g., that the cursor always begins at column 0. > [...] Hi, Thanks for your answer. As far as I know, it's not possible to ask the terminal where the cursor is, neither is possible to send sequences such as "print a cr-lf if the cursor is not in the first column". Am I right? So yes, this is a tough problem. I do remember cases when the prompt did not appear in the first column, and when entering a command (or pressing the up arrow or something like that) it once jumped back to the 1st column. This did not bother me at all, since I saw that the program's output didn't end with newline, and I could read the last line as well. If I needed that to remain there for sure, I could press an enter to get a new prompt. What I do not understand is why color prompt and wide characters make a difference. I guess this is because in this cases it is harder to keep track where the cursor is and what the content is, and it is harder to update it by solely relative movements, it's easier to redraw the full line. On the other hand, I'd wish to see a solution to my problem, that is, to be able to see the last (partial) line of a command's output, without ugly tricks such as a prompt beginning with a newline. Here's my proposal, I'm curious what you think about it: - When a command finishes (or bash just starts up) it would simply display the prompt just where the cursor is, that is, it wouldn't send any special sequences to jump to the 1st column. - When I press the very first key in a command line, the cursor is sent back to the 1st column, the prompt is redisplayed there together with the first pressed letter, as well as a clear to the end of the line to make sure no part of the previous prompt is left there. However, as an exception, the prompt wouldn't be redisplayed if the first key hit was an Enter, ^C or ^D (or something similar that causes to leave that command line). I think it cannot be so hard to implement it as the specification is failry short, and the resulted behavior would be acceptable, too. thx, Egmont ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: support /etc/inputrc as a system-wide fallback default ?
On Saturday 04 February 2006 18:35, Dmitry V. Levin wrote: > On Sat, Feb 04, 2006 at 03:27:19PM -0500, Mike Frysinger wrote: > > we've been using a patch in Gentoo for sometime which adds support > > for /etc/inputrc as a fallback after $INPUTRC and ~/.inputrc ... i > > couldnt seem to find anything in the archives where someone proposed this > > be added to readline, but maybe i just missed it ? > > I believe this idea comes from Debian and is used also in other distros > including ALT and Owl, see e.g. > http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/bash/readline-5.1-de >b-alt-inputrc.diff attached patch is what we use in Gentoo along with some stuff i added from the above patch -mike diff -Nurp readline-5.1.orig/bind.c readline-5.1/bind.c --- readline-5.1.orig/bind.c 2005-10-14 11:04:27.0 -0400 +++ readline-5.1/bind.c 2006-02-06 19:45:04.0 -0500 @@ -791,6 +791,7 @@ rl_re_read_init_file (count, ignore) 1. the filename used for the previous call 2. the value of the shell variable `INPUTRC' 3. ~/.inputrc + 4. /etc/inputrc If the file existed and could be opened and read, 0 is returned, otherwise errno is returned. */ int @@ -799,17 +800,19 @@ rl_read_init_file (filename) { /* Default the filename. */ if (filename == 0) +filename = last_readline_init_file; + if (filename == 0) +filename = sh_get_env_value ("INPUTRC"); + if (filename == 0 || *filename == 0) { - filename = last_readline_init_file; - if (filename == 0) -filename = sh_get_env_value ("INPUTRC"); - if (filename == 0) - filename = DEFAULT_INPUTRC; + /* If there's trouble reading DEFAULT_INPUTRC then fall back + * to the SYSTEM_INPUTRC. */ + filename = DEFAULT_INPUTRC; + if (_rl_read_init_file (filename, 0) == 0) + return 0; + filename = SYSTEM_INPUTRC; } - if (*filename == 0) -filename = DEFAULT_INPUTRC; - #if defined (__MSDOS__) if (_rl_read_init_file (filename, 0) == 0) return 0; diff -Nurp readline-5.1.orig/doc/rluser.texi readline-5.1/doc/rluser.texi --- readline-5.1.orig/doc/rluser.texi 2005-09-14 14:22:30.0 -0400 +++ readline-5.1/doc/rluser.texi 2006-02-06 18:57:28.0 -0500 @@ -336,7 +336,8 @@ file is taken from the value of the shel @ifclear BashFeatures file is taken from the value of the environment variable @env{INPUTRC}. If @end ifclear -that variable is unset, the default is @file{~/.inputrc}. +that variable is unset, the default is @file{~/.inputrc}. If that file +does not exist, the last default is @file{/etc/inputrc}. When a program which uses the Readline library starts up, the init file is read, and the key bindings are set. diff -Nurp readline-5.1.orig/rlconf.h readline-5.1/rlconf.h --- readline-5.1.orig/rlconf.h 2002-01-22 12:54:23.0 -0500 +++ readline-5.1/rlconf.h 2006-02-06 19:05:02.0 -0500 @@ -37,9 +37,12 @@ /* Ugly but working hack for binding prefix meta. */ #define PREFIX_META_HACK -/* The final, last-ditch effort file name for an init file. */ +/* The second to last, user-specific init file. */ #define DEFAULT_INPUTRC "~/.inputrc" +/* The last-ditch, system-wide init file. */ +#define SYSTEM_INPUTRC "/etc/inputrc" + /* If defined, expand tabs to spaces. */ #define DISPLAY_TABS ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash