However, since readline 7.0 update, it acts weird with multiline prompts.
after every completion, the current line shifts up by 2 and i'm not a python nor readline expert at all.
Anyone can look into this?
-EDIT
I think i sort it out...
change line 384: psheight=$( echo -ne "$1" | wc -l); shift
with: psheight=0
* it now uses compgen too
* opens the filelist window "inside" the caller Xwindow.
* show icons near the filelist item that indicates the type of completion (dir,file,alias,environment,builtin and so on)
* writing keys on the keyboard will select the matching item from the filelist
* aur package available as kingbash-gb-git
Because I don't really see many updates coming anymore, and so I'll also just keep posting in this thread so it's easier for me. There are a few bugs left (like with F3 / time sort, and escaping out of line with backslashes can cause double backslashes), but I haven't been bothered to fix them. For (my) normal usage I think it's just fine as it is now and I'm really happy with it. Maybe if people have feature requests or my usage patterns change, then I'll work on it again.
]]>curl 'http://pastebin.com/raw.php?i=xY6hBVxf' | sed 's/\r$//' > kingbash.script
curl 'http://pastebin.com/raw.php?i=gMe6jvjk' | sed 's/\r$//' > kbdmenu
Would it be possible for you to create a repository on github? This would allow easier tracking of changes, packaging in other distros, issue tracking and distributed development...
#bestRegards
kingbash:
curl 'http://pastebin.com/raw.php?i=xY6hBVxf' | sed 's/\r$//' > kingbash.script
chmod +x kingbash.script
bind -x '"\t":out=$(kingbash.script "$PS1" "$(compgen -A alias -A function)" nohelp); READLINE_LINE=$(echo "$out" | head -n -1); READLINE_POINT=$(echo "$out" | tail -n 1)'
kbdmenu:
curl 'http://pastebin.com/raw.php?i=gMe6jvjk' | sed 's/\r$//' > kbdmenu
chmod +x kbdmenu
curl 'http://pastebin.com/raw.php?i=BMSfh1UU' | sed 's/\r$//' > kingbash.script
bind -x '"\t":out=$(kingbash.script "$PS1" "$(compgen -A alias -A function)" nohelp); READLINE_LINE=$(echo "$out" | head -n -1); READLINE_POINT=$(echo "$out" | tail -n 1)'
Because it's a function now, you need to pass compgen -A alias -A function to get completion for those commands.
You can add or replace "dirfirst" to "nohelp" if you want.
]]>I've had two options kind of tagged on: the help bar and directories first. Keep them like they are?
]]>I wrote an example script that shows the bug clearly, please try it out:
#! /bin/bash
function bb() {
# READFIRST="${READLINE_LINE::$READLINE_POINT}"
READFIRST=$1
IFS=$' \t\n'
last="${READFIRST##* }"
rest="${READFIRST% *}"
before=
while [[ -z "$before" ]] ; do
echo REST:$rest:
echo LAST:$last:
if [[ "${rest: -1}" == '\' ]]; then
last="${rest##* } $last"
oldrest=$rest
rest=${rest% *}
if [[ "$oldrest" == "$rest" ]]; then
echo :--Mistake--:
# sleep 0.01
# rest=${rest% *}
# if [[ "$oldrest" == "$rest" ]]; then
# echo 'unable to interpret'
# echo
# return
# fi
fi
else
before=$rest\
fi
done
echo
}
bb 'mplayer \[Commie\]\ Vividred\ Operation\ -\ 03\ \[D3429195\].'
echo
bb 'mplayer \[Commie\]\ Vividred\ Operation\ -\ 04\ '
echo
#bb 'mplayer \[Commie\]\ Ore\ no\ Kanojo\ to\ Osananajimi\ ga\ Shuraba\ Sugiru\ -\ My\ Girlfriend\ and\ Childhood\ Friend\ Fight\ Too\ Much\ -\ 01\ \[1C42F3FD\]'
#echo
#bb 'mplayer \[Commie\]\ Ore\ no\ Kanojo\ to\ Osananajimi\ ga\ Shuraba\ Sugiru\ -\ My\ Girlfriend\ and\ Childhood\ Friend\ Fight\ Too\ Much\ -\ 01\ '
#echo
#bb 'mplayer \[Commie\]\ Ore\ no\ Kanojo\ to\ Osananajimi\ ga\ Shuraba\ Sugiru\ -\ My\ Girlfriend\ and\ Childhood\ Friend\ Fight\ Too\ Much\ -\ 0'
#echo
#bb 'mplayer \[Commie\]\ Ore\ no\ Kanojo\ to\ Osananajimi\ ga\ Shuraba\ Sugiru\ -\ My\ Girlfriend\ and\ Childhood\ Friend\ Fight\ Too\ Much'
#echo
[[ $1 ]] && bb "$1"
Not that it will go into an infinite loop if there's no non-escaped space.
If it echoes "Mistake" that means rest=${rest% *} didn't do anything and that means the last word in $rest will be appended another time to $last. It usually works after a few times.
Example output in the final run:
REST:mplayer:
LAST:\[Commie\]\ Vividred\ Operation\ Operation\ Operation\ -\ -\ -\ -\ -\ -\ 04\ 04\ 04\ 04\ 04\ 04\ :
This means ${variable%...} is broken.
Any ideas what this could be or should I contact the bash devs?
]]>curl 'http://pastebin.com/raw.php?i=ndN4XjNv' | sed 's/\r$//' > kingbash.function
I also made it so that command completions from scratch like with F2 and deleting all characters makes it so that it will prompt for the first key.
Because a list of all commands sometimes gives kind of an annoying delay.
I also added a help bar at the bottom. You can remove it by running the bind -x command with "nohelp" as an argument:
bind -x '"\t":kb_main nohelp'
It's in the examples at the bottom of the file too.
curl 'http://pastebin.com/raw.php?i=qKKHecdW' | sed 's/\r$//' > kingbash.function