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:
authorSv. Lockal <lockalsash@gmail.com>2012-01-16 20:23:25 +0400
committerSv. Lockal <lockalsash@gmail.com>2012-01-16 20:23:25 +0400
commitc150d0084f0e1cf86f063d993b31d02fc3e9c71f (patch)
tree851acfa580b5c463e6df632a77e30d4a47ea1dc1 /source/blender/blenloader
parentae9582836e047b1da87f8178e34ad63ed0b9824e (diff)
patch [#29859] UTF-8 support for text editor.
This also fixes cursor movement in the beginning of line and adds do_versions block for converting text files with old extended ascii encoding into UTF-8.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 0c05655b8d7..1aa71732697 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -135,6 +135,7 @@
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_sequencer.h"
+#include "BKE_text.h" // for txt_extended_ascii_as_utf8
#include "BKE_texture.h" // for open_plugin_tex
#include "BKE_tracking.h"
#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
@@ -12976,6 +12977,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* put compatibility code here until next subversion bump */
{
+ {
+ /* convert extended ascii to utf-8 for text editor */
+ Text *text;
+ for (text= main->text.first; text; text= text->id.next)
+ if(!(text->flags & TXT_ISEXT)) {
+ TextLine *tl;
+
+ for (tl= text->lines.first; tl; tl= tl->next) {
+ int added= txt_extended_ascii_as_utf8(&tl->line);
+ tl->len+= added;
+
+ /* reset cursor position if line was changed */
+ if (added && tl == text->curl)
+ text->curc = 0;
+ }
+ }
+ }
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */