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

📄 display.c

📁 Linux下的MUD客户端程序
💻 C
📖 第 1 页 / 共 3 页
字号:
	  /* Copy (new) chars to screen from first diff to last match */	  temp = nls - nfd;	  if (temp > 0)	    {	      _rl_output_some_chars (nfd, temp);	      _rl_last_c_pos += temp;	    }	}      /* Otherwise, print over the existing material. */      else	{	  if (temp > 0)	    {	      _rl_output_some_chars (nfd, temp);	      _rl_last_c_pos += temp;	    }	  lendiff = (oe - old) - (ne - new);	  if (term_xn && current_line < inv_botlin)	    space_to_eol (lendiff);	  else	    clear_to_eol (lendiff);	}    }}/* Tell the update routines that we have moved onto a new (empty) line. */rl_on_new_line (){  if (visible_line)    visible_line[0] = '\0';  _rl_last_c_pos = _rl_last_v_pos = 0;  _rl_vis_botlin = last_lmargin = 0;  return 0;}/* Actually update the display, period. */rl_forced_update_display (){  if (visible_line)    {      register char *temp = visible_line;      while (*temp) *temp++ = '\0';    }  rl_on_new_line ();  forced_display++;  rl_redisplay ();  return 0;}/* Move the cursor from _rl_last_c_pos to NEW, which are buffer indices.   DATA is the contents of the screen line of interest; i.e., where   the movement is being done. */void_rl_move_cursor_relative (new, data)     int new;     char *data;{  register int i;  /* If we don't have to do anything, then return. */  if (_rl_last_c_pos == new) return;  /* It may be faster to output a CR, and then move forwards instead     of moving backwards. */  /* i == current physical cursor position. */  i = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset);  if (CR_FASTER (new, _rl_last_c_pos) || (term_xn && i == screenwidth))    {#if defined (__MSDOS__)      putc ('\r', rl_outstream);#else      tputs (term_cr, 1, _rl_output_character_function);#endif /* !__MSDOS__ */      _rl_last_c_pos = 0;    }  if (_rl_last_c_pos < new)    {      /* Move the cursor forward.  We do it by printing the command	 to move the cursor forward if there is one, else print that	 portion of the output buffer again.  Which is cheaper? */      /* The above comment is left here for posterity.  It is faster	 to print one character (non-control) than to print a control	 sequence telling the terminal to move forward one character.	 That kind of control is for people who don't know what the	 data is underneath the cursor. */#if defined (HACK_TERMCAP_MOTION)      extern char *term_forward_char;      if (term_forward_char)	for (i = _rl_last_c_pos; i < new; i++)	  tputs (term_forward_char, 1, _rl_output_character_function);      else	for (i = _rl_last_c_pos; i < new; i++)	  putc (data[i], rl_outstream);#else      for (i = _rl_last_c_pos; i < new; i++)	putc (data[i], rl_outstream);#endif /* HACK_TERMCAP_MOTION */    }  else if (_rl_last_c_pos != new)    backspace (_rl_last_c_pos - new);  _rl_last_c_pos = new;}/* PWP: move the cursor up or down. */void_rl_move_vert (to)     int to;{  register int delta, i;  if (_rl_last_v_pos == to || to > screenheight)    return;#if defined (__GO32__)  {    int row, col;    ScreenGetCursor (&row, &col);    ScreenSetCursor ((row + to - _rl_last_v_pos), col);  }#else /* !__GO32__ */  if ((delta = to - _rl_last_v_pos) > 0)    {      for (i = 0; i < delta; i++)	putc ('\n', rl_outstream);      tputs (term_cr, 1, _rl_output_character_function);      _rl_last_c_pos = 0;    }  else    {			/* delta < 0 */      if (term_up && *term_up)	for (i = 0; i < -delta; i++)	  tputs (term_up, 1, _rl_output_character_function);    }#endif /* !__GO32__ */  _rl_last_v_pos = to;		/* Now TO is here */}/* Physically print C on rl_outstream.  This is for functions which know   how to optimize the display.  Return the number of characters output. */rl_show_char (c)     int c;{  int n = 1;  if (META_CHAR (c) && (_rl_output_meta_chars == 0))    {      fprintf (rl_outstream, "M-");      n += 2;      c = UNMETA (c);    }#if defined (DISPLAY_TABS)  if (c < 32 && c != '\t')#else  if (c < 32)#endif /* !DISPLAY_TABS */    {      fprintf (rl_outstream, "C-");      n += 2;      c += 64;    }  putc (c, rl_outstream);  fflush (rl_outstream);  return n;}intrl_character_len (c, pos)     register int c, pos;{  unsigned char uc;  uc = (unsigned char)c;  if (META_CHAR (uc))    return ((_rl_output_meta_chars == 0) ? 4 : 1);  if (uc == '\t')    {#if defined (DISPLAY_TABS)      return (((pos | 7) + 1) - pos);#else      return (2);#endif /* !DISPLAY_TABS */    }  return ((isprint (uc)) ? 1 : 2);}/* How to print things in the "echo-area".  The prompt is treated as a   mini-modeline. */#if defined (HAVE_VARARGS_H)rl_message (va_alist)     va_dcl{  char *format;  va_list args;  va_start (args);  format = va_arg (args, char *);  vsprintf (msg_buf, format, args);  va_end (args);  rl_display_prompt = msg_buf;  rl_redisplay ();  return 0;}#else /* !HAVE_VARARGS_H */rl_message (format, arg1, arg2)     char *format;{  sprintf (msg_buf, format, arg1, arg2);  rl_display_prompt = msg_buf;  rl_redisplay ();  return 0;}#endif /* !HAVE_VARARGS_H *//* How to clear things from the "echo-area". */rl_clear_message (){  rl_display_prompt = rl_prompt;  rl_redisplay ();  return 0;}rl_reset_line_state (){  rl_on_new_line ();  rl_display_prompt = rl_prompt ? rl_prompt : "";  forced_display = 1;  return 0;}/* Quick redisplay hack when erasing characters at the end of the line. */void_rl_erase_at_end_of_line (l)     int l;{  register int i;  backspace (l);  for (i = 0; i < l; i++)    putc (' ', rl_outstream);  backspace (l);  for (i = 0; i < l; i++)    visible_line[--_rl_last_c_pos] = '\0';  rl_display_fixed++;}/* Clear to the end of the line.  COUNT is the minimum   number of character spaces to clear, */static voidclear_to_eol (count)     int count;{#if !defined (__GO32__)  if (term_clreol)    {      tputs (term_clreol, 1, _rl_output_character_function);    }  else#endif /* !__GO32__ */    space_to_eol (count);}/* Clear to the end of the line using spaces.  COUNT is the minimum   number of character spaces to clear, */static voidspace_to_eol (count)     int count;{  register int i;  for (i = 0; i < count; i++)   putc (' ', rl_outstream);  _rl_last_c_pos += count;}/* Insert COUNT characters from STRING to the output stream. */static voidinsert_some_chars (string, count)     char *string;     int count;{#if defined (__GO32__)  int row, col, width;  char *row_start;  ScreenGetCursor (&row, &col);  width = ScreenCols ();  row_start = ScreenPrimary + (row * width);  memcpy (row_start + col + count, row_start + col, width - col - count);  /* Place the text on the screen. */  _rl_output_some_chars (string, count);#else /* !_GO32 */  /* If IC is defined, then we do not have to "enter" insert mode. */  if (term_IC)    {      char *tgoto (), *buffer;      buffer = tgoto (term_IC, 0, count);      tputs (buffer, 1, _rl_output_character_function);      _rl_output_some_chars (string, count);    }  else    {      register int i;      /* If we have to turn on insert-mode, then do so. */      if (term_im && *term_im)	tputs (term_im, 1, _rl_output_character_function);      /* If there is a special command for inserting characters, then	 use that first to open up the space. */      if (term_ic && *term_ic)	{	  for (i = count; i--; )	    tputs (term_ic, 1, _rl_output_character_function);	}      /* Print the text. */      _rl_output_some_chars (string, count);      /* If there is a string to turn off insert mode, we had best use	 it now. */      if (term_ei && *term_ei)	tputs (term_ei, 1, _rl_output_character_function);    }#endif /* !__GO32__ */}/* Delete COUNT characters from the display line. */static voiddelete_chars (count)     int count;{#if defined (__GO32__)  int row, col, width;  char *row_start;  ScreenGetCursor (&row, &col);  width = ScreenCols ();  row_start = ScreenPrimary + (row * width);  memcpy (row_start + col, row_start + col + count, width - col - count);  memset (row_start + width - count, 0, count * 2);#else /* !_GO32 */  if (count > screenwidth)	/* XXX */    return;  if (term_DC && *term_DC)    {      char *tgoto (), *buffer;      buffer = tgoto (term_DC, count, count);      tputs (buffer, count, _rl_output_character_function);    }  else    {      if (term_dc && *term_dc)	while (count--)	  tputs (term_dc, 1, _rl_output_character_function);    }#endif /* !__GO32__ */}void_rl_update_final (){  int full_lines;  full_lines = 0;  if (_rl_vis_botlin && visible_line[screenwidth * _rl_vis_botlin] == 0)    {      _rl_vis_botlin--;      full_lines = 1;    }  _rl_move_vert (_rl_vis_botlin);  if (full_lines && term_xn)    {      /* Remove final line-wrap flag in xterm. */      char *last_line;      last_line = &visible_line[screenwidth * _rl_vis_botlin];      _rl_move_cursor_relative (screenwidth - 1, last_line);      clear_to_eol (0);      putc (last_line[screenwidth - 1], rl_outstream);    }  _rl_vis_botlin = 0;  crlf ();  fflush (rl_outstream);  rl_display_fixed++;}

⌨️ 快捷键说明

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