当前位置: 首页>>代码示例>>C++>>正文


C++ rl_insert_text函数代码示例

本文整理汇总了C++中rl_insert_text函数的典型用法代码示例。如果您正苦于以下问题:C++ rl_insert_text函数的具体用法?C++ rl_insert_text怎么用?C++ rl_insert_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rl_insert_text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: newline_callback

static int newline_callback(int count, int key) {
    if (!rl_point) return 0;
    spaces_suppressed = 0;
    rl_insert_text("\n");
    int i;
    for (i = 0; i < prompt_length; i++)
        rl_insert_text(" ");
    return 0;
}
开发者ID:BenoitKnecht,项目名称:julia,代码行数:9,代码来源:repl-readline.c

示例2: rl_vi_comment

/* Turn the current line into a comment in shell history.
   A K*rn shell style function. */
int
rl_vi_comment (int count, int key)
{
  rl_beg_of_line (0, 0);

  if (rl_vi_comment_begin != (char *)NULL)
    rl_insert_text (rl_vi_comment_begin);
  else
    rl_insert_text (VI_COMMENT_BEGIN_DEFAULT);	/* Default. */

  rl_redisplay ();
  rl_newline (1, '\n');
  return (0);
}
开发者ID:AOSC-Dev,项目名称:metahtml,代码行数:16,代码来源:vi_mode.c

示例3: suffix_translation

//------------------------------------------------------------------------------
static void suffix_translation()
{
    // readline's path completion may have appended a '/'. If so; flip it.

    char from;
    char* to;

    if (!rl_filename_completion_desired)
    {
        return;
    }

    if (g_slash_translation < 0)
    {
        return;
    }

    // Decide what direction we're going in.
    switch (g_slash_translation)
    {
    case 1:     from = '\\'; to = "/";  break;
    default:    from = '/';  to = "\\"; break;
    }

    // Swap the trailing slash, using Readline's API to maintain undo state.
    if ((rl_point > 0) && (rl_line_buffer[rl_point - 1] == from))
    {
        rl_delete_text(rl_point - 1, rl_point);
        --rl_point;
        rl_insert_text(to);
    }
}
开发者ID:HTshandou,项目名称:clink,代码行数:33,代码来源:rl.c

示例4: space_callback

static int space_callback(int count, int key)
{
    if (!rl_point) strip_initial_spaces++;
    else if (suppress_space()) spaces_suppressed++;
    else rl_insert_text(" ");
    return 0;
}
开发者ID:HarlanH,项目名称:julia,代码行数:7,代码来源:repl-readline.c

示例5: tab_callback

static int tab_callback(int count, int key) {
    if (!rl_point) {
        strip_initial_spaces += tab_width;
        return 0;
    }
    int i;
    for (i = line_start(rl_point); i < rl_point; i++) {
        if (rl_line_buffer[i] != ' ') {
            // do tab completion
            i = rl_point;
            rl_complete_internal('!');
            if (i < rl_point && rl_line_buffer[rl_point-1] == ' ') {
                rl_delete_text(rl_point-1, rl_point);
                rl_point = rl_point-1;
            }
            return 0;
        }
    }
    // indent to next tab stop
    if (suppress_space()) {
        spaces_suppressed += tab_width;
    } else {
        i = line_start(rl_point) + prompt_length;
        do { rl_insert_text(" "); } while ((rl_point - i) % tab_width);
    }
    return 0;
}
开发者ID:BenoitKnecht,项目名称:julia,代码行数:27,代码来源:repl-readline.c

示例6: paste_from_clipboard

//------------------------------------------------------------------------------
static int paste_from_clipboard(int count, int invoking_key)
{
    if (OpenClipboard(NULL) != FALSE)
    {
        HANDLE clip_data = GetClipboardData(CF_UNICODETEXT);
        if (clip_data != NULL)
        {
            wchar_t* from_clipboard = (wchar_t*)clip_data;
            char utf8[1024];

            WideCharToMultiByte(
                CP_UTF8, 0,
                from_clipboard, -1,
                utf8, sizeof(utf8),
                NULL, NULL
            );
            utf8[sizeof(utf8) - 1] = '\0';

            rl_insert_text(utf8);
        }

        CloseClipboard();
    }
    
    return 0;
}
开发者ID:hello-xk,项目名称:kiwi,代码行数:27,代码来源:clink_rl.c

示例7: _cmd_complete

