History log of /freebsd/bin/sh/histedit.c (Results 1 – 25 of 147)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# e043f372 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remov

bin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix

show more ...


# 90aea514 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl s

bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix

show more ...


Revision tags: release/14.0.0
# 8e5c53af 30-Apr-2023 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

sh: also auto-complete functions

Differential Revision: https://reviews.freebsd.org/D40619


# 0fd450e2 29-Apr-2023 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

sh: tab-complete aliases

Differential Revision: https://reviews.freebsd.org/D40619


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 14dd0012 29-Apr-2023 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

sh: also auto-complete built-ins

Reported in a comment in PR 261728.

Reported by: Oleg
Reviewed by: jilles (previous version), bapt
Differential Revision: https://reviews.freebsd.org/D39839


# 43489c14 29-Apr-2023 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

sh: improve style


Revision tags: release/13.2.0
# 3ce64010 20-Mar-2023 Daniel Kolesa <q66@chimera-linux.org>

sh(1): fix history file write checking

We cannot just compare histsizeval() against 0, since that returns
a string pointer, which is always non-zero (non-null). The logic
in sethistsize() initialize

sh(1): fix history file write checking

We cannot just compare histsizeval() against 0, since that returns
a string pointer, which is always non-zero (non-null). The logic
in sethistsize() initializes the history size to 100 with values
that are non-number, and an empty string counts as that. Therefore,
the only time we want to not write into history with HISTSIZE val
set is when it's explicitly 0.

MFC after: 2 weeks

show more ...


# 3cf65f8a 08-Dec-2022 Juraj Lutter <otis@FreeBSD.org>

sh(1): Allow non-printing characters in prompt strings

Introduce new prompt format characters:

- '\[' starts the sequence of non-printing chatacters
- '\]' ends the sequence of non-printing charact

sh(1): Allow non-printing characters in prompt strings

Introduce new prompt format characters:

- '\[' starts the sequence of non-printing chatacters
- '\]' ends the sequence of non-printing characters

Within these sequences, the following characters are now supported:

- '\a' emits ASCII BEL (0x07, 007) character
- '\e' emits ASCII ESC (0x1b, 033) character
- '\r' emits ASCII CR (0x0d, 015) character
- '\n' emits ASCII CRLF sequence

These can be used to embed ANSI sequences into prompt strings.

Example in .shrc:

PS1="\[\e[7m\]\u@\h\[\e[0m\]:\w \\$ "

This tries to maintain some degree of compatibility with GNU bash,
that uses GNU readline library (which behaves slightly different from
BSD editline): It has two "non-printing boundary" characters:

- RL_PROMPT_START_IGNORE (\001)
- RL_PROMPT_END_IGNORE (\002)

while BSD editline only has one (when using EL_PROMPT_ESC setting), so
for this purpose, ASCII \001 was chosen and both \[ and \] emits
this character.

And while here, enlarge PROMPTLEN from 128 to 192 characters.

Reviewed by: jilles
Approved by: jilles
Differential Revision: https://reviews.freebsd.org/D37701

show more ...


Revision tags: release/12.4.0
# 755a1be6 20-Aug-2022 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

sh: accept fc options grouped behind one '-'

As per Utility Syntax Guidelines, accept both forms: -l -n and -ln.

To do that, anticipate the source string for the next option that will
be parsed by

sh: accept fc options grouped behind one '-'

As per Utility Syntax Guidelines, accept both forms: -l -n and -ln.

To do that, anticipate the source string for the next option that will
be parsed by nextopt(). It's not always *argptr, sometimes it is
nextopt_optptr.

To simplify the check for not_fcnumber, slightly modify nextopt() to
always nullify nextopt_optptr in cases where it would have been set
to point to a NUL character.

Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D35836

show more ...


Revision tags: release/13.1.0
# 68700941 12-Mar-2022 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

sh: fix autocompletion for commands that share name with a directory

Provide libedit a special function making it always add a space after
the autocompleted command. The default one adds a slash if

sh: fix autocompletion for commands that share name with a directory

Provide libedit a special function making it always add a space after
the autocompleted command. The default one adds a slash if the word is
also a name of a directory in the current working directory, but this is
wrong for commands.

Reviewed by: bapt, jilles
Differential Revision: https://reviews.freebsd.org/D34544

show more ...


Revision tags: release/12.3.0
# d2c23317 23-Sep-2021 Stephane Rochoy <stephane.rochoy@stormshield.eu>

sh: Add -o verify to use O_VERIFY when sourcing scripts

Add -o verify to sh to make it use O_VERIFY when
sourcing scripts and reading profiles.

Useful in conjunction with mac_veriexec to help prote

sh: Add -o verify to use O_VERIFY when sourcing scripts

Add -o verify to sh to make it use O_VERIFY when
sourcing scripts and reading profiles.

Useful in conjunction with mac_veriexec to help protect at
least some parts of the boot sequence, e.g., /etc/rc*.

Differential revision: https://reviews.freebsd.org/D30464
Reviewed by: jilles, sjg
Obtained from: Stormshield

