85 if (cl == cl_ignore) {
105 else if (cursor > cl->
len) {
106 cursor_new = cl->
len;
112 if (cursor_new == cl->
cursor) {
121 static void console_lb_debug__internal(
ListBase *lb)
126 for (cl = lb->
first; cl; cl = cl->
next) {
127 printf(
"<%s> ", cl->
line);
132 static void console_history_debug(
const bContext *
C)
136 console_lb_debug__internal(&sc->
history);
218 int new_len =
len + 1;
220 int new_len = (
len + 1) * 2;
287 {
LINE_BEGIN,
"LINE_BEGIN", 0,
"Line Begin",
""},
288 {
LINE_END,
"LINE_END", 0,
"Line End",
""},
289 {
PREV_CHAR,
"PREVIOUS_CHARACTER", 0,
"Previous Character",
""},
290 {
NEXT_CHAR,
"NEXT_CHARACTER", 0,
"Next Character",
""},
291 {
PREV_WORD,
"PREVIOUS_WORD", 0,
"Previous Word",
""},
292 {
NEXT_WORD,
"NEXT_WORD", 0,
"Next Word",
""},
376 if (
str[0] ==
'\t' &&
str[1] ==
'\0') {
440 ot->
srna,
"text",
NULL, 0,
"Text",
"Text to insert at the cursor position");
451 bool text_before_cursor =
false;
457 if (!
ELEM(ci->
line[i],
' ',
'\t')) {
458 text_before_cursor =
true;
463 if (text_before_cursor) {
475 ot->
name =
"Indent or Autocomplete";
476 ot->
idname =
"CONSOLE_OT_indent_or_autocomplete";
501 for (spaces = 0; spaces < ci->
len; spaces++) {
502 if (ci->
line[spaces] !=
' ') {
548 for (spaces = 0; spaces < ci->
len; spaces++) {
549 if (ci->
line[spaces] !=
' ') {
594 {
DEL_PREV_CHAR,
"PREVIOUS_CHARACTER", 0,
"Previous Character",
""},
692 "Which part of the text to delete");
723 ot->
idname =
"CONSOLE_OT_clear_line";
785 int prev_len = ci->
len;
832 ot->
name =
"History Cycle";
834 ot->
idname =
"CONSOLE_OT_history_cycle";
855 int prev_len = ci->
len;
888 ot->
name =
"History Append";
890 ot->
idname =
"CONSOLE_OT_history_append";
899 ot->
srna,
"current_character", 0, 0, INT_MAX,
"Cursor",
"The index of the cursor", 0, 10000);
904 "Remove duplicate items in the history");
948 ot->
name =
"Scrollback Append";
950 ot->
idname =
"CONSOLE_OT_scrollback_append";
960 console_line_type_items,
963 "Console output type");
1000 if (sel[0] <= cl->
len && sel[1] >= 0) {
1001 int sta =
max_ii(sel[0], 0);
1011 sel[0] -= cl->
len + 1;
1012 sel[1] -= cl->
len + 1;
1030 ot->
name =
"Copy to Clipboard";
1049 char *buf_step, *buf_next;
1051 if (buf_str ==
NULL) {
1057 while ((buf_next = buf_step) && buf_next[0] !=
'\0') {
1058 buf_step = strchr(buf_next,
'\n');
1064 if (buf_next != buf_str) {
1085 ot->
name =
"Paste from Clipboard";
1114 if (pos < scu->sel_init) {
1135 mval[0] =
event->mval[0];
1136 mval[1] =
event->mval[1];
1188 switch (event->
type) {
1213 ot->
name =
"Set Selection";
1214 ot->
idname =
"CONSOLE_OT_select_set";
1239 int sel[2] = {n, n};
1245 sel[0] =
offset - sel[0];
1246 sel[1] =
offset - sel[1];
1263 ot->
name =
"Select Word";
1265 ot->
idname =
"CONSOLE_OT_select_word";
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct SpaceConsole * CTX_wm_space_console(const bContext *C)
bool txt_has_sel(const struct Text *text)
char * txt_sel_to_buf(struct Text *text, size_t *r_buf_strlen)
A dynamically sized string ADT.
DynStr * BLI_dynstr_new(void) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_dynstr_nappend(DynStr *__restrict ds, const char *cstr, int len) ATTR_NONNULL()
int BLI_dynstr_get_len(const DynStr *ds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
char * BLI_dynstr_get_cstring(const DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL()
void BLI_dynstr_append(DynStr *__restrict ds, const char *cstr) ATTR_NONNULL()
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
char * BLI_strdupn(const char *str, size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_str_cursor_step_utf8(const char *str, size_t maxlen, int *pos, eStrCursorJumpDirection direction, eStrCursorJumpType jump, bool use_init_step)
int BLI_str_utf8_size_safe(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void ED_area_tag_redraw(ScrArea *area)
bool ED_operator_console_active(struct bContext *C)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei stride
Read Guarded memory(de)allocation.
void UI_view2d_totRect_set(struct View2D *v2d, int width, int height)
void console_scrollback_prompt_end(SpaceConsole *sc, ConsoleLine *cl_dummy)
int console_textview_height(SpaceConsole *sc, const ARegion *region)
void console_scrollback_prompt_begin(SpaceConsole *sc, ConsoleLine *cl_dummy)
int console_char_pick(SpaceConsole *sc, const ARegion *region, const int mval[2])
static int console_selectword_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
static bool console_line_cursor_set(ConsoleLine *cl, int cursor)
static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
static int console_line_insert(ConsoleLine *ci, char *str)
static void console_modal_select_apply(bContext *C, wmOperator *op, const wmEvent *event)
static void console_cursor_set_exit(bContext *UNUSED(C), wmOperator *op)
static void console_modal_select_cancel(bContext *C, wmOperator *op)
static void console_line_verify_length(ConsoleLine *ci, int len)
static ConsoleLine * console_lb_add__internal(ListBase *lb, ConsoleLine *from)
static int console_clear_line_exec(bContext *C, wmOperator *UNUSED(op))
ConsoleLine * console_history_add_str(SpaceConsole *sc, char *str, bool own)
static int console_indent_or_autocomplete_exec(bContext *C, wmOperator *UNUSED(op))
static void console_cursor_set_to_pos(SpaceConsole *sc, ARegion *region, SetConsoleCursor *scu, const int mval[2], int UNUSED(sel))
static int console_unindent_exec(bContext *C, wmOperator *UNUSED(op))
void CONSOLE_OT_copy(wmOperatorType *ot)
void CONSOLE_OT_clear(wmOperatorType *ot)
static const EnumPropertyItem console_move_type_items[]
static const EnumPropertyItem console_delete_type_items[]
static bool console_line_column_from_index(SpaceConsole *sc, const int pos, ConsoleLine **r_cl, int *r_cl_offset, int *r_col)
void console_textview_update_rect(SpaceConsole *sc, ARegion *region)
void CONSOLE_OT_select_word(wmOperatorType *ot)
void CONSOLE_OT_delete(wmOperatorType *ot)
void CONSOLE_OT_indent(wmOperatorType *ot)
void CONSOLE_OT_select_set(wmOperatorType *ot)
static int console_history_append_exec(bContext *C, wmOperator *op)
static void console_scrollback_limit(SpaceConsole *sc)
static int console_history_cycle_exec(bContext *C, wmOperator *op)
static int console_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
struct SetConsoleCursor SetConsoleCursor
static int console_scrollback_append_exec(bContext *C, wmOperator *op)
static int console_move_exec(bContext *C, wmOperator *op)
void CONSOLE_OT_indent_or_autocomplete(wmOperatorType *ot)
void CONSOLE_OT_move(wmOperatorType *ot)
static int console_modal_select(bContext *C, wmOperator *op, const wmEvent *event)
static void console_scroll_bottom(ARegion *region)
void console_history_free(SpaceConsole *sc, ConsoleLine *cl)
void console_scrollback_free(SpaceConsole *sc, ConsoleLine *cl)
void CONSOLE_OT_clear_line(wmOperatorType *ot)
static int console_insert_exec(bContext *C, wmOperator *op)
void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
static int console_paste_exec(bContext *C, wmOperator *UNUSED(op))
void CONSOLE_OT_insert(wmOperatorType *ot)
ConsoleLine * console_scrollback_add_str(SpaceConsole *sc, char *str, bool own)
static ConsoleLine * console_lb_add_str__internal(ListBase *lb, char *str, bool own)
void CONSOLE_OT_history_cycle(wmOperatorType *ot)
void CONSOLE_OT_unindent(wmOperatorType *ot)
static int console_delete_exec(bContext *C, wmOperator *op)
void CONSOLE_OT_history_append(wmOperatorType *ot)
static ConsoleLine * console_history_add(SpaceConsole *sc, ConsoleLine *from)
static int console_clear_exec(bContext *C, wmOperator *op)
void CONSOLE_OT_paste(wmOperatorType *ot)
static int console_modal_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ConsoleLine * console_history_verify(const bContext *C)
static int console_indent_exec(bContext *C, wmOperator *UNUSED(op))
static ConsoleLine * console_history_find(SpaceConsole *sc, const char *str, ConsoleLine *cl_ignore)
static void console_select_offset(SpaceConsole *sc, const int offset)
ccl_global float * buffer
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void(* MEM_freeN)(void *vmemh)
void *(* MEM_recallocN_id)(void *vmemh, size_t len, const char *str)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
static void area(int d1, int d2, int e1, int e2, float weights[2])
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
int RNA_int_get(PointerRNA *ptr, const char *name)
int RNA_string_length(PointerRNA *ptr, const char *name)
char * RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen, int *r_len)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
struct ConsoleLine * next
struct ConsoleLine * prev
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
void(* cancel)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
int WM_operator_name_call(bContext *C, const char *opstring, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
void WM_clipboard_text_set(const char *buf, bool selection)
char * WM_clipboard_text_get(bool selection, int *r_len)