⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kill.c

📁 在非GUI环境下
💻 C
📖 第 1 页 / 共 2 页
字号:
intrl_unix_filename_rubout (count, key)     int count, key;{  int orig_point, c;  if (rl_point == 0)    rl_ding ();  else    {      orig_point = rl_point;      if (count <= 0)	count = 1;      while (count--)	{	  c = rl_line_buffer[rl_point - 1];	  while (rl_point && (whitespace (c) || c == '/'))	    {	      rl_point--;	      c = rl_line_buffer[rl_point - 1];	    }	  while (rl_point && (whitespace (c) == 0) && c != '/')	    {	      rl_point--;	      c = rl_line_buffer[rl_point - 1];	    }	}      rl_kill_text (orig_point, rl_point);      if (rl_editing_mode == emacs_mode)	rl_mark = rl_point;    }  return 0;}/* Here is C-u doing what Unix does.  You don't *have* to use these   key-bindings.  We have a choice of killing the entire line, or   killing from where we are to the start of the line.  We choose the   latter, because if you are a Unix weenie, then you haven't backspaced   into the line at all, and if you aren't, then you know what you are   doing. */intrl_unix_line_discard (count, key)     int count, key;{  if (rl_point == 0)    rl_ding ();  else    {      rl_kill_text (rl_point, 0);      rl_point = 0;      if (rl_editing_mode == emacs_mode)	rl_mark = rl_point;    }  return 0;}/* Copy the text in the `region' to the kill ring.  If DELETE is non-zero,   delete the text from the line as well. */static intregion_kill_internal (delete)     int delete;{  char *text;  if (rl_mark != rl_point)    {      text = rl_copy_text (rl_point, rl_mark);      if (delete)	rl_delete_text (rl_point, rl_mark);      _rl_copy_to_kill_ring (text, rl_point < rl_mark);    }  _rl_last_command_was_kill++;  return 0;}/* Copy the text in the region to the kill ring. */intrl_copy_region_to_kill (count, ignore)     int count, ignore;{  return (region_kill_internal (0));}/* Kill the text between the point and mark. */intrl_kill_region (count, ignore)     int count, ignore;{  int r, npoint;  npoint = (rl_point < rl_mark) ? rl_point : rl_mark;  r = region_kill_internal (1);  _rl_fix_point (1);  rl_point = npoint;  return r;}/* Copy COUNT words to the kill ring.  DIR says which direction we look   to find the words. */static int_rl_copy_word_as_kill (count, dir)     int count, dir;{  int om, op, r;  om = rl_mark;  op = rl_point;  if (dir > 0)    rl_forward_word (count, 0);  else    rl_backward_word (count, 0);  rl_mark = rl_point;  if (dir > 0)    rl_backward_word (count, 0);  else    rl_forward_word (count, 0);  r = region_kill_internal (0);  rl_mark = om;  rl_point = op;  return r;}intrl_copy_forward_word (count, key)     int count, key;{  if (count < 0)    return (rl_copy_backward_word (-count, key));  return (_rl_copy_word_as_kill (count, 1));}intrl_copy_backward_word (count, key)     int count, key;{  if (count < 0)    return (rl_copy_forward_word (-count, key));  return (_rl_copy_word_as_kill (count, -1));}  /* Yank back the last killed text.  This ignores arguments. */intrl_yank (count, ignore)     int count, ignore;{  if (rl_kill_ring == 0)    {      _rl_abort_internal ();      return -1;    }  _rl_set_mark_at_pos (rl_point);  rl_insert_text (rl_kill_ring[rl_kill_index]);  return 0;}/* If the last command was yank, or yank_pop, and the text just   before point is identical to the current kill item, then   delete that text from the line, rotate the index down, and   yank back some other text. */intrl_yank_pop (count, key)     int count, key;{  int l, n;  if (((rl_last_func != rl_yank_pop) && (rl_last_func != rl_yank)) ||      !rl_kill_ring)    {      _rl_abort_internal ();      return -1;    }  l = strlen (rl_kill_ring[rl_kill_index]);  n = rl_point - l;  if (n >= 0 && STREQN (rl_line_buffer + n, rl_kill_ring[rl_kill_index], l))    {      rl_delete_text (n, rl_point);      rl_point = n;      rl_kill_index--;      if (rl_kill_index < 0)	rl_kill_index = rl_kill_ring_length - 1;      rl_yank (1, 0);      return 0;    }  else    {      _rl_abort_internal ();      return -1;    }}/* Yank the COUNTh argument from the previous history line, skipping   HISTORY_SKIP lines before looking for the `previous line'. */static intrl_yank_nth_arg_internal (count, ignore, history_skip)     int count, ignore, history_skip;{  register HIST_ENTRY *entry;  char *arg;  int i, pos;  pos = where_history ();  if (history_skip)    {      for (i = 0; i < history_skip; i++)	entry = previous_history ();    }  entry = previous_history ();  history_set_pos (pos);  if (entry == 0)    {      rl_ding ();      return -1;    }  arg = history_arg_extract (count, count, entry->line);  if (!arg || !*arg)    {      rl_ding ();      return -1;    }  rl_begin_undo_group ();  _rl_set_mark_at_pos (rl_point);#if defined (VI_MODE)  /* Vi mode always inserts a space before yanking the argument, and it     inserts it right *after* rl_point. */  if (rl_editing_mode == vi_mode)    {      rl_vi_append_mode (1, ignore);      rl_insert_text (" ");    }#endif /* VI_MODE */  rl_insert_text (arg);  free (arg);  rl_end_undo_group ();  return 0;}/* Yank the COUNTth argument from the previous history line. */intrl_yank_nth_arg (count, ignore)     int count, ignore;{  return (rl_yank_nth_arg_internal (count, ignore, 0));}/* Yank the last argument from the previous history line.  This `knows'   how rl_yank_nth_arg treats a count of `$'.  With an argument, this   behaves the same as rl_yank_nth_arg. */intrl_yank_last_arg (count, key)     int count, key;{  static int history_skip = 0;  static int explicit_arg_p = 0;  static int count_passed = 1;  static int direction = 1;  static int undo_needed = 0;  int retval;  if (rl_last_func != rl_yank_last_arg)    {      history_skip = 0;      explicit_arg_p = rl_explicit_arg;      count_passed = count;      direction = 1;    }  else    {      if (undo_needed)	rl_do_undo ();      if (count < 1)        direction = -direction;      history_skip += direction;      if (history_skip < 0)	history_skip = 0;    }   if (explicit_arg_p)    retval = rl_yank_nth_arg_internal (count_passed, key, history_skip);  else    retval = rl_yank_nth_arg_internal ('$', key, history_skip);  undo_needed = retval == 0;  return retval;}/* A special paste command for users of Cygnus's cygwin32. */#if defined (__CYGWIN__)#include <windows.h>intrl_paste_from_clipboard (count, key)     int count, key;{  char *data, *ptr;  int len;  if (OpenClipboard (NULL) == 0)    return (0);  data = (char *)GetClipboardData (CF_TEXT);  if (data)    {      ptr = strchr (data, '\r');      if (ptr)	{	  len = ptr - data;	  ptr = (char *)xmalloc (len + 1);	  ptr[len] = '\0';	  strncpy (ptr, data, len);	}      else        ptr = data;      _rl_set_mark_at_pos (rl_point);      rl_insert_text (ptr);      if (ptr != data)	free (ptr);      CloseClipboard ();    }  return (0);}#endif /* __CYGWIN__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -