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
path: root/source
diff options
context:
space:
mode:
authorSv. Lockal <lockalsash@gmail.com>2012-05-08 15:18:20 +0400
committerSv. Lockal <lockalsash@gmail.com>2012-05-08 15:18:20 +0400
commitba7d24559def198917b220618e2b914cbc5b84ed (patch)
tree52dbd1387d5f5795ccb726f77cc77800bc5bbe35 /source
parent7a4ad3aaaeee044c0768ce1206230a0dd723bb9e (diff)
fix for own mistake for ctrl+left/right movement and code cleanup for txt_jump_left/right
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/text.c52
1 files changed, 19 insertions, 33 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index e8010ceceff..7634528927a 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -956,60 +956,46 @@ void txt_move_right(Text *text, short sel)
void txt_jump_left(Text *text, short sel)
{
- TextLine **linep, *oldl;
- int *charp, oldc, oldflags;
- unsigned char oldu;
-
+ TextLine **linep;
+ int *charp, oldc;
+
if (!text) return;
if (sel) txt_curs_sel(text, &linep, &charp);
else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); }
if (!*linep) return;
-
- oldflags = text->flags;
- text->flags &= ~TXT_TABSTOSPACES;
-
- oldl = *linep;
oldc = *charp;
- oldu = undoing;
- undoing = 1; /* Don't push individual moves to undo stack */
BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
charp, STRCUR_DIR_PREV,
STRCUR_JUMP_DELIM);
-
- text->flags = oldflags;
-
- undoing = oldu;
- if (!undoing) txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, txt_get_span(text->lines.first, oldl), oldc, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
+
+ if (!sel) txt_pop_sel(text);
+ if (!undoing) {
+ int span = txt_get_span(text->lines.first, *linep);
+ txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, span, oldc, span, (unsigned short)*charp);
+ }
}
void txt_jump_right(Text *text, short sel)
{
- TextLine **linep, *oldl;
- int *charp, oldc, oldflags;
- unsigned char oldu;
-
+ TextLine **linep;
+ int *charp, oldc;
+
if (!text) return;
if (sel) txt_curs_sel(text, &linep, &charp);
else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); }
if (!*linep) return;
-
- oldflags = text->flags;
- text->flags &= ~TXT_TABSTOSPACES;
-
- oldl = *linep;
oldc = *charp;
- oldu = undoing;
- undoing = 1; /* Don't push individual moves to undo stack */
-
+
BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
charp, STRCUR_DIR_NEXT,
STRCUR_JUMP_DELIM);
-
- text->flags = oldflags;
-
- undoing = oldu;
- if (!undoing) txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, txt_get_span(text->lines.first, oldl), oldc, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
+
+ if (!sel) txt_pop_sel(text);
+ if (!undoing) {
+ int span = txt_get_span(text->lines.first, *linep);
+ txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, span, oldc, span, (unsigned short)*charp);
+ }
}
void txt_move_bol(Text *text, short sel)