コード例 #1
0
ファイル: input.c プロジェクト: Nicholas-S/xaric
void input_msgreply(char dumb, char *dumber)
{
    char *cmdchar;
    char *line, *cmd, *t;
    char *snick;
    NickTab *nick = NULL;
    int got_space = 0;

    if (!(cmdchar = get_string_var(CMDCHARS_VAR)))
	cmdchar = DEFAULT_CMDCHARS;

    t = line = m_strdup(get_input());
    if (t)
	got_space = strchr(t, ' ') ? 1 : 0;
    cmd = next_arg(line, &line);
    snick = next_arg(line, &line);
    if ((cmd && *cmd == *cmdchar && got_space) || !cmd) {

	if (cmd && *cmd == *cmdchar)
	    cmd++;
	if (in_completion == STATE_NORMAL && snick)
	    strncpy(new_nick, snick, sizeof(new_nick) - 1);

	if ((nick = getnextnick(new_nick, input_lastmsg, snick))) {
	    if (nick->nick && *(nick->nick)) {
		snick = nick->nick;
		malloc_strcpy(&input_lastmsg, nick->nick);
	    }
	}
	if (nick) {
	    char *tmp = NULL;

	    input_clear_line('\0', NULL);
	    if (get_fset_var(FORMAT_NICK_MSG_FSET))
		malloc_strcpy(&tmp,
			      stripansicodes(convert_output_format
					     (get_fset_var(FORMAT_NICK_MSG_FSET), "%s%s %s %s", cmdchar,
					      nick->type ? nick->type : cmd ? cmd : "msg", nick->nick, line ? line : empty_str)));
	    else
		malloc_sprintf(&tmp, "%s%s %s %s", cmdchar, nick->type ? nick->type : cmd ? cmd : "msg", nick->nick,
			       line ? line : empty_str);
	    set_input(tmp);
	    new_free(&tmp);
	} else
	    command_completion(0, NULL);
    } else
	command_completion(0, NULL);
    update_input(UPDATE_ALL);
    new_free(&t);
}
コード例 #2
0
ファイル: input.c プロジェクト: Nicholas-S/xaric
void add_autonick_input(char *nick, char *line)
{
    char *tmp1 = NULL;

    input_clear_line('\0', NULL);
    if ((do_hook(AR_REPLY_LIST, "%s", nick))) {
	if (get_fset_var(FORMAT_NICK_AUTO_FSET))
	    malloc_strcpy(&tmp1,
			  stripansicodes(convert_output_format
					 (get_fset_var(FORMAT_NICK_AUTO_FSET), "%s %s", nick, line ? line : empty_str)));
	else
	    malloc_sprintf(&tmp1, "%s: %s", nick, line);
	set_input(tmp1);
	new_free(&tmp1);
    }
    update_input(UPDATE_ALL);
}
コード例 #3
0
ファイル: hzinput.c プロジェクト: descent/jmcce
inline void
ClrRootArea ()
{
  input_clear_line (2, INPUT_BGCOLOR);
}
コード例 #4
0
ファイル: hzinput.c プロジェクト: descent/jmcce
inline void
ClrSelArea ()
{
  input_clear_line (1, INPUT_BGCOLOR);
}
コード例 #5
0
ファイル: hzinput.c プロジェクト: descent/jmcce
/* before call this function, must lock the console */
void
refresh_input_method_area (void)
{
  char str[25];

  int tTopY;
  int tLeftX;
  int ii, jj;

  tTopY = 458;
  tLeftX = 540;

  NEWRootEmpty ();
//NEWDispRootArea();
  input_clear_line (2, INPUT_BGCOLOR);
  gInputCount = 0;
  ClrSelArea ();
  gSelectingMode_flag = 0;


  input_clear_area (INPUT_BGCOLOR);

  if (use_fb) {
    fb_setfgcolor (15);
    fb_drawline (0, INPUT_AREAY - 7, 639, INPUT_AREAY - 7);
    fb_drawline (0, INPUT_AREAY - 4, 639, INPUT_AREAY - 4);
    for (ii = 0; ii < 100; ii++)
      fb_setfgcolor (12);
  } else {

  #ifdef VGALIB
    gl_hline(0, INPUT_AREAY - 7, WIDTH-1, GRAY);
    gl_hline(0, INPUT_AREAY - 4, WIDTH-1, GRAY);
  #endif

#ifdef VGA__
    vga_setcolor (15);
    vga_drawline (0, INPUT_AREAY - 7, 639, INPUT_AREAY - 7);
    vga_drawline (0, INPUT_AREAY - 4, 639, INPUT_AREAY - 4);
    for (ii = 0; ii < 100; ii++)
      vga_setcolor (12);
#endif
  }


  if (!IsHanziInput) {
    if (gEncode == BIG5) {
      input_print_string (POS_OF_VERSIONSTRING, 0, VERSION_STRING,
			  INPUT_FGCOLOR, INPUT_BGCOLOR);
      input_print_string (POS_OF_INPUTNAME, 0, "【英數】", INPUT_FGCOLOR,
			  INPUT_BGCOLOR);
    }
    if (gEncode == GB) {
      input_print_string (POS_OF_VERSIONSTRING, 0,
			  string_BIG5toGB (VERSION_STRING), INPUT_FGCOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_INPUTNAME, 0, string_BIG5toGB ("【英數】"),
			  INPUT_FGCOLOR, INPUT_BGCOLOR);
    }
  } else {

    if ((gsCurrent_input_table->IsExtInpMethod) == 1) {
      if (gEncode == BIG5) {
	input_print_string (POS_OF_INPUTNAME, 0,
			    gsInput_table_array[gsCurrent_method]->cname,
			    INPUT_FGCOLOR, INPUT_BGCOLOR);
      }
      if (gEncode == GB) {
	input_print_string (POS_OF_INPUTNAME, 0,
			    gsInput_table_array[gsCurrent_method]->cname,
			    INPUT_FGCOLOR, INPUT_BGCOLOR);
      }
    } else {
      fprintf (stderr, "%c", 0x7);
      if (gEncode == BIG5) {
        #ifdef NEW_CHEWING
        if (gsCurrent_method == 7) 
	  input_print_string (POS_OF_INPUTNAME, 0, "酷音", INPUT_FGCOLOR, INPUT_BGCOLOR);
        #else
	input_print_string (POS_OF_INPUTNAME, 0, "!無輸入法!", INPUT_FGCOLOR,
			    INPUT_BGCOLOR);
        #endif
      }
      if (gEncode == GB) {
	input_print_string (POS_OF_INPUTNAME, 0,
			    string_BIG5toGB ("!無輸入法!"), INPUT_FGCOLOR,
			    INPUT_BGCOLOR);
      }
    }
  }


  if (gsCurrent_input_table) {
    if (gsCurrent_input_table->CaseTransPolicy == 0) {
      input_print_string (POS_OF_CASEHINT, 0, "A", HINT_CASEHICOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_CASEHINT + 1, 0, " ", INPUT_FGCOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_CASEHINT + 2, 0, "a", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
    }
    if (gsCurrent_input_table->CaseTransPolicy == 1) {
      input_print_string (POS_OF_CASEHINT, 0, "a", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_CASEHINT + 1, 0, "=", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_CASEHINT + 2, 0, "A", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
    }
    if (gsCurrent_input_table->CaseTransPolicy == 2) {
      input_print_string (POS_OF_CASEHINT, 0, "A", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_CASEHINT + 1, 0, "=", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_CASEHINT + 2, 0, "a", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
    }
  }


  if (gEncode == BIG5) {
    input_print_string (POS_OF_FULLHALF, 0, half_full_strBIG5[IsFullChar],
			INPUT_FGCOLOR, INPUT_BGCOLOR);
    input_print_string (POS_OF_HISTORYMODE, 0,
			history_normal_strBIG5[console_mode], INPUT_FGCOLOR,
			INPUT_BGCOLOR);
    sprintf (str, "【視窗%1d】", hztty_list->index);
  }
  if (gEncode == GB) {
    input_print_string (POS_OF_FULLHALF, 0, half_full_strGB[IsFullChar],
			INPUT_FGCOLOR, INPUT_BGCOLOR);
    input_print_string (POS_OF_HISTORYMODE, 0,
			history_normal_strGB[console_mode], INPUT_FGCOLOR,
			INPUT_BGCOLOR);
    sprintf (str, "▽敦諳%1d▼", hztty_list->index);
  }
  input_print_string (POS_OF_WINDOWNO, 0, str, INPUT_FGCOLOR, INPUT_BGCOLOR);
  if (IsHanziInput > 0 && gsCurrent_method == 7)
#ifdef CHEWING
    ChewReDrawText ();		/* Chewing */
#else
    ;
#endif
  input_print_string (76, 1, encode_name, RED, INPUT_BGCOLOR); 

}
コード例 #6
0
ファイル: history.c プロジェクト: Nicholas-S/xaric
/* shove_to_history: a key binding that saves the current line into
 * the history and then deletes the whole line.  Useful for when you
 * are in the middle of a big line and need to "get out" to do something
 * else quick for just a second, and you dont want to have to retype
 * everything all over again
 */
extern void shove_to_history(char unused, char *not_used)
{
    add_to_history(get_input());
    input_clear_line(unused, not_used);
}