mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-29 14:43:02 +02:00
use anonymous files for here-documents if available and the document size exceeds pipe capacity; fixes to build if multibyte characters are unavailable; fix potential overflow with extrememly long $'...' strings; fix for readline redisplay highlighting with a zero-length region
This commit is contained in:
@@ -417,6 +417,10 @@
|
||||
<td>./startup-files/Bashrc.bfox</td>
|
||||
<td>Sample Bourne Again SHell init file (Fox).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>./startup-files/fix-output</td>
|
||||
<td>A pair of functions that will add a newline if the previous command doesn't end with one.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>./startup-files/README</td>
|
||||
<td>README</td>
|
||||
|
||||
+1
-1
@@ -99,5 +99,5 @@ Path Description X-Ref
|
||||
./startup-files/bash-profile Sample startup file for bash login shells (Ramey).
|
||||
./startup-files/bashrc Sample Bourne Again SHell init file (Ramey).
|
||||
./startup-files/Bashrc.bfox Sample Bourne Again SHell init file (Fox).
|
||||
./startup-files/fix-output A pair of functions that will add a newline if the previous command doesn't end with one.
|
||||
./startup-files/README README
|
||||
|
||||
|
||||
@@ -10,3 +10,9 @@ bash-profile Sample startup file for bash login shells (Ramey).
|
||||
bashrc Sample Bourne Again SHell init file (Ramey).
|
||||
Bashrc.bfox Sample Bourne Again SHell init file (Fox).
|
||||
README README
|
||||
|
||||
These files are quite old.
|
||||
|
||||
fix-output contains a pair of functions and an example assignment to
|
||||
PROMPT_COMMAND that will force a newline if a command does not leave the
|
||||
cursor at column 0.
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# This is an example set of functions to call from PROMPT_COMMAND. If you
|
||||
# run commands that don't terminate their output with a newline, this can
|
||||
# detect it and add a newline before printing the readline prompt.
|
||||
|
||||
# Readline assumes that it begins with the cursor in column 0 and makes
|
||||
# redisplay decisions based on that. If it does not start at column 0, for
|
||||
# example if the previous command does not end with a newline, it will lead
|
||||
# to display problems when the cursor is not where readline assumes.
|
||||
|
||||
_fetch_cursor_position()
|
||||
{
|
||||
local -a pos
|
||||
IFS='[;' read -t 0.5 -p $'\e[6n' -d R -a pos -rs || {
|
||||
echo "${FUNCNAME}: failed: $? ; ${pos[*]}" >&2
|
||||
return 1
|
||||
}
|
||||
_cursor_row="${pos[1]}"
|
||||
_cursor_col="${pos[2]}"
|
||||
}
|
||||
|
||||
_prompt_command()
|
||||
{
|
||||
_fetch_cursor_position && (( $_cursor_col > 1 )) && printf '\n'
|
||||
}
|
||||
|
||||
PROMPT_COMMAND=_prompt_command
|
||||
Reference in New Issue
Block a user