Blender V4.3
text_ops.cc File Reference
#include <algorithm>
#include <cerrno>
#include <cstring>
#include <sstream>
#include "MEM_guardedalloc.h"
#include "DNA_text_types.h"
#include "BLI_blenlib.h"
#include "BLI_math_base.h"
#include "BLI_math_vector.h"
#include "BLI_string_cursor_utf8.h"
#include "BLI_string_utf8.h"
#include "BLI_time.h"
#include "BLT_translation.hh"
#include "BKE_context.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_report.hh"
#include "BKE_text.h"
#include "WM_api.hh"
#include "WM_types.hh"
#include "ED_curve.hh"
#include "ED_screen.hh"
#include "ED_text.hh"
#include "UI_interface.hh"
#include "UI_resources.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "text_format.hh"
#include "text_intern.hh"

Go to the source code of this file.

Classes

struct  TextScroll
 
struct  SetSelection
 

Functions

Utilities
static void test_line_start (char c, bool *r_last_state)
 
static char text_closing_character_pair_get (const char character)
 
static bool text_span_is_blank (TextLine *line1, const int line1_char, TextLine *line2, const int line2_char)
 
static char * buf_tabs_to_spaces (const char *in_buf, const int tab_size, int *r_out_buf_len)
 
BLI_INLINE int space_text_pixel_x_to_column (const SpaceText *st, const int x)
 
static void text_select_update_primary_clipboard (const Text *text)
 
Operator Poll
static bool text_new_poll (bContext *)
 
static bool text_data_poll (bContext *C)
 
static bool text_edit_poll (bContext *C)
 
bool text_space_edit_poll (bContext *C)
 
static bool text_region_edit_poll (bContext *C)
 
Updates
void text_update_line_edited (TextLine *line)
 
void text_update_edited (Text *text)
 
New Operator
static int text_new_exec (bContext *C, wmOperator *)
 
void TEXT_OT_new (wmOperatorType *ot)
 
Open Operator
static void text_open_init (bContext *C, wmOperator *op)
 
static void text_open_cancel (bContext *, wmOperator *op)
 
static int text_open_exec (bContext *C, wmOperator *op)
 
static int text_open_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
void TEXT_OT_open (wmOperatorType *ot)
 
Reload Operator
static int text_reload_exec (bContext *C, wmOperator *op)
 
static int text_reload_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
void TEXT_OT_reload (wmOperatorType *ot)
 
Make Internal Operator
static int text_make_internal_exec (bContext *C, wmOperator *)
 
void TEXT_OT_make_internal (wmOperatorType *ot)
 
Save Operator
static void txt_write_file (Main *bmain, Text *text, ReportList *reports)
 
static int text_save_exec (bContext *C, wmOperator *op)
 
static int text_save_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void TEXT_OT_save (wmOperatorType *ot)
 
Save As Operator
static int text_save_as_exec (bContext *C, wmOperator *op)
 
static int text_save_as_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
void TEXT_OT_save_as (wmOperatorType *ot)
 
Run Script Operator
static int text_run_script (bContext *C, ReportList *reports)
 
static int text_run_script_exec (bContext *C, wmOperator *op)
 
void TEXT_OT_run_script (wmOperatorType *ot)
 
Refresh Pyconstraints Operator
static int text_refresh_pyconstraints_exec (bContext *, wmOperator *)
 
void TEXT_OT_refresh_pyconstraints (wmOperatorType *ot)
 
Paste Operator
static int text_paste_exec (bContext *C, wmOperator *op)
 
void TEXT_OT_paste (wmOperatorType *ot)
 
Duplicate Operator
static int text_duplicate_line_exec (bContext *C, wmOperator *)
 
void TEXT_OT_duplicate_line (wmOperatorType *ot)
 
Copy Operator
static void txt_copy_clipboard (const Text *text)
 
static int text_copy_exec (bContext *C, wmOperator *)
 
void TEXT_OT_copy (wmOperatorType *ot)
 
