diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2019-08-13 16:35:48 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2019-08-14 17:59:37 +0300 |
commit | 05417b22206c479b5ebe8ac8e7dd73ae154c8c96 (patch) | |
tree | aa11344ee7e5fa0bf8c95ce380e347d11a3df16f /source/blender/blenlib/intern/string_utils.c | |
parent | 72eb70f93328e4e19a319aa199f6c46a0c8ab420 (diff) |
Text editor: syntax highlighting + line numbers on by default
The most common use of the text editor seems to be for scripting. Having
line numbers and syntax highlighting enabled by default seems sensible.
Syntax highlighting is now enabled by default, but is automatically
disabled when the datablock has a non-highlighted extension.
Highlighting is enabled for filenames like:
- Text
- Text.001
- somefile.py
and is automatically disabled when the datablock has an extension for
which Blender has no syntax highlighter registered.
Reviewers: billreynish, campbellbarton
Subscribers: brecht, billreynish
Differential Revision: https://developer.blender.org/D5472
Diffstat (limited to 'source/blender/blenlib/intern/string_utils.c')
-rw-r--r-- | source/blender/blenlib/intern/string_utils.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/string_utils.c b/source/blender/blenlib/intern/string_utils.c index f2b3ef2ad87..b956e1c0a7e 100644 --- a/source/blender/blenlib/intern/string_utils.c +++ b/source/blender/blenlib/intern/string_utils.c @@ -82,6 +82,21 @@ size_t BLI_split_name_num(char *left, int *nr, const char *name, const char deli return name_len; } +bool BLI_string_is_decimal(const char *string) +{ + if (*string == '\0') { + return false; + } + + /* Keep iterating over the string until a non-digit is found. */ + while (isdigit(*string)) { + string++; + } + + /* If the non-digit we found is the terminating \0, everything was digits. */ + return *string == '\0'; +} + static bool is_char_sep(const char c) { return ELEM(c, '.', ' ', '-', '_'); |