aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2017-06-01 14:47:45 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2017-06-01 14:47:45 -0700
commit3ba5e6b909f3dbba6ae4bedb7f1a09ecfdead4eb (patch)
treecb0094fa05699b57e45afc46239d5c93a5a820f2
parent281e4017d7588594a01f784deb0ffe1dbe9ef118 (diff)
parenta6135f6114697c7755590b26062668d18f267d2b (diff)
downloadzsh-schaefer/badarrays.tar.gz
zsh-schaefer/badarrays.tar.xz
zsh-schaefer/badarrays.zip
Merge branch 'master' into schaefer/badarraysschaefer/badarrays
-rw-r--r--ChangeLog11
-rw-r--r--Completion/Unix/Command/_nm110
-rw-r--r--Src/Zle/textobjects.c9
-rw-r--r--Src/Zle/zle.h7
-rw-r--r--Src/Zle/zle_keymap.c2
5 files changed, 104 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index 03592c04d..d67ea71d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2017-06-01 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 41191: Src/Zle/textobjects.c, Src/Zle/zle.h,
+ Src/Zle/zle_keymap.c: Check for .thingy when we check for a
+ particular thingy.
+
+2017-05-30 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 41177: Completion/Unix/Command/_nm: add support for macOS
+ and OpenBSD
+
2017-05-26 Peter Stephenson <p.stephenson@samsung.com>
* 41164: Src/hashtable.c, Src/hist.c, Src/zsh.h: Don't free a
diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm
index 963b43f27..146a69e8a 100644
--- a/Completion/Unix/Command/_nm
+++ b/Completion/Unix/Command/_nm
@@ -5,55 +5,62 @@ local args files variant
files="*:object file:_object_files"
args=(
'(-A -o --print-file-name)'{-A,-o,--print-file-name}'[print name of input file on each line]'
- '(--demangle)-C[decode symbol names]'
+ '(--demangle --no-demangle)-C[decode symbol names]'
'(-D --dynamic)'{-D,--dynamic}'[display dynamic symbols instead of normal ones]'
'(-g --extern-only)'{-g,--extern-only}'[display only global symbols]'
'(-t --radix -o -x)'{-t,--radix}'[specify radix for numeric values]:radix:((d\:decimal o\:octal x\:hexadecimal))'
)
if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfutils unix -V; then
- compset -P '@' && files='*:options file:_files'
args+=(
'(- *)--help[display help information]'
- '(- *)--version[display version information]'
+ '(- *)'{-V,--version}'[display version information]'
'(-f --format -P --portability)-B[same as --format=bsd]'
- '(-C --no-demangle)--demangle=-[decode symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat)'
- "(-C --demangle)--no-demangle[don't decode symbol names]"
'(-u --undefined-only)--defined-only[display only defined symbols]'
'(-f --format -P)--format=[specify output format]:format:(bsd sysv posix)'
'(-n --numeric-sort -p --no-sort --size-sort -v)'{-n,--numeric-sort}'[sort symbols numerically by address]'
- '(-p --no-sort -n --numeric-sort -r -P --reverse-sort --size-sort)'{-p,--no-sort}'[do not sort symbols]'
+ '(-p --no-sort -n -v --numeric-sort -r --reverse-sort --size-sort)'{-p,--no-sort}'[do not sort symbols]'
'(-P --portability -B -f --format)'{-P,--portability}'[same as --format=posix]'
- '(-r --reverse-sort -p --no-sort --size-sort -v)'{-r,--reverse-sort}'[reverse sort order]'
+ '(-r --reverse-sort -p --no-sort)'{-r,--reverse-sort}'[reverse sort order]'
'(-u --undefined-only --defined-only)'{-u,--undefined-only}'[display only undefined symbols]'
'(-a --debug-syms)'{-a,--debug-syms}'[display debugger-only symbols]'
'(-S --print-size)'{-S,--print-size}'[print size of defined symbols]'
'(-s --print-armap)'{-s,--print-armap}'[include index for symbols from archive members]'
- '(-p --no-sort -n --numeric-sort -r -v)--size-sort[sort symbols by size]'
)
case $variant in
elftoolchain|binutils)
args+=(
'(-l --line-numbers)'{-l,--line-numbers}'[display source file and line numbers from debug information]'
+ "(-C --demangle)--no-demangle[don't decode symbol names]"
+ '(-p --no-sort -n -v --numeric-sort)--size-sort[sort symbols by size]'
+ '(-n --numeric-sort -p --no-sort --size-sort)-v[sort symbols numerically by address]'
+ '(- *)-h[display help information]'
)
;|
elftoolchain)
- args=( ${args:#*--(portability|extern-only)\[*}
- '(- *)-h[display help information]'
- '(-t -x)-o[print values in octal]'
- '(-t -o)-x[print values in hexadecimal]'
- '(--size-sort)-v[sort output by value]'
+ args=( ${args:#*(-C|-o|--portability)\[*}
+ '(-C --demangle)'{-C,--demangle=-}'[decode symbol names]::style:(auto gnu-v2 gnu-v3 arm)'
+ '(-g --extern-only)-e[only display global and static symbols]'
+ '(--format -P)-F+[specify output format]:format:(bsd sysv posix)'
+ '-o[with -P, same as -t o; otherwise same as -A]'
+ '(-t --radix)-x[print values in hexadecimal]'
)
;;
elfutils)
args+=(
'--mark-special[mark special symbols]'
'--color=[use color in output]:color:(always auto never)'
+ '(-C)--demangle[decode symbol names]'
+ '(--format -P)-f+[specify output format]:format:(bsd sysv posix)'
+ '(- *)--usage[give a short usage message]'
+ '(- *)-\\?[display help information]'
)
;;
binutils)
+ compset -P '@' && files='*:options file:_files'
args+=(
'(-f --format -P)-f+[specify output format]:format:(bsd sysv posix)'
+ '(-C --no-demangle)--demangle=-[decode symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat)'
'--plugin[load specified plugin]:plugin'
'--special-syms[include special symbols in the output]'
'--synthetic[display synthetic symbols as well]'
@@ -63,22 +70,65 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu
;;
esac
else
- # following flags are accurate for Solaris
- args=( ${args:#(|*\)(\*|))-[o-]*}
- "-h[don't display column headers]"
- '-l[distinguish WEAK symbols with * character]'
- '(-t -x)-o[print values in octal]'
- '(-v)-n[sort symbols by name]'
- '(-P)-p[produce parsable output]'
- '(-p)-P[portable output format]'
- '(-r)-R[print archive name, object file and symbol name]'
- '-r[prepend name of input file to each symbol name]'
- '-s[print section name instead of index]'
- '-u[print undefined symbols only]'
- '(-n)-v[sort external symbols by value]'
- '-V[display version of the nm command]'
- '(-o -t)-x[print values in hexadecimal]'
- )
+ case $OSTYPE in
+ (darwin*|openbsd*)
+ args=(
+ '(-A -o)'{-A,-o}'[prepend file name to each output line]'
+ '(-g)-a[display all symbols including those for debuggers]'
+ '(-a)-g[display only global symbols]'
+ '(-U)-u[display only undefined symbols]'
+ '(-p)-n[sort numerically rather than alphabetically]'
+ "(-n -r)-p[don't sort; display in symbol-table order]"
+ '(-p)-r[sort in reverse order]'
+ '(-j)-P[print information in a portable format]'
+ '(-j)-t[specify radix for numeric values (used with -P)]:radix:((d\:decimal o\:octal x\:hexadecimal))'
+ );|
+ (darwin*)
+ args+=(
+ "(-u)-U[don't display undefined symbols]"
+ '-f[display symbol table of dynamic library flat]'
+ '(-P -t -m)-j[just display symbol names (no value or type)]'
+ '-l[display .section_start if no symbol is in the section (used with -s)]'
+ '(-j)-m[use verbose format for Mach-O symbols]'
+ '-s[list only symbols in the specified section]:segment name: :section name: '
+ "-x[display symbol table entry's fields in hexadecimal]"
+ '*-arch[select architecture from universal file]:architecture:(all i386 x86_64)'
+ );;
+ (openbsd*)
+ args+=(
+ '-C[decode low-level symbol names]'
+ '-D[display dynamic symbol table instead of normal symbol table]'
+ '-e[output extended information]'
+ '-s[show archive index]'
+ '-w[warn about non-object archive members]'
+ );;
+ (solaris*)
+ args=( ${args:#(|*\)(\*|))-[o-]*}
+ "-h[don't display column headers]"
+ '-l[distinguish WEAK symbols with * character]'
+ '(-t -x)-o[print values in octal]'
+ '(-v)-n[sort symbols by name]'
+ '(-P)-p[produce parsable output]'
+ '(-p)-P[portable output format]'
+ '(-r)-R[print archive name, object file and symbol name]'
+ '-r[prepend name of input file to each symbol name]'
+ '-s[print section name instead of index]'
+ '-u[print undefined symbols only]'
+ '(-n)-v[sort external symbols by value]'
+ '-V[display version of the nm command]'
+ '(-o -t)-x[print values in hexadecimal]'
+ );;
+ (*)
+ # minimal POSIX
+ args=(
+ '-A[print name of input file on each line]'
+ '(-u)-g[display only global symbols]'
+ '-P[print information in a portable format]'
+ '-t[specify radix for numeric values]:radix:((d\:decimal o\:octal x\:hexadecimal))'
+ '(-g)-u[display only undefined symbols]'
+ '-v[sort symbols by value instead of by name]'
+ );;
+ esac
fi
-_arguments -s "$args[@]" $files
+_arguments -s -S : "$args[@]" $files
diff --git a/Src/Zle/textobjects.c b/Src/Zle/textobjects.c
index 3db0781ff..bf83906f2 100644
--- a/Src/Zle/textobjects.c
+++ b/Src/Zle/textobjects.c
@@ -48,9 +48,10 @@ int
selectword(UNUSED(char **args))
{
int n = zmult;
- int all = (bindk == t_selectaword || bindk == t_selectablankword);
- int (*viclass)(ZLE_CHAR_T) = (bindk == t_selectaword ||
- bindk == t_selectinword) ? wordclass : blankwordclass;
+ int all = IS_THINGY(bindk, selectaword) ||
+ IS_THINGY(bindk, selectablankword);
+ int (*viclass)(ZLE_CHAR_T) = (IS_THINGY(bindk, selectaword) ||
+ IS_THINGY(bindk, selectinword)) ? wordclass : blankwordclass;
int sclass = viclass(zleline[zlecs]);
int doblanks = all && sclass;
@@ -288,7 +289,7 @@ selectargument(UNUSED(char **args))
free(stringaszleline(linein, wstarts[wcur], &zlecs, &tmpsz, &mark));
free(linein);
- if (bindk == t_selectinshellword) {
+ if (IS_THINGY(bindk, selectinshellword)) {
ZLE_CHAR_T *match = ZWS("`\'\"");
ZLE_CHAR_T *lmatch = ZWS("\'({"), *rmatch = ZWS("\')}");
ZLE_CHAR_T *ematch = match, *found;
diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h
index 8f92e5611..07b310180 100644
--- a/Src/Zle/zle.h
+++ b/Src/Zle/zle.h
@@ -230,6 +230,13 @@ struct thingy {
/* DISABLED is (1<<0) */
#define TH_IMMORTAL (1<<1) /* can't refer to a different widget */
+/*
+ * Check if bindk refers to named thingy (a set of bare characters),
+ * also checking the special .thingy widget.
+ */
+#define IS_THINGY(bindk, name) \
+ ((bindk) == t_ ## name || (bindk) == t_D ## name)
+
/* command modifier prefixes */
struct modifier {
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 04eb70675..2e96ac780 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -961,7 +961,7 @@ bin_bindkey_meta(char *name, char *kmname, Keymap km, UNUSED(char **argv), UNUSE
m[0] = i;
metafy(m, 1, META_NOALLOC);
fn = keybind(km, m, &str);
- if(fn == t_selfinsert || fn == t_undefinedkey)
+ if(IS_THINGY(fn, selfinsert) || fn == t_undefinedkey)
bindkey(km, m, refthingy(Th(metabind[i - 128])), NULL);
}
return 0;