Cut Operator
static int text_cut_exec (bContext *C, wmOperator *)
 
void TEXT_OT_cut (wmOperatorType *ot)
 
Indent or Autocomplete Operator
static int text_indent_or_autocomplete_exec (bContext *C, wmOperator *)
 
void TEXT_OT_indent_or_autocomplete (wmOperatorType *ot)
 
Indent Operator
static int text_indent_exec (bContext *C, wmOperator *)
 
void TEXT_OT_indent (wmOperatorType *ot)
 
Unindent Operator
static int text_unindent_exec (bContext *C, wmOperator *)
 
void TEXT_OT_unindent (wmOperatorType *ot)
 
Line Break Operator
static int text_line_break_exec (bContext *C, wmOperator *)
 
void TEXT_OT_line_break (wmOperatorType *ot)
 
Toggle-Comment Operator
static int text_comment_exec (bContext *C, wmOperator *op)
 
void TEXT_OT_comment_toggle (wmOperatorType *ot)
 
Select All Operator
static int text_select_all_exec (bContext *C, wmOperator *)
 
void TEXT_OT_select_all (wmOperatorType *ot)
 
Select Line Operator
static int text_select_line_exec (bContext *C, wmOperator *)
 
void TEXT_OT_select_line (wmOperatorType *ot)
 
Select Word Operator
static int text_select_word_exec (bContext *C, wmOperator *)
 
void TEXT_OT_select_word (wmOperatorType *ot)
 
Move Lines Operators
static int move_lines_exec (bContext *C, wmOperator *op)
 
void TEXT_OT_move_lines (wmOperatorType *ot)
 
Move Select Operator
static int text_move_select_exec (bContext *C, wmOperator *op)
 
void TEXT_OT_move_select (wmOperatorType *ot)
 
Jump Operator
static int text_jump_exec (bContext *C, wmOperator *op)
 
static int text_jump_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
void TEXT_OT_jump (wmOperatorType *ot)
 
Toggle Overwrite Operator
static int text_toggle_overwrite_exec (bContext *C, wmOperator *)
 
void TEXT_OT_overwrite_toggle (wmOperatorType *ot)
 
Scroll Bar Operator
static bool text_region_scroll_poll (bContext *C)
 
static int text_scroll_bar_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void TEXT_OT_scroll_bar (wmOperatorType *ot)
 
Set Selection Operator
static int flatten_width (SpaceText *st, const char *str)
 
static int flatten_column_to_offset (SpaceText *st, const char *str, int index)
 
static TextLinespace_text_get_line_pos_wrapped (const SpaceText *st, const ARegion *region, int *y)
 
static void space_text_cursor_set_to_pos_wrapped (const SpaceText *st, const ARegion *region, int x, int y, const bool sel)
 
static void text_cursor_set_to_pos (SpaceText *st, const ARegion *region, int x, int y, const bool sel)
 
static void text_cursor_timer_ensure (bContext *C, SetSelection *ssel)
 
static void text_cursor_timer_remove (bContext *C, SetSelection *ssel)
 
static void text_cursor_set_apply (bContext *C, wmOperator *op, const wmEvent *event)
 
static void text_cursor_set_exit (bContext *C, wmOperator *op)
 
static int text_selection_set_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int text_selection_set_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
static void text_selection_set_cancel (bContext *C, wmOperator *op)
 
void TEXT_OT_selection_set (wmOperatorType *ot)
 
Set Cursor Operator
static int text_cursor_set_exec (bContext *C, wmOperator *op)
 
static int text_cursor_set_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void TEXT_OT_cursor_set (wmOperatorType *ot)
 
Line Number Operator
static int text_line_number_invoke (bContext *C, wmOperator *, const wmEvent *event)
 
void TEXT_OT_line_number (wmOperatorType *ot)
 
Insert Operator
static int text_insert_exec (bContext *C, wmOperator *op)
 
static int text_insert_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void TEXT_OT_insert (wmOperatorType *ot)
 
