Deleted Added
full compact
kill.c (47558) kill.c (58310)
1/* kill.c -- kill ring management. */
2
3/* Copyright (C) 1994 Free Software Foundation, Inc.
4
5 This file is part of the GNU Readline Library, a library for
6 reading lines of text with interactive input and history editing.
7
8 The GNU Readline Library is free software; you can redistribute it
9 and/or modify it under the terms of the GNU General Public License
1/* kill.c -- kill ring management. */
2
3/* Copyright (C) 1994 Free Software Foundation, Inc.
4
5 This file is part of the GNU Readline Library, a library for
6 reading lines of text with interactive input and history editing.
7
8 The GNU Readline Library is free software; you can redistribute it
9 and/or modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 1, or
10 as published by the Free Software Foundation; either version 2, or
11 (at your option) any later version.
12
13 The GNU Readline Library is distributed in the hope that it will be
14 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 The GNU General Public License is often shipped with GNU software, and
19 is generally kept in a file called COPYING or LICENSE. If you do not
20 have a copy of the license, write to the Free Software Foundation,
11 (at your option) any later version.
12
13 The GNU Readline Library is distributed in the hope that it will be
14 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 The GNU General Public License is often shipped with GNU software, and
19 is generally kept in a file called COPYING or LICENSE. If you do not
20 have a copy of the license, write to the Free Software Foundation,
21 675 Mass Ave, Cambridge, MA 02139, USA. */
21 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
22#define READLINE_LIBRARY
23
24#if defined (HAVE_CONFIG_H)
25# include <config.h>
26#endif
27
28#include <sys/types.h>
29

--- 11 unchanged lines hidden (view full) ---

41
42/* System-specific feature definitions and include files. */
43#include "rldefs.h"
44
45/* Some standard library routines. */
46#include "readline.h"
47#include "history.h"
48
22#define READLINE_LIBRARY
23
24#if defined (HAVE_CONFIG_H)
25# include <config.h>
26#endif
27
28#include <sys/types.h>
29

--- 11 unchanged lines hidden (view full) ---

41
42/* System-specific feature definitions and include files. */
43#include "rldefs.h"
44
45/* Some standard library routines. */
46#include "readline.h"
47#include "history.h"
48
49extern int _rl_last_command_was_kill;
50extern int rl_editing_mode;
51extern int rl_explicit_arg;
52extern Function *rl_last_func;
49#include "rlprivate.h"
50#include "xmalloc.h"
53
51
54extern void _rl_init_argument ();
55extern int _rl_set_mark_at_pos ();
56extern void _rl_fix_point ();
57extern void _rl_abort_internal ();
58
59extern char *xmalloc (), *xrealloc ();
60
61/* **************************************************************** */
62/* */
63/* Killing Mechanism */
64/* */
65/* **************************************************************** */
66
67/* What we assume for a max number of kills. */
68#define DEFAULT_MAX_KILLS 10

--- 311 unchanged lines hidden (view full) ---

380 return (region_kill_internal (0));
381}
382
383/* Kill the text between the point and mark. */
384int
385rl_kill_region (count, ignore)
386 int count, ignore;
387{
52/* **************************************************************** */
53/* */
54/* Killing Mechanism */
55/* */
56/* **************************************************************** */
57
58/* What we assume for a max number of kills. */
59#define DEFAULT_MAX_KILLS 10

--- 311 unchanged lines hidden (view full) ---

371 return (region_kill_internal (0));
372}
373
374/* Kill the text between the point and mark. */
375int
376rl_kill_region (count, ignore)
377 int count, ignore;
378{
388 int r;
379 int r, npoint;
389
380
381 npoint = (rl_point < rl_mark) ? rl_point : rl_mark;
390 r = region_kill_internal (1);
391 _rl_fix_point (1);
382 r = region_kill_internal (1);
383 _rl_fix_point (1);
384 rl_point = npoint;
392 return r;
393}
394
395/* Copy COUNT words to the kill ring. DIR says which direction we look
396 to find the words. */
397static int
398_rl_copy_word_as_kill (count, dir)
399 int count, dir;

--- 98 unchanged lines hidden (view full) ---

498/* Yank the COUNTh argument from the previous history line, skipping
499 HISTORY_SKIP lines before looking for the `previous line'. */
500static int
501rl_yank_nth_arg_internal (count, ignore, history_skip)
502 int count, ignore, history_skip;
503{
504 register HIST_ENTRY *entry;
505 char *arg;
385 return r;
386}
387
388/* Copy COUNT words to the kill ring. DIR says which direction we look
389 to find the words. */
390static int
391_rl_copy_word_as_kill (count, dir)
392 int count, dir;

--- 98 unchanged lines hidden (view full) ---

491/* Yank the COUNTh argument from the previous history line, skipping
492 HISTORY_SKIP lines before looking for the `previous line'. */
493static int
494rl_yank_nth_arg_internal (count, ignore, history_skip)
495 int count, ignore, history_skip;
496{
497 register HIST_ENTRY *entry;
498 char *arg;
506 int i;
499 int i, pos;
507
500
501 pos = where_history ();
502
508 if (history_skip)
509 {
510 for (i = 0; i < history_skip; i++)
511 entry = previous_history ();
512 }
513
514 entry = previous_history ();
503 if (history_skip)
504 {
505 for (i = 0; i < history_skip; i++)
506 entry = previous_history ();
507 }
508
509 entry = previous_history ();
515 if (entry)
510
511 history_set_pos (pos);
512
513 if (entry == 0)
516 {
514 {
517 if (history_skip)
518 {
519 for (i = 0; i < history_skip; i++)
520 next_history ();
521 }
522 next_history ();
523 }
524 else
525 {
526 ding ();
527 return -1;
528 }
529
530 arg = history_arg_extract (count, count, entry->line);
531 if (!arg || !*arg)
532 {
533 ding ();

--- 106 unchanged lines hidden ---
515 ding ();
516 return -1;
517 }
518
519 arg = history_arg_extract (count, count, entry->line);
520 if (!arg || !*arg)
521 {
522 ding ();

--- 106 unchanged lines hidden ---