static int
_cmd_complete(int all)
{
	char **argv = NULL;
	int argc = 0;
	int rc = 1;
	char *line = malloc(strlen(rl_line_buffer) + 2);
	if (!line) return -1;
	strcpy(line, rl_line_buffer);
	line[rl_point]   = 2;	/* empty character, will force a word */
	line[rl_point+1] = 0;

	if (tokenize_line(line, &argc, &argv) != 0)
		goto end;

	char *compl = commands_complete(root, argc, (const char **)argv, all);
	if (compl && strlen(argv[argc-1]) < strlen(compl)) {
		if (rl_insert_text(compl + strlen(argv[argc-1])) < 0) {
			free(compl);
			goto end;
		}
		free(compl);
		rc = 0;
		goto end;
	}
	/* No completion or several completion available. */
	fprintf(stderr, "\n");
	rl_forced_update_display();
	rc = 0;
end:
	free(line);
	tokenize_free(argc, argv);
	return rc;
}
开发者ID:ajufrancis,项目名称:lldpd,代码行数:34,代码来源:lldpcli.c

示例8: cli_handler_fn

static void cli_handler_fn(char *input)
{
	_shl_free_ char *original = input;
	_shl_strv_free_ char **args = NULL;
	int r;

	if (!input) {
		rl_insert_text("quit");
		rl_redisplay();
		rl_crlf();
		sd_event_exit(cli_event, 0);
		return;
	}

	r = shl_qstr_tokenize(input, &args);
	if (r < 0)
		return cli_vENOMEM();
	else if (!r)
		return;

	add_history(original);
	r = cli_do(cli_cmds, args, r);
	if (r != -EAGAIN)
		return;

	cli_printf("Command not found\n");
}
开发者ID:ValentinCupif,项目名称:MiraCle,代码行数:27,代码来源:ctl-cli.c

示例9: _rl_vi_stuff_insert

static void
_rl_vi_stuff_insert(int count)
{
  rl_begin_undo_group();
  while (count--)
    rl_insert_text(vi_insert_buffer);
  rl_end_undo_group();
}
开发者ID:cooljeanius,项目名称:apple-gdb-1824,代码行数:8,代码来源:vi_mode.c

示例10: insert_text

static PyObject *
insert_text(PyObject *self, PyObject *args)
{
	char *s;
	if (!PyArg_ParseTuple(args, "s:insert_text", &s))
		return NULL;
	rl_insert_text(s);
	Py_RETURN_NONE;
}
开发者ID:1310701102,项目名称:sl4a,代码行数:9,代码来源:readline.c

示例11: set_deftext

static int
set_deftext ()
{
  if (deftext)
    {
      rl_insert_text (deftext);
      deftext = (char *)NULL;
      rl_startup_hook = (Function *)NULL;
    }
}
开发者ID:OS2World,项目名称:LIB-GNU_Readline_library,代码行数:10,代码来源:rl.c

示例12: insert_text

static PyObject *
insert_text(PyObject *self, PyObject *args)
{
	char *s;
	if (!PyArg_ParseTuple(args, "s:insert_text", &s))
		return NULL;
	rl_insert_text(s);
	Py_INCREF(Py_None);
	return Py_None;
}
开发者ID:svinota,项目名称:cx,代码行数:10,代码来源:readline.c

示例13: set_deftext

static int
set_deftext (void)
{
	if (pre_input_deftext && rl_startup_hook) {
		rl_insert_text (pre_input_deftext);
		g_free (pre_input_deftext);
		pre_input_deftext = NULL;
		rl_startup_hook = NULL;
	}
	return 0;
}
开发者ID:GalliumOS,项目名称:network-manager,代码行数:11,代码来源:agent.c

示例14: nmc_rl_set_deftext

int
nmc_rl_set_deftext (void)
{
	if (nmc_rl_pre_input_deftext && rl_startup_hook) {
		rl_insert_text (nmc_rl_pre_input_deftext);
		g_free (nmc_rl_pre_input_deftext);
		nmc_rl_pre_input_deftext = NULL;
		rl_startup_hook = NULL;
	}
	return 0;
}
开发者ID:GalliumOS,项目名称:network-manager,代码行数:11,代码来源:common.c

示例15: set_deftext

static int
set_deftext ()
{
  if (deftext)
    {
      rl_insert_text (deftext);
      deftext = (char *)NULL;
      rl_startup_hook = (rl_hook_func_t *)NULL;
    }
  return 0;
}
开发者ID:FullStkDev,项目名称:bash,代码行数:11,代码来源:rl.c


注:本文中的rl_insert_text函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。