Replace Operator
static int text_replace_all (bContext *C)
 
static int text_replace_exec (bContext *C, wmOperator *op)
 
void TEXT_OT_replace (wmOperatorType *ot)
 
Find Set Selected
static int text_find_set_selected_exec (bContext *C, wmOperator *op)
 
void TEXT_OT_find_set_selected (wmOperatorType *ot)
 
Replace Set Selected
static int text_replace_set_selected_exec (bContext *C, wmOperator *)
 
void TEXT_OT_replace_set_selected (wmOperatorType *ot)
 
Jump to File at Point
static bool text_jump_to_file_at_point_external (bContext *C, ReportList *reports, const char *filepath, const int line_index, const int column_index)
 
static bool text_jump_to_file_at_point_internal (bContext *C, ReportList *reports, const char *filepath, const int line_index, const int column_index)
 
static int text_jump_to_file_at_point_exec (bContext *C, wmOperator *op)
 
void TEXT_OT_jump_to_file_at_point (wmOperatorType *ot)
 
To 3D Object Operator
static int text_to_3d_object_exec (bContext *C, wmOperator *op)
 
void TEXT_OT_to_3d_object (wmOperatorType *ot)
 

Convert Whitespace Operator

enum  { TO_SPACES , TO_TABS }
 
static const EnumPropertyItem whitespace_type_items []
 
static int text_convert_whitespace_exec (bContext *C, wmOperator *op)
 
void TEXT_OT_convert_whitespace (wmOperatorType *ot)
 

Scroll Operator

enum  eScrollZone { SCROLLHANDLE_INVALID_OUTSIDE = -1 , SCROLLHANDLE_BAR , SCROLLHANDLE_MIN_OUTSIDE , SCROLLHANDLE_MAX_OUTSIDE }
 
static void space_text_screen_clamp (SpaceText *st, const ARegion *region)
 
static void space_text_screen_skip (SpaceText *st, ARegion *region, int lines)
 
static void text_scroll_state_init (TextScroll *tsc, SpaceText *st, ARegion *region)
 
static bool text_scroll_poll (bContext *C)
 
static int text_scroll_exec (bContext *C, wmOperator *op)
 
static void text_scroll_apply (bContext *C, wmOperator *op, const wmEvent *event)
 
static void scroll_exit (bContext *C, wmOperator *op)
 
static int text_scroll_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
static void text_scroll_cancel (bContext *C, wmOperator *op)
 
static int text_scroll_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void TEXT_OT_scroll (wmOperatorType *ot)
 

Find Operator

enum  { TEXT_FIND = 0 , TEXT_REPLACE = 1 }
 
static int text_find_and_replace (bContext *C, wmOperator *op, short mode)
 
static int text_find_exec (bContext *C, wmOperator *op)
 
void TEXT_OT_find (wmOperatorType *ot)
 

Resolve Conflict Operator

enum  { RESOLVE_IGNORE , RESOLVE_RELOAD , RESOLVE_SAVE , RESOLVE_MAKE_INTERNAL }
 
static const EnumPropertyItem resolution_items []
 
static bool text_resolve_conflict_poll (bContext *C)
 
static int text_resolve_conflict_exec (bContext *C, wmOperator *op)
 
static int text_resolve_conflict_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
void TEXT_OT_resolve_conflict (wmOperatorType *ot)
 

Move Operator

static const EnumPropertyItem move_type_items []
 
static int space_text_get_cursor_rel (const SpaceText *st, const ARegion *region, TextLine *linein, int rell, int relc)
 
static int cursor_skip_find_line (const SpaceText *st, const ARegion *region, int lines, TextLine **linep, int *charp, int *rell, int *relc)
 
static void txt_wrap_move_bol (SpaceText *st, ARegion *region, const bool sel)
 
static void txt_wrap_move_eol (SpaceText *st, ARegion *region, const bool sel)
 
static void txt_wrap_move_up (SpaceText *st, ARegion *region, const bool sel)
 
