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:
authorCampbell Barton <ideasman42@gmail.com>2010-10-04 16:02:18 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-04 16:02:18 +0400
commitc76d339b6cb121e3dc31dc7f032e8a0cb3ad9e90 (patch)
tree39a8541144e5b92a044717c087231ade9b012072 /source/blender/editors/space_console/console_draw.c
parente568ea668e80578d6f98feb7ab16a0916220a248 (diff)
fix for copy in the console (wasnt taking the prompt into account)
Diffstat (limited to 'source/blender/editors/space_console/console_draw.c')
-rw-r--r--source/blender/editors/space_console/console_draw.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index d1fa4e17e6f..d5ffb34b3a2 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -286,6 +286,24 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len,
#undef STEP_SEL
}
+void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_dummy)
+{
+ /* fake the edit line being in the scroll buffer */
+ ConsoleLine *cl= sc->history.last;
+ cl_dummy->type= CONSOLE_LINE_INPUT;
+ cl_dummy->len= cl_dummy->len_alloc= strlen(sc->prompt) + cl->len;
+ cl_dummy->len_alloc= cl_dummy->len + 1;
+ cl_dummy->line= MEM_mallocN(cl_dummy->len_alloc, "cl_dummy");
+ memcpy(cl_dummy->line, sc->prompt, (cl_dummy->len_alloc - cl->len));
+ memcpy(cl_dummy->line + ((cl_dummy->len_alloc - cl->len)) - 1, cl->line, cl->len + 1);
+ BLI_addtail(&sc->scrollback, cl_dummy);
+}
+void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dummy)
+{
+ MEM_freeN(cl_dummy->line);
+ BLI_remlink(&sc->scrollback, cl_dummy);
+}
+
#define CONSOLE_DRAW_MARGIN 4
#define CONSOLE_DRAW_SCROLL 16
@@ -349,15 +367,7 @@ static int console_text_main__internal(struct SpaceConsole *sc, struct ARegion *
xy[0]= x_orig; /* remove prompt offset */
}
- /* fake the edit line being in the scroll buffer */
- cl_dummy.type= CONSOLE_LINE_INPUT;
- cl_dummy.len= cl_dummy.len_alloc= prompt_len + cl->len;
- cl_dummy.len_alloc= cl_dummy.len + 1;
- cl_dummy.line= MEM_mallocN(cl_dummy.len_alloc, "cl_dummy");
- memcpy(cl_dummy.line, sc->prompt, (cl_dummy.len_alloc - cl->len));
- memcpy(cl_dummy.line + ((cl_dummy.len_alloc - cl->len)) - 1, cl->line, cl->len + 1);
- BLI_addtail(&sc->scrollback, &cl_dummy);
-
+ console_scrollback_prompt_begin(sc, &cl_dummy);
for(cl= sc->scrollback.last; cl; cl= cl->prev) {
y_prev= xy[1];
@@ -378,9 +388,7 @@ static int console_text_main__internal(struct SpaceConsole *sc, struct ARegion *
}
}
- /* temp line end */
- MEM_freeN(cl_dummy.line);
- BLI_remlink(&sc->scrollback, &cl_dummy);
+ console_scrollback_prompt_end(sc, &cl_dummy);
}
else {
Report *report;