Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-04 10:31:30 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-04 10:31:30 +0300
commit44505b38df557a5711703613685a1dec9fc2c3d9 (patch)
tree3f05bebcc7bfadf56569f2dcca7f95fc56b1b0d0 /source/blender/editors/space_text
parent6654e109df952be3a3128fae2508a02c196ae593 (diff)
Cleanup: strip trailing space in editors
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/space_text.c82
-rw-r--r--source/blender/editors/space_text/text_draw.c66
-rw-r--r--source/blender/editors/space_text/text_format.c2
-rw-r--r--source/blender/editors/space_text/text_format_lua.c4
-rw-r--r--source/blender/editors/space_text/text_format_osl.c2
-rw-r--r--source/blender/editors/space_text/text_header.c22
-rw-r--r--source/blender/editors/space_text/text_ops.c176
7 files changed, 177 insertions, 177 deletions
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 72a274dcb5f..01e4bc4917e 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -66,17 +66,17 @@ static SpaceLink *text_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceText *stext;
-
+
stext = MEM_callocN(sizeof(SpaceText), "inittext");
stext->spacetype = SPACE_TEXT;
stext->lheight = 12;
stext->tabnumber = 4;
stext->margin_column = 80;
-
+
/* header */
ar = MEM_callocN(sizeof(ARegion), "header for text");
-
+
BLI_addtail(&stext->regionbase, ar);
ar->regiontype = RGN_TYPE_HEADER;
ar->alignment = RGN_ALIGN_BOTTOM;
@@ -91,18 +91,18 @@ static SpaceLink *text_new(const bContext *UNUSED(C))
/* main region */
ar = MEM_callocN(sizeof(ARegion), "main region for text");
-
+
BLI_addtail(&stext->regionbase, ar);
ar->regiontype = RGN_TYPE_WINDOW;
-
+
return (SpaceLink *)stext;
}
/* not spacelink itself */
static void text_free(SpaceLink *sl)
-{
+{
SpaceText *stext = (SpaceText *) sl;
-
+
stext->text = NULL;
text_free_caches(stext);
}
@@ -204,7 +204,7 @@ static void text_operatortypes(void)
WM_operatortype_append(TEXT_OT_select_line);
WM_operatortype_append(TEXT_OT_select_all);
WM_operatortype_append(TEXT_OT_select_word);
-
+
WM_operatortype_append(TEXT_OT_move_lines);
WM_operatortype_append(TEXT_OT_jump);
@@ -230,7 +230,7 @@ static void text_operatortypes(void)
WM_operatortype_append(TEXT_OT_replace_set_selected);
WM_operatortype_append(TEXT_OT_start_find);
-
+
WM_operatortype_append(TEXT_OT_to_3d_object);
WM_operatortype_append(TEXT_OT_resolve_conflict);
@@ -242,7 +242,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
wmKeyMapItem *kmi;
-
+
keymap = WM_keymap_find(keyconf, "Text Generic", SPACE_TEXT, 0);
WM_keymap_add_item(keymap, "TEXT_OT_start_find", FKEY, KM_PRESS, KM_CTRL, 0);
#ifdef __APPLE__
@@ -254,7 +254,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "TEXT_OT_properties", TKEY, KM_PRESS, KM_CTRL, 0);
keymap = WM_keymap_find(keyconf, "Text", SPACE_TEXT, 0);
-
+
#ifdef __APPLE__
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", LEFTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", RIGHTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_END);
@@ -262,30 +262,30 @@ static void text_keymap(struct wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "type", NEXT_WORD);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", UPARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", FILE_TOP);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", DOWNARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", FILE_BOTTOM);
-
+
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", LEFTARROWKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", RIGHTARROWKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0)->ptr, "type", LINE_END);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", LEFTARROWKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0)->ptr, "type", PREV_WORD);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", RIGHTARROWKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0)->ptr, "type", NEXT_WORD);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", UPARROWKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0)->ptr, "type", FILE_TOP);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", DOWNARROWKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0)->ptr, "type", FILE_BOTTOM);
-
+
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", BACKSPACEKEY, KM_PRESS, KM_ALT, 0)->ptr, "type", DEL_PREV_WORD);
-
+
WM_keymap_add_item(keymap, "TEXT_OT_save", SKEY, KM_PRESS, KM_ALT | KM_OSKEY, 0);
WM_keymap_add_item(keymap, "TEXT_OT_save_as", SKEY, KM_PRESS, KM_ALT | KM_SHIFT | KM_OSKEY, 0);
WM_keymap_add_item(keymap, "TEXT_OT_cut", XKEY, KM_PRESS, KM_OSKEY, 0);
- WM_keymap_add_item(keymap, "TEXT_OT_copy", CKEY, KM_PRESS, KM_OSKEY, 0);
+ WM_keymap_add_item(keymap, "TEXT_OT_copy", CKEY, KM_PRESS, KM_OSKEY, 0);
WM_keymap_add_item(keymap, "TEXT_OT_paste", VKEY, KM_PRESS, KM_OSKEY, 0);
WM_keymap_add_item(keymap, "TEXT_OT_find_set_selected", EKEY, KM_PRESS, KM_OSKEY, 0);
WM_keymap_add_item(keymap, "TEXT_OT_select_all", AKEY, KM_PRESS, KM_OSKEY, 0);
WM_keymap_add_item(keymap, "TEXT_OT_select_line", AKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0);
#endif
-
+
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", WHEELUPMOUSE, KM_PRESS, KM_CTRL, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.font_size");
RNA_boolean_set(kmi->ptr, "reverse", false);
-
+
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.font_size");
RNA_boolean_set(kmi->ptr, "reverse", true);
@@ -293,7 +293,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.font_size");
RNA_boolean_set(kmi->ptr, "reverse", false);
-
+
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", PADMINUS, KM_PRESS, KM_CTRL, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.font_size");
RNA_boolean_set(kmi->ptr, "reverse", true);
@@ -305,7 +305,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "TEXT_OT_save_as", SKEY, KM_PRESS, KM_ALT | KM_SHIFT | KM_CTRL, 0);
WM_keymap_add_item(keymap, "TEXT_OT_run_script", PKEY, KM_PRESS, KM_ALT, 0);
-
+
WM_keymap_add_item(keymap, "TEXT_OT_cut", XKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "TEXT_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "TEXT_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0);
@@ -313,7 +313,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "TEXT_OT_cut", DELKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "TEXT_OT_copy", INSERTKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "TEXT_OT_paste", INSERTKEY, KM_PRESS, KM_SHIFT, 0);
-
+
WM_keymap_add_item(keymap, "TEXT_OT_duplicate_line", DKEY, KM_PRESS, KM_CTRL, 0);
if (U.uiflag & USER_MMB_PASTE) { // XXX not dynamic
@@ -327,14 +327,14 @@ static void text_keymap(struct wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_lines", UPARROWKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0)->ptr, "direction", TXT_MOVE_LINE_UP);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_lines", DOWNARROWKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0)->ptr, "direction", TXT_MOVE_LINE_DOWN);
-
+
WM_keymap_add_item(keymap, "TEXT_OT_indent", TABKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "TEXT_OT_unindent", TABKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "TEXT_OT_uncomment", DKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", HOMEKEY, KM_PRESS, 0, 0)->ptr, "type", LINE_BEGIN);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", ENDKEY, KM_PRESS, 0, 0)->ptr, "type", LINE_END);
-
+
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", EKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", LINE_END);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", EKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "type", LINE_END);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", LEFTARROWKEY, KM_PRESS, 0, 0)->ptr, "type", PREV_CHAR);
@@ -366,7 +366,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", BACKSPACEKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", DEL_PREV_CHAR); /* same as above [#26623] */
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", DELKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_NEXT_WORD);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", BACKSPACEKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_PREV_WORD);
-
+
WM_keymap_add_item(keymap, "TEXT_OT_overwrite_toggle", INSERTKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "TEXT_OT_scroll_bar", LEFTMOUSE, KM_PRESS, 0, 0);
@@ -387,7 +387,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "TEXT_MT_toolbox", RIGHTMOUSE, KM_PRESS, KM_ANY, 0);
WM_keymap_add_item(keymap, "TEXT_OT_autocomplete", SPACEKEY, KM_PRESS, KM_CTRL, 0);
-
+
WM_keymap_add_item(keymap, "TEXT_OT_line_number", KM_TEXTINPUT, KM_ANY, KM_ANY, 0);
WM_keymap_add_item(keymap, "TEXT_OT_insert", KM_TEXTINPUT, KM_ANY, KM_ANY, 0); // last!
}
@@ -417,18 +417,18 @@ static void text_main_region_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
ListBase *lb;
-
+
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
-
+
/* own keymap */
keymap = WM_keymap_find(wm->defaultconf, "Text Generic", SPACE_TEXT, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
keymap = WM_keymap_find(wm->defaultconf, "Text", SPACE_TEXT, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
-
+
/* add drop boxes */
lb = WM_dropboxmap_find("Text", SPACE_TEXT, RGN_TYPE_WINDOW);
-
+
WM_event_add_dropbox_handler(&ar->handlers, lb);
}
@@ -437,19 +437,19 @@ static void text_main_region_draw(const bContext *C, ARegion *ar)
/* draw entirely, view changes should be handled here */
SpaceText *st = CTX_wm_space_text(C);
//View2D *v2d = &ar->v2d;
-
+
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
-
+
// UI_view2d_view_ortho(v2d);
-
+
/* data... */
draw_text_main(st, ar);
-
+
/* reset view matrix */
// UI_view2d_view_restore(C);
-
+
/* scrollers? */
}
@@ -509,7 +509,7 @@ static void text_drop_paste(wmDrag *drag, wmDropBox *drop)
static void text_dropboxes(void)
{
ListBase *lb = WM_dropboxmap_find("Text", SPACE_TEXT, RGN_TYPE_WINDOW);
-
+
WM_dropbox_add(lb, "TEXT_OT_open", text_drop_poll, text_drop_copy);
WM_dropbox_add(lb, "TEXT_OT_insert", text_drop_paste_poll, text_drop_paste);
}
@@ -549,9 +549,9 @@ static void text_properties_region_init(wmWindowManager *wm, ARegion *ar)
static void text_properties_region_draw(const bContext *C, ARegion *ar)
{
SpaceText *st = CTX_wm_space_text(C);
-
+
ED_region_panels(C, ar, NULL, -1, true);
-
+
/* this flag trick is make sure buttons have been added already */
if (st->flags & ST_FIND_ACTIVATE) {
if (UI_textbutton_activate_rna(C, ar, st, "find_text")) {
@@ -584,10 +584,10 @@ void ED_spacetype_text(void)
{
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype text");
ARegionType *art;
-
+
st->spaceid = SPACE_TEXT;
strncpy(st->name, "Text", BKE_ST_MAXNAME);
-
+
st->new = text_new;
st->free = text_free;
st->init = text_init;
@@ -608,13 +608,13 @@ void ED_spacetype_text(void)
art->event_cursor = true;
BLI_addhead(&st->regiontypes, art);
-
+
/* regions: properties */
art = MEM_callocN(sizeof(ARegionType), "spacetype text region");
art->regionid = RGN_TYPE_UI;
art->prefsizex = UI_COMPACT_PANEL_WIDTH;
art->keymapflag = ED_KEYMAP_UI;
-
+
art->init = text_properties_region_init;
art->draw = text_properties_region_draw;
BLI_addhead(&st->regiontypes, art);
@@ -624,7 +624,7 @@ void ED_spacetype_text(void)
art->regionid = RGN_TYPE_HEADER;
art->prefsizey = HEADERY;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
-
+
art->init = text_header_region_init;
art->draw = text_header_region_draw;
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 23f28a91be8..9a3dcddf804 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -111,7 +111,7 @@ static int text_font_draw_character_utf8(const TextDrawContext *tdc, int x, int
#if 0
/* Formats every line of the current text */
-static void txt_format_text(SpaceText *st)
+static void txt_format_text(SpaceText *st)
{
TextLine *linep;
@@ -189,7 +189,7 @@ int wrap_width(const SpaceText *st, ARegion *ar)
{
int winx = ar->winx - TXT_SCROLL_WIDTH;
int x, max;
-
+
x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
max = st->cwidth ? (winx - x) / st->cwidth : 0;
return max > 8 ? max : 8;
@@ -356,7 +356,7 @@ void wrap_offset_in_line(const SpaceText *st, ARegion *ar, TextLine *linein, int
int text_get_char_pos(const SpaceText *st, const char *line, int cur)
{
int a = 0, i;
-
+
for (i = 0; i < cur && line[i]; i += BLI_str_utf8_size_safe(line + i)) {
if (line[i] == '\t')
a += st->tabnumber - a % st->tabnumber;
@@ -405,11 +405,11 @@ static int text_draw_wrapped(
if (max < 8) max = 8;
basex = x;
lines = 1;
-
+
fpos = fstart = 0; mstart = 0;
mend = txt_utf8_forward_columns(str, max, &padding) - str;
end = wrap = max - padding;
-
+
for (i = 0, mi = 0; str[mi]; i += columns, mi += BLI_str_utf8_size_safe(str + mi)) {
columns = BLI_str_utf8_char_width_safe(str + mi);
if (i + columns > end) {
@@ -657,7 +657,7 @@ void text_drawcache_tag_update(SpaceText *st, int full)
/* this happens if text editor ops are caled from python */
if (st == NULL)
return;
-
+
if (st->drawcache) {
DrawCache *drawcache = (DrawCache *)st->drawcache;
Text *txt = st->text;
@@ -806,17 +806,17 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
back->xmax = ar->winx;
back->ymin = 0;
back->ymax = ar->winy;
-
+
scroll->xmin = ar->winx - V2D_SCROLL_WIDTH;
scroll->xmax = ar->winx - 5;
scroll->ymin = 4;
scroll->ymax = 4 + pix_available;
-
+
/* when re-sizing a view-port with the bar at the bottom to a greater height more blank lines will be added */
if (ltexth + blank_lines < st->top + st->viewlines) {
blank_lines = st->top + st->viewlines - ltexth;
}
-
+
ltexth += blank_lines;
barheight = (ltexth > 0) ? (st->viewlines * pix_available) / ltexth : 0;
@@ -893,7 +893,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
if (hlend - hlstart < 2) {
hlend = hlstart + 2;
}
-
+
st->txtscroll = *scroll;
st->txtscroll.ymax = ar->winy - pix_top_margin - hlstart;
st->txtscroll.ymin = ar->winy - pix_top_margin - hlend;
@@ -908,7 +908,7 @@ static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back)
uiWidgetColors wcol = btheme->tui.wcol_scroll;
unsigned char col[4];
float rad;
-
+
UI_ThemeColor(TH_BACK);
glRecti(back->xmin, back->ymin, back->xmax, back->ymax);
@@ -934,10 +934,10 @@ static void draw_documentation(const SpaceText *st, ARegion *ar)
char *docs, buf[DOC_WIDTH + 1], *p;
int i, br, lines;
int boxw, boxh, l, x, y /* , top */ /* UNUSED */;
-
+
if (!st || !st->text) return;
if (!texttool_text_is_active(st->text)) return;
-
+
docs = texttool_docs_get();
if (!docs) return;
@@ -947,7 +947,7 @@ static void draw_documentation(const SpaceText *st, ARegion *ar)
/* Count the visible lines to the cursor */
for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++) ;
if (l < 0) return;
-
+
if (st->showlinenrs) {
x = st->cwidth * (st->text->curc - st->left) + TXT_OFFSET + TEXTXLOC - 4;
}
@@ -1027,7 +1027,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
int w, boxw = 0, boxh, i, x, y, *top;
const int lheight = st->lheight_dpi + TXT_LINE_SPACING;
const int margin_x = 2;
-
+
if (!st->text) return;
if (!texttool_text_is_active(st->text)) return;
@@ -1054,7 +1054,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
boxw = SUGG_LIST_WIDTH * st->cwidth + 20;
boxh = SUGG_LIST_SIZE * lheight + 8;
-
+
if (x + boxw > ar->winx)
x = MAX2(0, ar->winx - boxw);
@@ -1077,7 +1077,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
BLI_strncpy(str, item->name, len + 1);
w = st->cwidth * text_get_char_pos(st, str, len);
-
+
if (item == sel) {
UI_ThemeColor(TH_SHADE2);
glRecti(x + margin_x, y - 3, x + margin_x + w, y + lheight - 3);
@@ -1117,7 +1117,7 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
vselc = 0;
hidden = 1;
}
-
+
UI_ThemeColor(TH_SHADE2);
x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
y = ar->winy;
@@ -1188,27 +1188,27 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
x2 = x1 + ar->winx;
glColor4ub(255, 255, 255, 32);
-
+
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glRecti(x1 - 4, y1, x2, y2);
glDisable(GL_BLEND);
}
}
-
+
if (!hidden) {
/* Draw the cursor itself (we draw the sel. cursor as this is the leading edge) */
x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
x += vselc * st->cwidth;
y = ar->winy - vsell * lheight;
-
+
if (st->overwrite) {
char ch = text->sell->line[text->selc];
-
+
y += TXT_LINE_SPACING;
w = st->cwidth;
if (ch == '\t') w *= st->tabnumber - (vselc + st->left) % st->tabnumber;
-
+
UI_ThemeColor(TH_HILITE);
glRecti(x, y - lheight - 1, x + w, y - lheight + 1);
}
@@ -1227,7 +1227,7 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
Text *text = st->text;
int b, fc, find, stack, viewc, viewl, offl, offc, x, y;
int startc, endc, c;
-
+
char ch;
// showsyntax must be on or else the format string will be null
@@ -1246,7 +1246,7 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
endc = -1;
find = -b;
stack = 0;
-
+
/* Don't highlight backets if syntax HL is off or bracket in string or comment. */
if (!linep->format || linep->format[fc] == FMT_TYPE_STRING || linep->format[fc] == FMT_TYPE_COMMENT)
return;
@@ -1371,7 +1371,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
const int clip_min_y = -(int)(st->lheight_dpi - 1);
st->viewlines = (st->lheight_dpi) ? (int)(ar->winy - clip_min_y) / (st->lheight_dpi + TXT_LINE_SPACING) : 0;
-
+
text_draw_context_init(st, &tdc);
text_update_drawcache(st, ar);
@@ -1379,7 +1379,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
/* make sure all the positional pointers exist */
if (!text->curl || !text->sell || !text->lines.first || !text->lines.last)
txt_clean_text(text);
-
+
/* update rects for scroll */
calc_text_rcts(st, ar, &scroll, &back); /* scroll will hold the entire bar size */
@@ -1431,7 +1431,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
}
y = ar->winy - st->lheight_dpi;
winx = ar->winx - TXT_SCROLL_WIDTH;
-
+
/* draw cursor */
draw_cursor(st, ar);
@@ -1466,13 +1466,13 @@ void draw_text_main(SpaceText *st, ARegion *ar)
text_draw(st, &tdc, tmp->line, st->left, ar->winx / st->cwidth, x, y, tmp->format);
y -= st->lheight_dpi + TXT_LINE_SPACING;
}
-
+
wrap_skip = 0;
}
-
+
if (st->flags & ST_SHOW_MARGIN) {
margin_column_x = x + st->cwidth * (st->margin_column - st->left);
-
+
if (margin_column_x >= x) {
/* same color as line number background */
UI_ThemeColor(TH_GRID);
@@ -1491,7 +1491,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
draw_textscroll(st, &scroll, &back);
/* draw_documentation(st, ar); - No longer supported */
draw_suggestion_list(st, &tdc, ar);
-
+
text_font_end(&tdc);
}
@@ -1542,7 +1542,7 @@ void text_scroll_to_cursor(SpaceText *st, ARegion *ar, const bool center)
st->top = i;
}
}
-
+
if (st->wordwrap) {
st->left = 0;
}
diff --git a/source/blender/editors/space_text/text_format.c b/source/blender/editors/space_text/text_format.c
index 0133122c5a3..b64eefe969b 100644
--- a/source/blender/editors/space_text/text_format.c
+++ b/source/blender/editors/space_text/text_format.c
@@ -216,7 +216,7 @@ TextFormatType *ED_text_format_get(Text *text)
}
}
- /* If we make it here we never found an extension that worked - return
+ /* If we make it here we never found an extension that worked - return
* the "default" text format */
return tft_lb.first;
}
diff --git a/source/blender/editors/space_text/text_format_lua.c b/source/blender/editors/space_text/text_format_lua.c
index f7e1d433e51..8b6ec2d804b 100644
--- a/source/blender/editors/space_text/text_format_lua.c
+++ b/source/blender/editors/space_text/text_format_lua.c
@@ -34,7 +34,7 @@
/* *** Lua Keywords (for format_line) *** */
-/* Checks the specified source string for a Lua keyword (minus boolean & 'nil').
+/* Checks the specified source string for a Lua keyword (minus boolean & 'nil').
* This name must start at the beginning of the source string and must be
* followed by a non-identifier (see text_check_identifier(char)) or null char.
*
@@ -75,7 +75,7 @@ static int txtfmt_lua_find_keyword(const char *string)
return i;
}
-/* Checks the specified source string for a Lua special name/function. This
+/* Checks the specified source string for a Lua special name/function. This
* name must start at the beginning of the source string and must be followed
* by a non-identifier (see text_check_identifier(char)) or null character.
*
diff --git a/source/blender/editors/space_text/text_format_osl.c b/source/blender/editors/space_text/text_format_osl.c
index 97dc1be3b9a..2daaaa348e6 100644
--- a/source/blender/editors/space_text/text_format_osl.c
+++ b/source/blender/editors/space_text/text_format_osl.c
@@ -132,7 +132,7 @@ static int txtfmt_osl_find_reserved(const char *string)
static int txtfmt_osl_find_specialvar(const char *string)
{
int i, len;
-
+
/* OSL shader types */
if (STR_LITERAL_STARTSWITH(string, "shader", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "surface", len)) i = len;
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 1a6d3181349..50a8739c5b4 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -54,21 +54,21 @@ static ARegion *text_has_properties_region(ScrArea *sa)
ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
if (ar) return ar;
-
+
/* add subdiv level; after header */
ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
if (ar == NULL) return NULL;
-
+
arnew = MEM_callocN(sizeof(ARegion), "properties region");
-
+
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
arnew->regiontype = RGN_TYPE_UI;
arnew->alignment = RGN_ALIGN_LEFT;
-
+
arnew->flag = RGN_FLAG_HIDDEN;
-
+
return arnew;
}
@@ -81,7 +81,7 @@ static int text_properties_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = text_has_properties_region(sa);
-
+
if (ar)
ED_region_toggle_hidden(C, ar);
@@ -94,7 +94,7 @@ void TEXT_OT_properties(wmOperatorType *ot)
ot->name = "Properties";
ot->description = "Toggle the properties region visibility";
ot->idname = "TEXT_OT_properties";
-
+
/* api callbacks */
ot->exec = text_properties_exec;
ot->poll = text_properties_poll;
@@ -105,15 +105,15 @@ static int text_text_search_exec(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = text_has_properties_region(sa);
SpaceText *st = CTX_wm_space_text(C);
-
+
if (ar) {
if (ar->flag & RGN_FLAG_HIDDEN)
ED_region_toggle_hidden(C, ar);
-
+
/* cannot send a button activate yet for case when region wasn't visible yet */
/* flag gets checked and cleared in main draw callback */
st->flags |= ST_FIND_ACTIVATE;
-
+
ED_region_tag_redraw(ar);
}
return OPERATOR_FINISHED;
@@ -126,7 +126,7 @@ void TEXT_OT_start_find(wmOperatorType *ot)
ot->name = "Find";
ot->description = "Start searching text";
ot->idname = "TEXT_OT_start_find";
-
+
/* api callbacks */
ot->exec = text_text_search_exec;
ot->poll = text_properties_poll;
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 24215c6d403..fe15d9165b7 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -124,7 +124,7 @@ static int text_region_edit_poll(bContext *C)
if (!st || !text)
return 0;
-
+
if (!ar || ar->regiontype != RGN_TYPE_WINDOW)
return 0;
@@ -198,11 +198,11 @@ void TEXT_OT_new(wmOperatorType *ot)
ot->name = "Create Text Block";
ot->idname = "TEXT_OT_new";
ot->description = "Create a new text data-block";
-
+
/* api callbacks */
ot->exec = text_new_exec;
ot->poll = text_new_poll;
-
+
/* flags */
ot->flag = OPTYPE_UNDO;
}
@@ -278,10 +278,10 @@ static int text_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
if (RNA_struct_property_is_set(op->ptr, "filepath"))
return text_open_exec(C, op);
-
+
text_open_init(C, op);
RNA_string_set(op->ptr, "filepath", path);
- WM_event_add_fileselect(C, op);
+ WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -301,7 +301,7 @@ void TEXT_OT_open(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_UNDO;
-
+
/* properties */
WM_operator_properties_filesel(
ot, FILE_TYPE_FOLDER | FILE_TYPE_TEXT | FILE_TYPE_PYSCRIPT, FILE_SPECIAL, FILE_OPENFILE,
@@ -352,7 +352,7 @@ void TEXT_OT_reload(wmOperatorType *ot)
ot->name = "Reload";
ot->idname = "TEXT_OT_reload";
ot->description = "Reload active text data-block from its file";
-
+
/* api callbacks */
ot->exec = text_reload_exec;
ot->invoke = WM_operator_confirm;
@@ -401,12 +401,12 @@ void TEXT_OT_unlink(wmOperatorType *ot)
ot->name = "Unlink";
ot->idname = "TEXT_OT_unlink";
ot->description = "Unlink active text data-block";
-
+
/* api callbacks */
ot->exec = text_unlink_exec;
ot->invoke = WM_operator_confirm;
ot->poll = text_unlink_poll;
-
+
/* flags */
ot->flag = OPTYPE_UNDO;
}
@@ -440,7 +440,7 @@ void TEXT_OT_make_internal(wmOperatorType *ot)
/* api callbacks */
ot->exec = text_make_internal_exec;
ot->poll = text_edit_poll;
-
+
/* flags */
ot->flag = OPTYPE_UNDO;
}
@@ -453,7 +453,7 @@ static int text_save_poll(bContext *C)
if (!text_edit_poll(C))
return 0;
-
+
return (text->name != NULL && !(text->flags & TXT_ISMEM));
}
@@ -463,10 +463,10 @@ static void txt_write_file(Main *bmain, Text *text, ReportList *reports)
TextLine *tmp;
BLI_stat_t st;
char filepath[FILE_MAX];
-
+
BLI_strncpy(filepath, text->name, FILE_MAX);
BLI_path_abs(filepath, bmain->name);
-
+
fp = BLI_fopen(filepath, "w");
if (fp == NULL) {
BKE_reportf(reports, RPT_ERROR, "Unable to save '%s': %s",
@@ -480,7 +480,7 @@ static void txt_write_file(Main *bmain, Text *text, ReportList *reports)
fputc('\n', fp);
}
}
-
+
fclose(fp);
if (BLI_stat(filepath, &st) == 0) {
@@ -494,7 +494,7 @@ static void txt_write_file(Main *bmain, Text *text, ReportList *reports)
BKE_reportf(reports, RPT_WARNING, "Unable to stat '%s': %s",
filepath, errno ? strerror(errno) : TIP_("unknown error stating file"));
}
-
+
text->flags &= ~TXT_ISDIRTY;
}
@@ -563,9 +563,9 @@ static int text_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
str = text->id.name + 2;
else
str = bmain->name;
-
+
RNA_string_set(op->ptr, "filepath", str);
- WM_event_add_fileselect(C, op);
+ WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -576,7 +576,7 @@ void TEXT_OT_save_as(wmOperatorType *ot)
ot->name = "Save As";
ot->idname = "TEXT_OT_save_as";
ot->description = "Save active text file with options";
-
+
/* api callbacks */
ot->exec = text_save_as_exec;
ot->invoke = text_save_as_invoke;
@@ -653,7 +653,7 @@ void TEXT_OT_run_script(wmOperatorType *ot)
ot->name = "Run Script";
ot->idname = "TEXT_OT_run_script";
ot->description = "Run active script";
-
+
/* api callbacks */
ot->poll = text_run_script_poll;
ot->exec = text_run_script_exec;
@@ -672,7 +672,7 @@ static int text_refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUS
Object *ob;
bConstraint *con;
short update;
-
+
/* check all pyconstraints */
for (ob = CTX_data_main(C)->object.first; ob; ob = ob->id.next) {
update = 0;
@@ -684,7 +684,7 @@ static int text_refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUS
bPythonConstraint *data = con->data;
if (data->text == text) BPY_pyconstraint_update(ob, con);
update = 1;
-
+
}
}
}
@@ -696,7 +696,7 @@ static int text_refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUS
update = 1;
}
}
-
+
if (update) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
@@ -713,7 +713,7 @@ void TEXT_OT_refresh_pyconstraints(wmOperatorType *ot)
ot->name = "Refresh PyConstraints";
ot->idname = "TEXT_OT_refresh_pyconstraints";
ot->description = "Refresh all pyconstraints";
-
+
/* api callbacks */
ot->exec = text_refresh_pyconstraints_exec;
ot->poll = text_edit_poll;
@@ -757,7 +757,7 @@ void TEXT_OT_paste(wmOperatorType *ot)
ot->name = "Paste";
ot->idname = "TEXT_OT_paste";
ot->description = "Paste text from clipboard";
-
+
/* api callbacks */
ot->exec = text_paste_exec;
ot->poll = text_edit_poll;
@@ -871,7 +871,7 @@ void TEXT_OT_cut(wmOperatorType *ot)
ot->name = "Cut";
ot->idname = "TEXT_OT_cut";
ot->description = "Cut selected text to clipboard";
-
+
/* api callbacks */
ot->exec = text_cut_exec;
ot->poll = text_edit_poll;
@@ -912,7 +912,7 @@ void TEXT_OT_indent(wmOperatorType *ot)
ot->name = "Indent";
ot->idname = "TEXT_OT_indent";
ot->description = "Indent selected text";
-
+
/* api callbacks */
ot->exec = text_indent_exec;
ot->poll = text_edit_poll;
@@ -948,7 +948,7 @@ void TEXT_OT_unindent(wmOperatorType *ot)
ot->name = "Unindent";
ot->idname = "TEXT_OT_unindent";
ot->description = "Unindent selected text";
-
+
/* api callbacks */
ot->exec = text_unindent_exec;
ot->poll = text_edit_poll;
@@ -1077,7 +1077,7 @@ void TEXT_OT_uncomment(wmOperatorType *ot)
ot->name = "Uncomment";
ot->idname = "TEXT_OT_uncomment";
ot->description = "Convert selected comment to text";
-
+
/* api callbacks */
ot->exec = text_uncomment_exec;
ot->poll = text_edit_poll;
@@ -1117,7 +1117,7 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
MEM_freeN(tmp->line);
if (tmp->format)
MEM_freeN(tmp->format);
-
+
/* Put new_line in the tmp->line spot still need to try and set the curc correctly. */
tmp->line = new_line;
tmp->len = strlen(new_line);
@@ -1126,7 +1126,7 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
max_len = tmp->len;
}
}
-
+
if (type == TO_TABS) {
char *tmp_line = MEM_mallocN(sizeof(*tmp_line) * (max_len + 1), __func__);
@@ -1212,7 +1212,7 @@ void TEXT_OT_convert_whitespace(wmOperatorType *ot)
ot->name = "Convert Whitespace";
ot->idname = "TEXT_OT_convert_whitespace";
ot->description = "Convert whitespaces by type";
-
+
/* api callbacks */
ot->exec = text_convert_whitespace_exec;
ot->poll = text_edit_poll;
@@ -1244,7 +1244,7 @@ void TEXT_OT_select_all(wmOperatorType *ot)
ot->name = "Select All";
ot->idname = "TEXT_OT_select_all";
ot->description = "Select all text";
-
+
/* api callbacks */
ot->exec = text_select_all_exec;
ot->poll = text_edit_poll;
@@ -1270,7 +1270,7 @@ void TEXT_OT_select_line(wmOperatorType *ot)
ot->name = "Select Line";
ot->idname = "TEXT_OT_select_line";
ot->description = "Select text by line";
-
+
/* api callbacks */
ot->exec = text_select_line_exec;
ot->poll = text_edit_poll;
@@ -1315,14 +1315,14 @@ static int move_lines_exec(bContext *C, wmOperator *op)
TextUndoBuf *utxt = ED_text_undo_push_init(C);
txt_move_lines(text, utxt, direction);
-
+
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
/* run the script while editing, evil but useful */
if (CTX_wm_space_text(C)->live_edit)
text_run_script(C, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -1338,7 +1338,7 @@ void TEXT_OT_move_lines(wmOperatorType *ot)
ot->name = "Move Lines";
ot->idname = "TEXT_OT_move_lines";
ot->description = "Move the currently selected line(s) up/down";
-
+
/* api callbacks */
ot->exec = move_lines_exec;
ot->poll = text_edit_poll;
@@ -1757,7 +1757,7 @@ static void cursor_skip(SpaceText *st, ARegion *ar, Text *text, int lines, const
{
TextLine **linep;
int *charp;
-
+
if (sel) { linep = &text->sell; charp = &text->selc; }
else { linep = &text->curl; charp = &text->curc; }
@@ -1802,7 +1802,7 @@ static int text_move_cursor(bContext *C, int type, bool select)
if (st && st->wordwrap && ar) txt_wrap_move_bol(st, ar, select);
else txt_move_bol(text, select);
break;
-
+
case LINE_END:
if (!select) {
txt_sel_clear(text);
@@ -1814,7 +1814,7 @@ static int text_move_cursor(bContext *C, int type, bool select)
case FILE_TOP:
txt_move_bof(text, select);
break;
-
+
case FILE_BOTTOM:
txt_move_eof(text, select);
break;
@@ -1857,7 +1857,7 @@ static int text_move_cursor(bContext *C, int type, bool select)
if (st && st->wordwrap && ar) txt_wrap_move_up(st, ar, select);
else txt_move_up(text, select);
break;
-
+
case NEXT_LINE:
if (st && st->wordwrap && ar) txt_wrap_move_down(st, ar, select);
else txt_move_down(text, select);
@@ -1893,7 +1893,7 @@ void TEXT_OT_move(wmOperatorType *ot)
ot->name = "Move Cursor";
ot->idname = "TEXT_OT_move";
ot->description = "Move cursor to position type";
-
+
/* api callbacks */
ot->exec = text_move_exec;
ot->poll = text_edit_poll;
@@ -1917,7 +1917,7 @@ void TEXT_OT_move_select(wmOperatorType *ot)
ot->name = "Move Select";
ot->idname = "TEXT_OT_move_select";
ot->description = "Move the cursor while selecting";
-
+
/* api callbacks */
ot->exec = text_move_select_exec;
ot->poll = text_space_edit_poll;
@@ -1961,7 +1961,7 @@ void TEXT_OT_jump(wmOperatorType *ot)
ot->name = "Jump";
ot->idname = "TEXT_OT_jump";
ot->description = "Jump cursor to line";
-
+
/* api callbacks */
ot->invoke = text_jump_invoke;
ot->exec = text_jump_exec;
@@ -2052,7 +2052,7 @@ static int text_delete_exec(bContext *C, wmOperator *op)
/* run the script while editing, evil but useful */
if (st->live_edit)
text_run_script(C, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -2062,7 +2062,7 @@ void TEXT_OT_delete(wmOperatorType *ot)
ot->name = "Delete";
ot->idname = "TEXT_OT_delete";
ot->description = "Delete text by cursor position";
-
+
/* api callbacks */
ot->exec = text_delete_exec;
ot->poll = text_edit_poll;
@@ -2093,7 +2093,7 @@ void TEXT_OT_overwrite_toggle(wmOperatorType *ot)
ot->name = "Toggle Overwrite";
ot->idname = "TEXT_OT_overwrite_toggle";
ot->description = "Toggle overwrite while typing";
-
+
/* api callbacks */
ot->exec = text_toggle_overwrite_exec;
ot->poll = text_space_edit_poll;
@@ -2264,20 +2264,20 @@ static int text_scroll_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceText *st = CTX_wm_space_text(C);
TextScroll *tsc;
-
+
if (RNA_struct_property_is_set(op->ptr, "lines"))
return text_scroll_exec(C, op);
-
+
tsc = MEM_callocN(sizeof(TextScroll), "TextScroll");
tsc->first = 1;
tsc->zone = SCROLLHANDLE_BAR;
op->customdata = tsc;
-
+
st->flags |= ST_SCROLL_SELECT;
-
+
if (event->type == MOUSEPAN) {
text_update_character_width(st);
-
+
tsc->old[0] = event->x;
tsc->old[1] = event->y;
/* Sensitivity of scroll set to 4pix per line/char */
@@ -2291,7 +2291,7 @@ static int text_scroll_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
WM_event_add_modal_handler(C, op);
-
+
return OPERATOR_RUNNING_MODAL;
}
@@ -2300,11 +2300,11 @@ void TEXT_OT_scroll(wmOperatorType *ot)
/* identifiers */
ot->name = "Scroll";
/* don't really see the difference between this and
- * scroll_bar. Both do basically the same thing (aside
+ * scroll_bar. Both do basically the same thing (aside
* from keymaps).*/
ot->idname = "TEXT_OT_scroll";
ot->description = "";
-
+
/* api callbacks */
ot->exec = text_scroll_exec;
ot->invoke = text_scroll_invoke;
@@ -2330,10 +2330,10 @@ static int text_region_scroll_poll(bContext *C)
if (!st || !text)
return 0;
-
+
if (!ar || ar->regiontype != RGN_TYPE_WINDOW)
return 0;
-
+
return 1;
}
@@ -2347,7 +2347,7 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, const wmEvent *ev
if (RNA_struct_property_is_set(op->ptr, "lines"))
return text_scroll_exec(C, op);
-
+
/* verify we are in the right zone */
if (mval[0] > st->txtbar.xmin && mval[0] < st->txtbar.xmax) {
if (mval[1] >= st->txtbar.ymin && mval[1] <= st->txtbar.ymax) {
@@ -2392,11 +2392,11 @@ void TEXT_OT_scroll_bar(wmOperatorType *ot)
/* identifiers */
ot->name = "Scrollbar";
/* don't really see the difference between this and
- * scroll. Both do basically the same thing (aside
+ * scroll. Both do basically the same thing (aside
* from keymaps).*/
ot->idname = "TEXT_OT_scroll_bar";
ot->description = "";
-
+
/* api callbacks */
ot->invoke = text_scroll_bar_invoke;
ot->modal = text_scroll_modal;
@@ -2431,7 +2431,7 @@ static int flatten_width(SpaceText *st, const char *str)
total += BLI_str_utf8_char_width_safe(str + i);
}
}
-
+
return total;
}
@@ -2444,14 +2444,14 @@ static int flatten_column_to_offset(SpaceText *st, const char *str, int index)
col = st->tabnumber - i % st->tabnumber;
else
col = BLI_str_utf8_char_width_safe(str + j);
-
+
if (i + col > index)
break;
-
+
i += col;
j += BLI_str_utf8_size_safe(str + j);
}
-
+
return j;
}
@@ -2482,7 +2482,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
int max = wrap_width(st, ar); /* column */
int charp = -1; /* mem */
bool found = false; /* flags */
-
+
/* Point to line matching given y position, if any. */
TextLine *linep = get_line_pos_wrapped(st, ar, &y);
@@ -2495,7 +2495,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
for (j = 0 ; !found && ((ch = linep->line[j]) != '\0'); j += BLI_str_utf8_size_safe(linep->line + j)) {
int chars;
int columns = BLI_str_utf8_char_width_safe(linep->line + j); /* = 1 for tab */
-
+
/* Mimic replacement of tabs */
if (ch == '\t') {
chars = st->tabnumber - i % st->tabnumber;
@@ -2504,7 +2504,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
else {
chars = 1;
}
-
+
while (chars--) {
/* Gone too far, go back to last wrap point */
if (y < 0) {
@@ -2526,22 +2526,22 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
}
if (i + columns - start > max) {
end = MIN2(end, i);
-
+
if (found) {
/* exact cursor position was found, check if it's still on needed line (hasn't been wrapped) */
if (charp > endj && !chop && ch != '\0')
charp = endj;
break;
}
-
+
if (chop)
endj = j;
start = end;
end += max;
-
+
if (j < linep->len)
y--;
-
+
chop = true;
if (y == 0 && i + columns - start > x) {
charp = curs;
@@ -2553,7 +2553,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
if (found) {
break;
}
-
+
if (y == 0 && i + columns - start > x) {
charp = curs;
found = true;
@@ -2568,7 +2568,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
}
BLI_assert(y == 0);
-
+
if (!found) {
/* On correct line but didn't meet cursor, must be at end */
charp = linep->len;
@@ -2606,7 +2606,7 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, con
if (x < 0) x = 0;
x = text_pixel_x_to_column(st, x) + st->left;
-
+
if (st->wordwrap) {
text_cursor_set_to_pos_wrapped(st, ar, x, y, sel);
}
@@ -2614,12 +2614,12 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, con
TextLine **linep;
int *charp;
int w;
-
+
if (sel) { linep = &text->sell; charp = &text->selc; }
else { linep = &text->curl; charp = &text->curc; }
-
+
y -= txt_get_span(text->lines.first, *linep) - st->top;
-
+
if (y > 0) {
while (y-- != 0) {
if ((*linep)->next) *linep = (*linep)->next;
@@ -2631,7 +2631,7 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, con
}
}
-
+
w = flatten_width(st, (*linep)->line);
if (x < w) *charp = flatten_column_to_offset(st, (*linep)->line, x);
else *charp = (*linep)->len;
@@ -2679,7 +2679,7 @@ static void text_cursor_set_apply(bContext *C, wmOperator *op, const wmEvent *ev
}
else if (!st->wordwrap && (event->mval[0] < 0 || event->mval[0] > ar->winx)) {
text_cursor_timer_ensure(C, ssel);
-
+
if (event->type == TIMER) {
text_cursor_set_to_pos(st, ar, CLAMPIS(event->mval[0], 0, ar->winx), event->mval[1], 1);
text_scroll_to_cursor(st, ar, false);
@@ -2876,7 +2876,7 @@ void TEXT_OT_line_number(wmOperatorType *ot)
ot->name = "Line Number";
ot->idname = "TEXT_OT_line_number";
ot->description = "The current line number";
-
+
/* api callbacks */
ot->invoke = text_line_number_invoke;
ot->poll = text_region_edit_poll;
@@ -2913,7 +2913,7 @@ static int text_insert_exec(bContext *C, wmOperator *op)
}
MEM_freeN(str);
-
+
if (!done)
return OPERATOR_CANCELLED;
@@ -2941,7 +2941,7 @@ static int text_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
else {
char str[BLI_UTF8_MAX + 1];
size_t len;
-
+
if (event->utf8_buf[0]) {
len = BLI_str_utf8_size_safe(event->utf8_buf);
memcpy(str, event->utf8_buf, len);
@@ -2956,7 +2956,7 @@ static int text_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
ret = text_insert_exec(C, op);
-
+
/* run the script while editing, evil but useful */
if (ret == OPERATOR_FINISHED && CTX_wm_space_text(C)->live_edit)
text_run_script(C, NULL);
@@ -2972,7 +2972,7 @@ void TEXT_OT_insert(wmOperatorType *ot)
ot->name = "Insert";
ot->idname = "TEXT_OT_insert";
ot->description = "Insert text at cursor position";
-
+
/* api callbacks */
ot->exec = text_insert_exec;
ot->invoke = text_insert_invoke;
@@ -3064,7 +3064,7 @@ void TEXT_OT_find(wmOperatorType *ot)
ot->name = "Find Next";
ot->idname = "TEXT_OT_find";
ot->description = "Find specified text";
-
+
/* api callbacks */
ot->exec = text_find_exec;
ot->poll = text_space_edit_poll;
@@ -3116,7 +3116,7 @@ void TEXT_OT_find_set_selected(wmOperatorType *ot)
ot->name = "Find Set Selected";
ot->idname = "TEXT_OT_find_set_selected";
ot->description = "Find specified text and set as selected";
-
+
/* api callbacks */
ot->exec = text_find_set_selected_exec;
ot->poll = text_space_edit_poll;
@@ -3143,7 +3143,7 @@ void TEXT_OT_replace_set_selected(wmOperatorType *ot)
ot->name = "Replace Set Selected";
ot->idname = "TEXT_OT_replace_set_selected";
ot->description = "Replace text with specified text and set as selected";
-
+
/* api callbacks */
ot->exec = text_replace_set_selected_exec;
ot->poll = text_space_edit_poll;
@@ -3259,11 +3259,11 @@ void TEXT_OT_to_3d_object(wmOperatorType *ot)
ot->name = "To 3D Object";
ot->idname = "TEXT_OT_to_3d_object";
ot->description = "Create 3D text object from active text data-block";
-
+
/* api callbacks */
ot->exec = text_to_3d_object_exec;
ot->poll = text_edit_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;