static void txt_wrap_move_down (SpaceText *st, ARegion *region, const bool sel)
 
static void space_text_cursor_skip (const SpaceText *st, const ARegion *region, Text *text, int lines, const bool sel)
 
static int text_move_cursor (bContext *C, int type, bool select)
 
static int text_move_exec (bContext *C, wmOperator *op)
 
void TEXT_OT_move (wmOperatorType *ot)
 

Delete Operator

static const EnumPropertyItem delete_type_items []
 
static bool text_unlink_poll (bContext *C)
 
static int text_unlink_exec (bContext *C, wmOperator *)
 
static int text_unlink_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
void TEXT_OT_unlink (wmOperatorType *ot)
 
static int text_delete_exec (bContext *C, wmOperator *op)
 
void TEXT_OT_delete (wmOperatorType *ot)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
TO_SPACES 
TO_TABS 

Definition at line 1441 of file text_ops.cc.

◆ anonymous enum

anonymous enum
Enumerator
TEXT_FIND 
TEXT_REPLACE 

Definition at line 3776 of file text_ops.cc.

◆ anonymous enum

anonymous enum
Enumerator
RESOLVE_IGNORE 
RESOLVE_RELOAD 
RESOLVE_SAVE 
RESOLVE_MAKE_INTERNAL 

Definition at line 4177 of file text_ops.cc.

◆ eScrollZone

Enumerator
SCROLLHANDLE_INVALID_OUTSIDE 
SCROLLHANDLE_BAR 
SCROLLHANDLE_MIN_OUTSIDE 
SCROLLHANDLE_MAX_OUTSIDE 

Definition at line 2689 of file text_ops.cc.

Function Documentation

◆ buf_tabs_to_spaces()

static char * buf_tabs_to_spaces ( const char * in_buf,
const int tab_size,
int * r_out_buf_len )
static

This function converts the indentation tabs from a buffer to spaces.

Parameters
in_bufA pointer to a cstring.
tab_sizeThe size, in spaces, of the tab character.
r_out_buf_lenThe #strlen of the returned buffer.

Definition at line 152 of file text_ops.cc.

References MEM_mallocN, and test_line_start().

Referenced by text_paste_exec().

◆ cursor_skip_find_line()

static int cursor_skip_find_line ( const SpaceText * st,
const ARegion * region,
int lines,
TextLine ** linep,
int * charp,
int * rell,
int * relc )
static

◆ flatten_column_to_offset()

static int flatten_column_to_offset ( SpaceText * st,
const char * str,
int index )
static

◆ flatten_width()

static int flatten_width ( SpaceText * st,
const char * str )
static

◆ move_lines_exec()

◆ scroll_exit()

◆ space_text_cursor_set_to_pos_wrapped()

static void space_text_cursor_set_to_pos_wrapped ( const SpaceText * st,
const ARegion * region,
int x,
int y,
const bool sel )
static

◆ space_text_cursor_skip()

static void space_text_cursor_skip ( const SpaceText * st,
const ARegion * region,
Text * text,
int lines,
const bool sel )
static

Moves the cursor vertically by the specified number of lines. If the destination line is shorter than the current cursor position, the cursor will be positioned at the end of this line.

This is to replace screen_skip for PageUp/Down operations.

Definition at line 2226 of file text_ops.cc.

References cursor_skip_find_line(), TextLine::len, TextLine::next, TextLine::prev, space_text_get_cursor_rel(), txt_pop_sel(), and SpaceText::wordwrap.

Referenced by text_move_cursor().

◆ space_text_get_cursor_rel()

static int space_text_get_cursor_rel ( const SpaceText * st,
const ARegion * region,
TextLine * linein,
int rell,
int relc )
static

Get cursor position in line by relative wrapped line and column positions.

Definition at line 1779 of file text_ops.cc.

References BLI_str_utf8_char_width_safe(), BLI_str_utf8_size_safe(), ELEM, TextLine::len, TextLine::line, max, space_text_wrap_width(), and SpaceText::tabnumber.