show more ...


# 1f82fb38 22-Sep-2021 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

sh: try to avoid overwriting HISTFILE produced by other shells

If an attempt to load history from an existing history file was
unsuccessful, do not try to save command history to that file on exit.


# c866d0c7 22-Sep-2021 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

sh: improve command completion

When there are many matches, find the longest common substring starting
from the beginning of each command and use that to replace input.

As an example: on my system,

sh: improve command completion

When there are many matches, find the longest common substring starting
from the beginning of each command and use that to replace input.

As an example: on my system, llv<tab> will be autocompleted to llvm-
and another <tab> will print all matching llvm commands.

show more ...


# 9413dfd3 19-Sep-2021 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

sh: reset sh bindings on bind -e, bind -v

Until this change, any bindings set in histedit() were lost on calls to
bindcmd().

Only bind -e and bind -v call libedit's keymacro_reset(). Currently you

sh: reset sh bindings on bind -e, bind -v

Until this change, any bindings set in histedit() were lost on calls to
bindcmd().

Only bind -e and bind -v call libedit's keymacro_reset(). Currently you
cannot fool libedit/map.c:map_bind() by trying something like bind -le
as when p[0] == '-', it does a switch statement on p[1].

show more ...


# 908b8e32 22-Sep-2021 Baptiste Daroussin <bapt@FreeBSD.org>

sh: remove emacs improvements that are now defaults in libedit


# b8ff849c 18-Sep-2021 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

sh: improve command completion

When multiple matches are found, we keep the provided string on the
input line and print unique matches as suggestions.

But the multiple matches might be the same com

sh: improve command completion

When multiple matches are found, we keep the provided string on the
input line and print unique matches as suggestions.

But the multiple matches might be the same command found in different
directories, so we should deduplicate the matches first and then decide
whether to autocomplete the command or not, based on the number of
unique matches.

show more ...


# 3ae61b97 28-Aug-2021 Baptiste Daroussin <bapt@FreeBSD.org>

sh: improve emacs mode

in emacs mode ^W should delete the previous word by default
Note that upstreaming this change directly into libedit is in process.

Reported by: manu
Reviewed by: jills, pstef

sh: improve emacs mode

in emacs mode ^W should delete the previous word by default
Note that upstreaming this change directly into libedit is in process.

Reported by: manu
Reviewed by: jills, pstef, manu
Differential Revision: https://reviews.freebsd.org/D29493

show more ...


# 35b253d9 18-Aug-2021 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

sh: fix NO_HISTORY build

Move code added in b315a7296d2a ("autocomplete commands") to
conditionally compiled part under #ifndef NO_HISTORY.

Reported by: bdrewery
Fixes: b315a7296d2a


Revision tags: release/13.0.0
# 988b1bb0 30-Mar-2021 Baptiste Daroussin <bapt@FreeBSD.org>

sh: implement persistent history storage

Implement persistent history storage:
the strategy is simple at start: loads the existing .sh_history file
at exit dump it.

The implementation respects the

sh: implement persistent history storage

Implement persistent history storage:
the strategy is simple at start: loads the existing .sh_history file
at exit dump it.

The implementation respects the HISTFILE variable and its POSIX
definition: ~/.sh_history is used if HISTFILE is not set.

to avoid sh to create the history file, set HISTSIZE to 0 or HISTFILE to
en empty value

Co-authored-by: pstef
Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D29493

show more ...


# 660045fb 30-Mar-2021 Baptiste Daroussin <bapt@FreeBSD.org>

sh: improve emacs mode

In emacs mode, force ^R to backware search the history
This behaviour is the default in emacs mode for most of the other shells

Note: Note that this can still be overridden v

sh: improve emacs mode

In emacs mode, force ^R to backware search the history
This behaviour is the default in emacs mode for most of the other shells

Note: Note that this can still be overridden via $EDITRC, ~/.editrc or a
bind command after set -o emacs.

MFC after: 1 week
Approved by: jilles
Reviewed by: jilles, arichardson, pstef
Differential Revision: https://reviews.freebsd.org/D29494

show more ...


# b315a729 28-Mar-2021 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

sh(1): autocomplete commands

Without this patch, sh can autocomplete file names but not commands from
$PATH. Use libedit's facility to execute custom function for autocomplete,
but yield to the libr

sh(1): autocomplete commands

Without this patch, sh can autocomplete file names but not commands from
$PATH. Use libedit's facility to execute custom function for autocomplete,
but yield to the library's standard autocomplete function when cursor is
not at position 0.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D29361

show more ...


Revision tags: release/12.2.0, release/11.4.0
# 6c346639 21-Apr-2020 Bryan Drewery <bdrewery@FreeBSD.org>

Fix build with NO_HISTORY set

Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D24458


Revision tags: release/12.1.0
# 419f843f 17-Sep-2019 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r352319 through r352435.


# f3703557 16-Sep-2019 Baptiste Daroussin <bapt@FreeBSD.org>

Do not use our custom completion function, it is not needed anymore


123456