Bug 4671 - Add more readline bindings to the console
Status: RESOLVED WONTFIX
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: GIT MASTER
Hardware: All All
: P3 enhancement
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
: 4672
Depends on:
Blocks:
 
Reported: 2010-07-03 16:02 EDT by q3urt.undead
Modified: 2011-03-09 20:06:30 EST
1 user (show)

See Also:



Description q3urt.undead 2010-07-03 16:02:56 EDT
This is against the latest SVN.  It adds more readline bindings
because I always hit ctrl+k :)

http://pastebin.com/YGLeNDQ3


It adds the following bindings:

ctrl+k  = kill from current point to the end of the line
ctrl+u  = kill from current point to the beginning of the line
alt+b   = go backward a word (here I took the liberty of defining a
word as non-space because the Emacs definition will be confusing to
non-Emacs users)
alt+f    = go forward a word (same definition of a word)
ctrl+d  = delete a character
alt+u   = uppercase a word
alt+l    = lowercase a word
alt+c   = capitalize the first letter and lowercase the rest of the word
ctrl+del = backward kill a word
ctrl+y   = yank from the kill ring
ctrl+t   = transpose characters
alt+d   = forward kill a word

The kill ring has a depth of one.   Hey, it's better than nothing.  I
would also like to add ctrl+< and ctrl+> to go to the beginning/end of
the history.  It should also add a history item for the current text
when you hit up in case you ever want to go back to the partial.  It
would be really nice to add Emacs style undo/redo support.

This adds a lot of what is in libreadline but not everything.  I'm not
going to touch recording/playing back macros.  It's unfortunate that
Escape is already so integrated because I keep hitting escape since
I'm used to that in Emacs.

Anyway, hope someone out there enjoys.  I added a number of OpenBSD
implementations like strlcpy() and strlcat() instead of the ioquake3
written versions.  I had to revert a number of changes because lcc
barfed on the OpenBSD implementations even though gcc had no problem.
Comment 1 Zachary J. Slater 2010-10-19 02:22:47 EDT
This is kind of awesome, I'll look at it again later.
Comment 2 Zachary J. Slater 2010-10-19 02:23:35 EDT
*** Bug 4672 has been marked as a duplicate of this bug. ***
Comment 3 Thilo Schulz 2011-03-09 20:06:30 EST
I don't feel particularly good with this patch for these reasons:

- They change lots of fundamental string functions
- It's lots of code added which has to be maintained, has the potential for bugs
- Not very much gain. Hell, I've been using Linux and its shell for the past 12 years and I never learned these key combinations

I realize this is lots of work. Zakk: Maybe you want to add this patch to the patches section? http://ioquake3.org/extras/patches/