Referenced by space_text_cursor_skip(), txt_wrap_move_down(), and txt_wrap_move_up().

◆ space_text_get_line_pos_wrapped()

static TextLine * space_text_get_line_pos_wrapped ( const SpaceText * st,
const ARegion * region,
int * y )
static

◆ space_text_pixel_x_to_column()

BLI_INLINE int space_text_pixel_x_to_column ( const SpaceText * st,
const int x )

Definition at line 206 of file text_ops.cc.

References SpaceText::runtime.

Referenced by text_cursor_set_to_pos().

◆ space_text_screen_clamp()

static void space_text_screen_clamp ( SpaceText * st,
const ARegion * region )
static

◆ space_text_screen_skip()

static void space_text_screen_skip ( SpaceText * st,
ARegion * region,
int lines )
static

Definition at line 2682 of file text_ops.cc.

References space_text_screen_clamp(), and SpaceText::top.

Referenced by text_scroll_exec(), and text_scroll_modal().

◆ test_line_start()

static void test_line_start ( char c,
bool * r_last_state )
static

Tests if the given character represents a start of a new line or the indentation part of a line.

Parameters
cThe current character.
r_last_stateA pointer to a flag representing the last state. The flag may be modified.

Definition at line 66 of file text_ops.cc.

References ELEM.

Referenced by buf_tabs_to_spaces().

◆ text_closing_character_pair_get()

static char text_closing_character_pair_get ( const char character)
static

This function receives a character and returns its closing pair if it exists.

Parameters
characterCharacter to find the closing pair.
Returns
The closing pair of the character if it exists.

Definition at line 81 of file text_ops.cc.

Referenced by text_delete_exec(), and text_insert_invoke().

◆ text_comment_exec()

◆ text_convert_whitespace_exec()

◆ text_copy_exec()

static int text_copy_exec ( bContext * C,
wmOperator *  )
static

Definition at line 1122 of file text_ops.cc.

References CTX_data_edit_text(), OPERATOR_FINISHED, and txt_copy_clipboard().

Referenced by TEXT_OT_copy().

◆ text_cursor_set_apply()

◆ text_cursor_set_exec()

◆ text_cursor_set_exit()

◆ text_cursor_set_invoke()

static int text_cursor_set_invoke ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

◆ text_cursor_set_to_pos()

◆ text_cursor_timer_ensure()

static void text_cursor_timer_ensure ( bContext * C,
SetSelection * ssel )
static

◆ text_cursor_timer_remove()

static void text_cursor_timer_remove ( bContext * C,
SetSelection * ssel )
static

◆ text_cut_exec()

◆ text_data_poll()

static bool text_data_poll ( bContext * C)
static

Definition at line 239 of file text_ops.cc.

References CTX_data_edit_text().

Referenced by TEXT_OT_run_script(), and TEXT_OT_to_3d_object().

◆ text_delete_exec()

◆ text_duplicate_line_exec()

◆ text_edit_poll()

◆ text_find_and_replace()

◆ text_find_exec()

static int text_find_exec ( bContext * C,
wmOperator * op )
static

Definition at line 3852 of file text_ops.cc.

References TEXT_FIND, and text_find_and_replace().

Referenced by TEXT_OT_find().

◆ text_find_set_selected_exec()

static int text_find_set_selected_exec ( bContext * C,
wmOperator * op )
static

◆ text_indent_exec()

◆ text_indent_or_autocomplete_exec()

static int text_indent_or_autocomplete_exec ( bContext * C,
wmOperator *  )
static

◆ text_insert_exec()

◆ text_insert_invoke()

◆ text_jump_exec()

◆ text_jump_invoke()

static int text_jump_invoke ( bContext * C,
wmOperator * op,
const wmEvent *  )
static

Definition at line 2479 of file text_ops.cc.

References IFACE_, and WM_operator_props_dialog_popup().

Referenced by TEXT_OT_jump().

