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


C++ reset_indent函数代码示例

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


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

示例1: line_start_callback

static int line_start_callback(int count, int key) {
    reset_indent();
    int start = line_start(rl_point);
    int flush_left = rl_point == 0 || rl_point == start + prompt_length;
    rl_point = flush_left ? 0 : (!start ? start : start + prompt_length);
    return 0;
}
开发者ID:BenoitKnecht,项目名称:julia,代码行数:7,代码来源:repl-readline.c

示例2: line_end_callback

static int line_end_callback(int count, int key) {
    reset_indent();
    int end = line_end(rl_point);
    int flush_right = rl_point == end;
    rl_point = flush_right ? rl_end : end;
    return 0;
}
开发者ID:BenoitKnecht,项目名称:julia,代码行数:7,代码来源:repl-readline.c

示例3: delete_callback

static int delete_callback(int count, int key) {
    reset_indent();
    int j = rl_point;
    j += (rl_line_buffer[j] == '\n') ? prompt_length+1 : 1;
    if (rl_end < j) j = rl_end;
    rl_delete_text(rl_point, j);
    return 0;
}
开发者ID:BenoitKnecht,项目名称:julia,代码行数:8,代码来源:repl-readline.c

示例4: right_callback

static int right_callback(int count, int key) {
    reset_indent();
    do {
        rl_point += (rl_line_buffer[rl_point] == '\n') ? prompt_length+1 : 1;
    } while (locale_is_utf8 && !isutf(rl_line_buffer[rl_point]));
    if (rl_end < rl_point) rl_point = rl_end;
    return 0;
}
开发者ID:fpepin,项目名称:julia,代码行数:8,代码来源:repl-readline.c

示例5: left_callback

static int left_callback(int count, int key) {
    reset_indent();
    if (rl_point > 0) {
        int i = line_start(rl_point);
        rl_point = (i == 0 || rl_point-i > prompt_length) ?
            rl_point-1 : i-1;
    }
    return 0;
}
开发者ID:BenoitKnecht,项目名称:julia,代码行数:9,代码来源:repl-readline.c

示例6: line_kill_callback

static int line_kill_callback(int count, int key) {
    reset_indent();
    int end = line_end(rl_point);
    int flush_right = rl_point == end;
    int kill = flush_right ? end + prompt_length + 1 : end;
    if (kill > rl_end) kill = rl_end;
    rl_kill_text(rl_point, kill);
    return 0;
}
开发者ID:BenoitKnecht,项目名称:julia,代码行数:9,代码来源:repl-readline.c

示例7: left_callback

static int left_callback(int count, int key) {
    reset_indent();
    if (rl_point > 0) {
        int i = line_start(rl_point);
        do {
            rl_point = (i == 0 || rl_point-i > prompt_length) ? rl_point-1 : i-1;
        } while (locale_is_utf8 && !isutf(rl_line_buffer[rl_point]) && rl_point > i-1);
    }
    return 0;
}
开发者ID:fpepin,项目名称:julia,代码行数:10,代码来源:repl-readline.c

示例8: delete_callback

static int delete_callback(int count, int key) {
    reset_indent();
    int j = rl_point;
    do {
        j += (rl_line_buffer[j] == '\n') ? prompt_length+1 : 1;
    } while (locale_is_utf8 && !isutf(rl_line_buffer[j]));
    if (rl_end < j) j = rl_end;
    rl_delete_text(rl_point, j);
    return 0;
}
开发者ID:fpepin,项目名称:julia,代码行数:10,代码来源:repl-readline.c

示例9: return_callback

static int return_callback(int count, int key) {
    add_history_temporary(rl_line_buffer);
    rl_ast = jl_parse_input_line(rl_line_buffer);
    rl_done = !rl_ast || !jl_is_expr(rl_ast) ||
        (((jl_expr_t*)rl_ast)->head != jl_continue_sym);
    if (!rl_done) {
        newline_callback(count, key);
    } else {
        reset_indent();
        rl_point = rl_end;
        rl_redisplay();
    }
    return 0;
}
开发者ID:BenoitKnecht,项目名称:julia,代码行数:14,代码来源:repl-readline.c

示例10: up_callback

static int up_callback(int count, int key) {
    reset_indent();
    int i = line_start(rl_point);
    if (i > 0) {
        int j = line_start(i-1);
        if (j == 0) rl_point -= prompt_length;
        rl_point += j - i;
        if (rl_point >= i) rl_point = i - 1;
    } else {
        last_hist_offset = -1;
        rl_get_previous_history(count, key);
        rl_point = line_end(0);
    }
    return 0;
}
开发者ID:BenoitKnecht,项目名称:julia,代码行数:15,代码来源:repl-readline.c

示例11: down_callback

