To: vim_dev@googlegroups.com Subject: Patch 8.0.0349 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0349 Problem: Redrawing errors with GTK 3. Solution: When updating, first clear all rectangles and then draw them. (Kazunobu Kuriyama, Christian Ludwig, closes #848) Files: src/gui_gtk_x11.c *** ../vim-8.0.0348/src/gui_gtk_x11.c 2017-02-01 11:50:04.346268005 +0100 --- src/gui_gtk_x11.c 2017-02-23 12:17:58.934631926 +0100 *************** *** 630,635 **** --- 630,636 ---- static void gui_gtk3_redraw(int x, int y, int width, int height) { + /* Range checks are left to gui_redraw_block() */ gui_redraw_block(Y_2_ROW(y), X_2_COL(x), Y_2_ROW(y + height - 1), X_2_COL(x + width - 1), GUI_MON_NOCLEAR); *************** *** 684,695 **** if (list->status != CAIRO_STATUS_CLIP_NOT_REPRESENTABLE) { int i; for (i = 0; i < list->num_rectangles; i++) { const cairo_rectangle_t rect = list->rectangles[i]; ! gui_mch_clear_block(Y_2_ROW(rect.y), 1, ! Y_2_ROW(rect.y + rect.height - 1), Columns); if (blink_mode) gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height); --- 685,704 ---- if (list->status != CAIRO_STATUS_CLIP_NOT_REPRESENTABLE) { int i; + + /* First clear all the blocks and then redraw them. Just in case + * some blocks overlap. */ for (i = 0; i < list->num_rectangles; i++) { const cairo_rectangle_t rect = list->rectangles[i]; ! gui_mch_clear_block(Y_2_ROW((int)rect.y), 0, ! Y_2_ROW((int)(rect.y + rect.height)) - 1, Columns - 1); ! } ! ! for (i = 0; i < list->num_rectangles; i++) ! { ! const cairo_rectangle_t rect = list->rectangles[i]; if (blink_mode) gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height); *************** *** 6709,6716 **** * (row2, col2) inclusive. */ void ! gui_mch_clear_block(int row1, int col1, int row2, int col2) { #if GTK_CHECK_VERSION(3,0,0) if (gtk_widget_get_window(gui.drawarea) == NULL) return; --- 6718,6731 ---- * (row2, col2) inclusive. */ void ! gui_mch_clear_block(int row1arg, int col1arg, int row2arg, int col2arg) { + + int col1 = check_col(col1arg); + int col2 = check_col(col2arg); + int row1 = check_row(row1arg); + int row2 = check_row(row2arg); + #if GTK_CHECK_VERSION(3,0,0) if (gtk_widget_get_window(gui.drawarea) == NULL) return; *** ../vim-8.0.0348/src/version.c 2017-02-22 22:04:01.133026003 +0100 --- src/version.c 2017-02-23 12:14:07.620065351 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 349, /**/ -- Contrary to popular belief, it's often your clothing that gets promoted, not you. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///