◆ text_jump_to_file_at_point_exec()

◆ text_jump_to_file_at_point_external()

static bool text_jump_to_file_at_point_external ( bContext * C,
ReportList * reports,
const char * filepath,
const int line_index,
const int column_index )
static

◆ text_jump_to_file_at_point_internal()

static bool text_jump_to_file_at_point_internal ( bContext * C,
ReportList * reports,
const char * filepath,
const int line_index,
const int column_index )
static

◆ text_line_break_exec()

◆ text_line_number_invoke()

◆ text_make_internal_exec()

◆ text_move_cursor()

◆ text_move_exec()

static int text_move_exec ( bContext * C,
wmOperator * op )
static

Definition at line 2394 of file text_ops.cc.

References wmOperator::ptr, RNA_enum_get(), and text_move_cursor().

Referenced by TEXT_OT_move().

◆ text_move_select_exec()

static int text_move_select_exec ( bContext * C,
wmOperator * op )
static

Definition at line 2422 of file text_ops.cc.

References wmOperator::ptr, RNA_enum_get(), and text_move_cursor().

Referenced by TEXT_OT_move_select().

◆ text_new_exec()

◆ text_new_poll()

static bool text_new_poll ( bContext * )
static

Definition at line 234 of file text_ops.cc.

Referenced by TEXT_OT_new(), and TEXT_OT_open().

◆ text_open_cancel()

static void text_open_cancel ( bContext * ,
wmOperator * op )
static

Definition at line 394 of file text_ops.cc.

References wmOperator::customdata, and MEM_freeN().

Referenced by TEXT_OT_open().

◆ text_open_exec()

◆ text_open_init()

static void text_open_init ( bContext * C,
wmOperator * op )
static

◆ text_open_invoke()

◆ TEXT_OT_comment_toggle()

◆ TEXT_OT_convert_whitespace()

◆ TEXT_OT_copy()

◆ TEXT_OT_cursor_set()

◆ TEXT_OT_cut()

◆ TEXT_OT_delete()

◆ TEXT_OT_duplicate_line()

◆ TEXT_OT_find()

◆ TEXT_OT_find_set_selected()

◆ TEXT_OT_indent()

◆ TEXT_OT_indent_or_autocomplete()

◆ TEXT_OT_insert()

◆ TEXT_OT_jump()

◆ TEXT_OT_jump_to_file_at_point()

◆ TEXT_OT_line_break()

◆ TEXT_OT_line_number()

◆ TEXT_OT_make_internal()

◆ TEXT_OT_move()

◆ TEXT_OT_move_lines()

◆ TEXT_OT_move_select()

◆ TEXT_OT_new()

◆ TEXT_OT_open()

◆ TEXT_OT_overwrite_toggle()

◆ TEXT_OT_paste()

◆ TEXT_OT_refresh_pyconstraints()

◆ TEXT_OT_reload()

◆ TEXT_OT_replace()

◆ TEXT_OT_replace_set_selected()

◆ TEXT_OT_resolve_conflict()

◆ TEXT_OT_run_script()

◆ TEXT_OT_save()

◆ TEXT_OT_save_as()

◆ TEXT_OT_scroll()

◆ TEXT_OT_scroll_bar()

◆ TEXT_OT_select_all()

◆ TEXT_OT_select_line()

◆ TEXT_OT_select_word()

◆ TEXT_OT_selection_set()

◆ TEXT_OT_to_3d_object()

◆ TEXT_OT_unindent()

◆ TEXT_OT_unlink()

◆ text_paste_exec()

◆ text_refresh_pyconstraints_exec()

◆ text_region_edit_poll()

static bool text_region_edit_poll ( bContext * C)
static

◆ text_region_scroll_poll()

static bool text_region_scroll_poll ( bContext * C)
static

Definition at line 2968 of file text_ops.cc.

References CTX_data_edit_text(), CTX_wm_region(), CTX_wm_space_text(), and RGN_TYPE_WINDOW.