static int down_callback(int count, int key) {
    reset_indent();
    int j = line_end(rl_point);
    if (j < rl_end) {
        int i = line_start(rl_point);
        if (i == 0) rl_point += prompt_length;
        rl_point += j - i + 1;
        int k = line_end(j+1);
        if (rl_point > k) rl_point = k;
        return 0;
    } else {
        if (last_hist_offset >= 0) {
            history_set_pos(last_hist_offset);
            last_hist_offset = -1;
        }
        return rl_get_next_history(count, key);
    }
}
开发者ID:BenoitKnecht,项目名称:julia,代码行数:18,代码来源:repl-readline.c

示例12: backspace_callback

static int backspace_callback(int count, int key) {
    reset_indent();
    if (!rl_point) return 0;

    int i = line_start(rl_point), j = rl_point, k;
    if (!i || rl_point <= i + prompt_length) goto backspace;
    for (k = i; k < rl_point; k++)
        if (rl_line_buffer[k] != ' ') goto backspace;

//unindent:
    k = i + prompt_length;
    do { rl_point--; } while ((rl_point - k) % tab_width);
    goto finish;

backspace:
    rl_point = (i == 0 || rl_point-i > prompt_length) ? rl_point-1 : i-1;

finish:
    rl_delete_text(rl_point, j);
    return 0;
}
开发者ID:BenoitKnecht,项目名称:julia,代码行数:21,代码来源:repl-readline.c

示例13: return_callback

static int return_callback(int count, int key) {
    static int consecutive_returns = 0;
    if (rl_point > prompt_length && rl_point == rl_end &&
        rl_line_buffer[rl_point-prompt_length-1] == '\n')
        consecutive_returns++;
    else
        consecutive_returns = 0;
    add_history_temporary(rl_line_buffer);
    rl_ast = jl_parse_input_line(rl_line_buffer);
    rl_done = !rl_ast || !jl_is_expr(rl_ast) ||
        (((jl_expr_t*)rl_ast)->head != jl_continue_sym) ||
        consecutive_returns > 1;
    if (!rl_done) {
        newline_callback(count, key);
    } else {
        reset_indent();
        rl_point = rl_end;
        rl_redisplay();
    }
    return 0;
}
开发者ID:fpepin,项目名称:julia,代码行数:21,代码来源:repl-readline.c

示例14: jl_clear_input

DLLEXPORT void jl_clear_input(void)
{
    //todo: how to do this better / the correct way / ???
    //move the cursor to a clean line:
    char *p = rl_line_buffer;
    int i;
    for (i = 0; *p != '\0'; p++, i++) {
        if (i >= rl_point && *p == '\n') {
            jl_putc('\n', jl_uv_stdout);
        }
    }
    jl_putc('\n', jl_uv_stdout);
    jl_putc('\n', jl_uv_stdout);
    //reset state:
    rl_reset_line_state();
    reset_indent();
    rl_initialize();
    //and redisplay prompt:
    rl_forced_update_display();
    rl_on_new_line_with_prompt();
#ifdef __WIN32__
    jl_write(jl_uv_stdout, "\e[4C", 4); //hack: try to fix cursor location
#endif
}
开发者ID:HarlanH,项目名称:julia,代码行数:24,代码来源:repl-readline.c

示例15: list_if

/*
** 'list_if' deals with the 'LISTIF' command. It lists each line
** where there is at least one occurence of the string following
** the 'LISTIF' command.
*/
static void list_if(void) {
  byte *p, *tp;
  int32 targetlen, statelen;
  char first, *sp;
  boolean more;
  p = tp = get_srcaddr(basicvars.current);	/* Get address of string to search for */
  basicvars.current+=1+OFFSIZE;
  check_ateol();
  while (*p != NUL) p++;		/* Find the end of the string */
  targetlen = p-tp;		/* Number of characters in search string */
  if (targetlen == 0) return;	/* End if search string is empty */
  p = basicvars.start;
  more = TRUE;
  first = *tp;
  while (more && !AT_PROGEND(p)) {
    reset_indent();
    expand(p, basicvars.stringwork);
    sp = basicvars.stringwork;
    statelen = strlen(basicvars.stringwork);
    do {
      sp++;
      while (statelen>=targetlen && *sp != first) {
        statelen--;
        sp++;
      }
    } while(statelen>=targetlen && memcmp(sp, tp, targetlen) != 0);
    if (statelen>=targetlen) {	/* Can only be true if the string was found */
      if (basicvars.debug_flags.tokens)
        emulate_printf("%08p  %s\r\n", p, basicvars.stringwork);
      else {
        emulate_printf("%s\r\n", basicvars.stringwork);
      }
    }
    p+=GET_LINELEN(p);
  }
}
开发者ID:una1veritas,项目名称:Workspace,代码行数:41,代码来源:commands.c


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