1/* $NetBSD: readline.c,v 1.115 2015/04/01 15:23:15 christos Exp $ */ |
2 3/*- 4 * Copyright (c) 1997 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Jaromir Dolecek. 9 * --- 16 unchanged lines hidden (view full) --- 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32#include "config.h" 33#if !defined(lint) && !defined(SCCSID) |
34__RCSID("$NetBSD: readline.c,v 1.115 2015/04/01 15:23:15 christos Exp $"); |
35#endif /* not lint && not SCCSID */ 36#include <sys/cdefs.h> |
37__FBSDID("$FreeBSD: head/lib/libedit/readline.c 283084 2015-05-18 22:03:05Z bapt $"); |
38 39#include <sys/types.h> 40#include <sys/stat.h> 41#include <stdio.h> 42#include <dirent.h> 43#include <string.h> 44#include <pwd.h> 45#include <ctype.h> --- 313 unchanged lines hidden (view full) --- 359 /* 360 * Send TSTP when ^Z is pressed. 361 */ 362 el_set(e, EL_ADDFN, "rl_tstp", 363 "ReadLine compatible suspend function", 364 _el_rl_tstp); 365 el_set(e, EL_BIND, "^Z", "rl_tstp", NULL); 366 |
367 /* 368 * Set some readline compatible key-bindings. 369 */ 370 el_set(e, EL_BIND, "^R", "em-inc-search-prev", NULL); 371 372 /* 373 * Allow the use of Home/End keys. 374 */ 375 el_set(e, EL_BIND, "\\e[1~", "ed-move-to-beg", NULL); 376 el_set(e, EL_BIND, "\\e[4~", "ed-move-to-end", NULL); 377 el_set(e, EL_BIND, "\\e[7~", "ed-move-to-beg", NULL); 378 el_set(e, EL_BIND, "\\e[8~", "ed-move-to-end", NULL); 379 el_set(e, EL_BIND, "\\e[H", "ed-move-to-beg", NULL); 380 el_set(e, EL_BIND, "\\e[F", "ed-move-to-end", NULL); 381 382 /* 383 * Allow the use of the Delete/Insert keys. 384 */ 385 el_set(e, EL_BIND, "\\e[3~", "ed-delete-next-char", NULL); 386 el_set(e, EL_BIND, "\\e[2~", "ed-quoted-insert", NULL); 387 388 /* 389 * Ctrl-left-arrow and Ctrl-right-arrow for word moving. 390 */ 391 el_set(e, EL_BIND, "\\e[1;5C", "em-next-word", NULL); 392 el_set(e, EL_BIND, "\\e[1;5D", "ed-prev-word", NULL); 393 el_set(e, EL_BIND, "\\e[5C", "em-next-word", NULL); 394 el_set(e, EL_BIND, "\\e[5D", "ed-prev-word", NULL); 395 el_set(e, EL_BIND, "\\e\\e[C", "em-next-word", NULL); 396 el_set(e, EL_BIND, "\\e\\e[D", "ed-prev-word", NULL); 397 |
398 /* read settings from configuration file */ 399 el_source(e, NULL); 400 401 /* 402 * Unfortunately, some applications really do use rl_point 403 * and rl_line_buffer directly. 404 */ 405 _resize_fun(e, &rl_line_buffer); --- 570 unchanged lines hidden (view full) --- 976 977 qchar = 0; 978 loop_again = 1; 979 start = j = i; 980loop: 981 for (; str[j]; j++) { 982 if (str[j] == '\\' && 983 str[j + 1] == history_expansion_char) { |
984 len = strlen(&str[j + 1]) + 1; 985 memmove(&str[j], &str[j + 1], len); |
986 continue; 987 } 988 if (!loop_again) { 989 if (isspace((unsigned char) str[j]) 990 || str[j] == qchar) 991 break; 992 } 993 if (str[j] == history_expansion_char --- 1332 unchanged lines hidden --- |