Referenced by TEXT_OT_scroll_bar().

◆ text_reload_exec()

◆ text_reload_invoke()

static int text_reload_invoke ( bContext * C,
wmOperator * op,
const wmEvent *  )
static

Definition at line 543 of file text_ops.cc.

References ALERT_ICON_NONE, IFACE_, and WM_operator_confirm_ex().

Referenced by TEXT_OT_reload().

◆ text_replace_all()

◆ text_replace_exec()

static int text_replace_exec ( bContext * C,
wmOperator * op )
static

◆ text_replace_set_selected_exec()

static int text_replace_set_selected_exec ( bContext * C,
wmOperator *  )
static

◆ text_resolve_conflict_exec()

◆ text_resolve_conflict_invoke()

◆ text_resolve_conflict_poll()

static bool text_resolve_conflict_poll ( bContext * C)
static

Definition at line 4186 of file text_ops.cc.

References CTX_data_edit_text(), text_edit_poll(), and TXT_ISMEM.

Referenced by TEXT_OT_resolve_conflict().

◆ text_run_script()

◆ text_run_script_exec()

static int text_run_script_exec ( bContext * C,
wmOperator * op )
static

◆ text_save_as_exec()

◆ text_save_as_invoke()

◆ text_save_exec()

◆ text_save_invoke()

static int text_save_invoke ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

◆ text_scroll_apply()

◆ text_scroll_bar_invoke()

◆ text_scroll_cancel()

static void text_scroll_cancel ( bContext * C,
wmOperator * op )
static

Definition at line 2892 of file text_ops.cc.

References scroll_exit().

Referenced by TEXT_OT_scroll(), and TEXT_OT_scroll_bar().

◆ text_scroll_exec()

◆ text_scroll_invoke()

◆ text_scroll_modal()

◆ text_scroll_poll()

static bool text_scroll_poll ( bContext * C)
static

Definition at line 2728 of file text_ops.cc.

References CTX_data_edit_text().

Referenced by TEXT_OT_scroll().

◆ text_scroll_state_init()

◆ text_select_all_exec()

◆ text_select_line_exec()

◆ text_select_update_primary_clipboard()

◆ text_select_word_exec()

◆ text_selection_set_cancel()

static void text_selection_set_cancel ( bContext * C,
wmOperator * op )
static

Definition at line 3440 of file text_ops.cc.

References text_cursor_set_exit().

Referenced by TEXT_OT_selection_set().

◆ text_selection_set_invoke()

◆ text_selection_set_modal()

static int text_selection_set_modal ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

◆ text_space_edit_poll()

◆ text_span_is_blank()

static bool text_span_is_blank ( TextLine * line1,
const int line1_char,
TextLine * line2,
const int line2_char )
static

This function receives a range and returns true if the range is blank.

Parameters
line1The first TextLine argument.
line1_charThe character number of line1.
line2The second TextLine argument.
line2_charThe character number of line2.
Returns
True if the span is blank.

Definition at line 108 of file text_ops.cc.

References ELEM, TextLine::next, and txt_get_span().

Referenced by text_insert_invoke().

◆ text_to_3d_object_exec()

static int text_to_3d_object_exec ( bContext * C,
wmOperator * op )
static

◆ text_toggle_overwrite_exec()

static int text_toggle_overwrite_exec ( bContext * C,
wmOperator *  )
static

◆ text_unindent_exec()

◆ text_unlink_exec()

◆ text_unlink_invoke()

static int text_unlink_invoke ( bContext * C,
wmOperator * op,
const wmEvent *  )
static

Definition at line 605 of file text_ops.cc.

References ALERT_ICON_NONE, IFACE_, and WM_operator_confirm_ex().

Referenced by TEXT_OT_unlink().

◆ text_unlink_poll()

static bool text_unlink_poll ( bContext * C)
static

Definition at line 573 of file text_ops.cc.

References CTX_data_edit_text().

Referenced by TEXT_OT_unlink().

