This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [python] [patch] set/show extended-prompt
Phil Muldoon <pmuldoon@redhat.com> writes:
> Matt Rice <ratmice@gmail.com> writes:
>
>> On Thu, Aug 11, 2011 at 8:06 AM, Phil Muldoon <pmuldoon@redhat.com> wrote:
>>
>>> +@item @var{\e}
>>> +Substitute an ESC character.
>>
>>> +def _prompt_esc(attr):
>>> + Â Â"The ESC character."
>>> + Â Âreturn '\033'
>>
>> won't usage of this (without an equivalent to bash's \[ \]) mess up
>> the prompt width calculation?
>> maybe something like...
>
> Not sure what you mean by width in this context. I checked strlen and
> for /efoo/e and it reported the length at five?
We talked a little about this on irc. In the submitted case, readline
is counting the actual \e as a character, so when it re-displays a prompt
it calculates the prompt length incorrectly (including the ESC). Matt's
approach nullifies this. I'll adjust the patch, documentation and tests
accordingly
Cheers,
Phil.
>> @item @var{\[}
>> Begins a sequence of non-printing characters.
>> @item @var{\]}
>> Ends a sequence of non-printing characters.
>>
>> def _prompt_nonprinting_begin(attr):
>> "Begins a sequence of non-printing characters."
>> return '\001'
>>
>> def _prompt_nonprinting_end(attr):
>> "Ends a sequence of non-printing characters."
>> return '\002'