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>2020-02-14 05:38:47 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-02-14 05:45:45 +0300
commit69be8039e80f55760ddc652bf79240d9d5ab38bc (patch)
treefaf2fde1a824eb6ee8fe407eac4c508602c17b5d /source/blender/editors/space_info/info_draw.c
parent75a5ea01c19563ae1ba427e9206f2eae637d6070 (diff)
Fix T73784: Python console: incorrect wrapped line cursor position
Regression in aa919f3e82020 Remove character margins, it complicated drawing & picking to have one margin in pixels and a second margin in characters. Replace this with an outer pixel-margin for drawing background colors.
Diffstat (limited to 'source/blender/editors/space_info/info_draw.c')
-rw-r--r--source/blender/editors/space_info/info_draw.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 03ff680a93d..d0ff9495a74 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -206,12 +206,21 @@ static int report_textview_line_get(struct TextViewContext *tvc, const char **li
return 1;
}
-static void info_textview_draw_rect_calc(const ARegion *ar, rcti *draw_rect)
+static void info_textview_draw_rect_calc(const ARegion *ar,
+ rcti *r_draw_rect,
+ rcti *r_draw_rect_outer)
{
- draw_rect->xmin = 0;
- draw_rect->xmax = ar->winx;
- draw_rect->ymin = 0;
- draw_rect->ymax = ar->winy;
+ const int margin = 0.45f * U.widget_unit;
+ r_draw_rect->xmin = margin + UI_UNIT_X;
+ r_draw_rect->xmax = ar->winx - V2D_SCROLL_WIDTH;
+ r_draw_rect->ymin = margin;
+ r_draw_rect->ymax = ar->winy;
+ /* No margin at the top (allow text to scroll off the window). */
+
+ r_draw_rect_outer->xmin = 0;
+ r_draw_rect_outer->xmax = ar->winx;
+ r_draw_rect_outer->ymin = 0;
+ r_draw_rect_outer->ymax = ar->winy;
}
static int info_textview_main__internal(struct SpaceInfo *sinfo,
@@ -243,12 +252,10 @@ static int info_textview_main__internal(struct SpaceInfo *sinfo,
tvc.sel_end = 0;
tvc.lheight = 17 * UI_DPI_FAC;
tvc.row_vpadding = 0.4 * tvc.lheight;
- tvc.margin_left_chars = 5;
- tvc.margin_right_chars = 2;
tvc.scroll_ymin = v2d->cur.ymin;
tvc.scroll_ymax = v2d->cur.ymax;
- info_textview_draw_rect_calc(ar, &tvc.draw_rect);
+ info_textview_draw_rect_calc(ar, &tvc.draw_rect, &tvc.draw_rect_outer);
ret = textview_draw(&tvc, do_draw, mval, r_mval_pick_item, r_mval_pick_offset);