◆ text_update_edited()

◆ text_update_line_edited()

◆ txt_copy_clipboard()

static void txt_copy_clipboard ( const Text * text)
static

Definition at line 1106 of file text_ops.cc.

References MEM_freeN(), txt_has_sel(), txt_sel_to_buf(), and WM_clipboard_text_set().

Referenced by text_copy_exec(), and text_cut_exec().

◆ txt_wrap_move_bol()

◆ txt_wrap_move_down()

◆ txt_wrap_move_eol()

◆ txt_wrap_move_up()

◆ txt_write_file()

static void txt_write_file ( Main * bmain,
Text * text,
ReportList * reports )
static

Variable Documentation

◆ delete_type_items

const EnumPropertyItem delete_type_items[]
static
Initial value:
= {
{DEL_NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
{DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
{DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
{DEL_PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
{0, nullptr, 0, nullptr, nullptr},
}
@ DEL_PREV_WORD
@ DEL_PREV_CHAR
@ DEL_NEXT_WORD
@ DEL_NEXT_CHAR

Definition at line 2508 of file text_ops.cc.

Referenced by TEXT_OT_delete().

◆ move_type_items

const EnumPropertyItem move_type_items[]
static
Initial value:
= {
{LINE_BEGIN, "LINE_BEGIN", 0, "Line Begin", ""},
{LINE_END, "LINE_END", 0, "Line End", ""},
{FILE_TOP, "FILE_TOP", 0, "File Top", ""},
{FILE_BOTTOM, "FILE_BOTTOM", 0, "File Bottom", ""},
{PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
{NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
{PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
{NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
{PREV_LINE, "PREVIOUS_LINE", 0, "Previous Line", ""},
{NEXT_LINE, "NEXT_LINE", 0, "Next Line", ""},
{PREV_PAGE, "PREVIOUS_PAGE", 0, "Previous Page", ""},
{NEXT_PAGE, "NEXT_PAGE", 0, "Next Page", ""},
{0, nullptr, 0, nullptr, nullptr},
}
#define NEXT_CHAR(fmt)
@ NEXT_LINE
@ LINE_BEGIN
@ PREV_WORD
@ PREV_LINE
@ PREV_CHAR
@ LINE_END
@ PREV_PAGE
@ NEXT_PAGE
@ NEXT_WORD
@ FILE_TOP
@ FILE_BOTTOM

Definition at line 1760 of file text_ops.cc.

Referenced by TEXT_OT_move(), and TEXT_OT_move_select().

◆ resolution_items

const EnumPropertyItem resolution_items[]
static
Initial value:
= {
{RESOLVE_IGNORE, "IGNORE", 0, "Ignore", ""},
{RESOLVE_RELOAD, "RELOAD", 0, "Reload", ""},
{RESOLVE_SAVE, "SAVE", 0, "Save", ""},
{RESOLVE_MAKE_INTERNAL, "MAKE_INTERNAL", 0, "Make Internal", ""},
{0, nullptr, 0, nullptr, nullptr},
}
@ RESOLVE_SAVE
Definition text_ops.cc:4177
@ RESOLVE_MAKE_INTERNAL
Definition text_ops.cc:4177
@ RESOLVE_RELOAD
Definition text_ops.cc:4177
@ RESOLVE_IGNORE
Definition text_ops.cc:4177

Definition at line 4178 of file text_ops.cc.

Referenced by TEXT_OT_resolve_conflict().

◆ whitespace_type_items

const EnumPropertyItem whitespace_type_items[]
static
Initial value:
= {
{TO_SPACES, "SPACES", 0, "To Spaces", nullptr},
{TO_TABS, "TABS", 0, "To Tabs", nullptr},
{0, nullptr, 0, nullptr, nullptr},
}
@ TO_SPACES
Definition text_ops.cc:1441
@ TO_TABS
Definition text_ops.cc:1441

Definition at line 1442 of file text_ops.cc.

Referenced by TEXT_OT_convert_whitespace().