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:
-rw-r--r--source/blender/editors/curve/editfont.c30
-rw-r--r--source/blender/makesdna/DNA_vfont_types.h3
2 files changed, 23 insertions, 10 deletions
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index bd13d383746..36e1210402d 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -247,8 +247,19 @@ static void text_update_edited(bContext *C, Object *obedit, int mode)
struct Main *bmain = CTX_data_main(C);
Curve *cu = obedit->data;
EditFont *ef = cu->editfont;
+
+ /* run update first since it can move the cursor */
+ if (mode == FO_EDIT) {
+ /* re-tesselllate */
+ DAG_id_tag_update(obedit->data, 0);
+ }
+ else {
+ /* depsgraph runs above, but since we're not tagging for update, call direct */
+ BKE_vfont_to_curve(bmain, obedit, mode);
+ }
+
cu->curinfo = ef->textbufinfo[ef->pos ? ef->pos - 1 : 0];
-
+
if (obedit->totcol > 0) {
obedit->actcol = cu->curinfo.mat_nr;
@@ -259,15 +270,6 @@ static void text_update_edited(bContext *C, Object *obedit, int mode)
}
}
- if (mode == FO_EDIT) {
- /* re-tesselllate */
- DAG_id_tag_update(obedit->data, 0);
- }
- else {
- /* depsgraph runs above, but since we're not tagging for update, call direct */
- BKE_vfont_to_curve(bmain, obedit, mode);
- }
-
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
@@ -1056,6 +1058,14 @@ static int move_cursor(bContext *C, int type, const bool select)
else if (ef->pos >= MAXTEXT) ef->pos = MAXTEXT;
else if (ef->pos < 0) ef->pos = 0;
+ /* apply virtical cursor motion to position immediately
+ * otherwise the selection will lag behind */
+ if (FO_CURS_IS_MOTION(cursmove)) {
+ struct Main *bmain = CTX_data_main(C);
+ BKE_vfont_to_curve(bmain, obedit, cursmove);
+ cursmove = FO_CURS;
+ }
+
if (select == 0) {
if (ef->selstart) {
struct Main *bmain = CTX_data_main(C);
diff --git a/source/blender/makesdna/DNA_vfont_types.h b/source/blender/makesdna/DNA_vfont_types.h
index 416c5f594a3..14ec6c9b312 100644
--- a/source/blender/makesdna/DNA_vfont_types.h
+++ b/source/blender/makesdna/DNA_vfont_types.h
@@ -65,6 +65,9 @@ typedef struct VFont {
#define FO_PAGEDOWN 9
#define FO_SELCHANGE 10
+/* BKE_vfont_to_curve will move the cursor in these cases */
+#define FO_CURS_IS_MOTION(mode) (ELEM4(mode, FO_CURSUP, FO_CURSDOWN, FO_PAGEUP, FO_PAGEDOWN))
+
#define FO_BUILTIN_NAME "<builtin>"
#endif /* __DNA_VFONT_TYPES_H__ */