All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [RFC 2/3] readline: add ctrl-w handling (cut-the-last-word)
Date: Fri, 26 Oct 2012 09:58:54 +0400	[thread overview]
Message-ID: <1351231135-17324-3-git-send-email-antonynpavlov@gmail.com> (raw)
In-Reply-To: <1351231135-17324-1-git-send-email-antonynpavlov@gmail.com>

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 lib/readline.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/readline.c b/lib/readline.c
index 086b7f1..37566c3 100644
--- a/lib/readline.c
+++ b/lib/readline.c
@@ -328,6 +328,16 @@ int readline(const char *prompt, char *buf, int len)
 			REFRESH_TO_EOL();
 			continue;
 		}
+		case CTL_CH('w'):
+			while ((num >= 1) && (buf[num - 1] == ' ')) {
+				DO_BACKSPACE();
+			}
+
+			while ((num >= 1) && (buf[num - 1] != ' ')) {
+				DO_BACKSPACE();
+			}
+
+			break;
 		default:
 			if (isascii(ichar) && isprint(ichar))
 				cread_add_char(ichar, insert, &num, &eol_num, buf, len);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-10-26  5:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-26  5:58 [RFC 0/3] readline: add ctrl-w handling (cut-the-last-word) Antony Pavlov
2012-10-26  5:58 ` [RFC 1/3] readline: move backspace key handling to the DO_BACKSPACE macro Antony Pavlov
2012-10-26  5:58 ` Antony Pavlov [this message]
2012-10-26  5:58 ` [RFC 3/3] readline: fix the 'new blank line at EOF' typo Antony Pavlov
2012-10-27 12:24 ` [RFC 0/3] readline: add ctrl-w handling (cut-the-last-word) Sascha Hauer
2012-10-28 15:11   ` Antony Pavlov
2012-10-29  9:02     ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1351231135-17324-3-git-send-email-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.