[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46416] trunk/blender/source/blender/ blenkernel/intern/text.c: fix for own mistake for ctrl+left/ right movement and code cleanup for txt_jump_left/right

Sv. Lockal lockalsash at gmail.com
Tue May 8 13:18:20 CEST 2012


Revision: 46416
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46416
Author:   lockal
Date:     2012-05-08 11:18:20 +0000 (Tue, 08 May 2012)
Log Message:
-----------
fix for own mistake for ctrl+left/right movement and code cleanup for txt_jump_left/right

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/text.c

Modified: trunk/blender/source/blender/blenkernel/intern/text.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/text.c	2012-05-08 11:15:09 UTC (rev 46415)
+++ trunk/blender/source/blender/blenkernel/intern/text.c	2012-05-08 11:18:20 UTC (rev 46416)
@@ -956,60 +956,46 @@
 
 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)




More information about the Bf-blender-cvs mailing list