home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.1.093 < prev    next >
Encoding:
Internet Message Format  |  2002-06-08  |  7.4 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.093 (extra)
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.1.093 (extra)
  11. Problem:    Mac and MS-Windows GUI: when scrolling while ":s" is working the
  12.         results can be messed up, because the cursor is moved.
  13. Solution:   Disallow direct scrolling when not waiting for a character.
  14. Files:        src/gui_mac.c, src/gui_w16.c, src/gui_w32.c, src/gui_w48.c
  15.  
  16.  
  17. *** ../vim61.092/src/gui_mac.c    Fri May 17 19:29:08 2002
  18. --- src/gui_mac.c    Sun Jun  9 19:56:56 2002
  19. ***************
  20. *** 174,179 ****
  21. --- 174,186 ----
  22.   static short dragRectEnbl;
  23.   static short dragRectControl;
  24.   
  25. + /* This variable is set when waiting for an event, which is the only moment
  26. +  * scrollbar dragging can be done directly.  It's not allowed while commands
  27. +  * are executed, because it may move the cursor and that may cause unexpected
  28. +  * problems (e.g., while ":s" is working).
  29. +  */
  30. + static int allow_scrollbar = FALSE;
  31.   /* Last mouse click caused contextual menu, (to provide proper release) */
  32.   #ifdef USE_CTRLCLICKMENU
  33.   static short clickIsPopup;
  34. ***************
  35. *** 1499,1504 ****
  36. --- 1506,1512 ----
  37.       scrollbar_T        *sb;
  38.       int            value, dragging;
  39.       ControlHandle    theControlToUse;
  40. +     int            dont_scroll_save = dont_scroll;
  41.   
  42.       theControlToUse = dragged_sb;
  43.   
  44. ***************
  45. *** 1511,1517 ****
  46. --- 1519,1529 ----
  47.       value = GetControl32BitValue (theControlToUse);
  48.       dragging = TRUE;
  49.   
  50. +     /* When "allow_scrollbar" is FALSE still need to remember the new
  51. +      * position, but don't actually scroll by setting "dont_scroll". */
  52. +     dont_scroll = !allow_scrollbar;
  53.       gui_drag_scrollbar(sb, value, dragging);
  54. +     dont_scroll = dont_scroll_save;
  55.   }
  56.   
  57.       pascal
  58. ***************
  59. *** 1524,1529 ****
  60. --- 1536,1542 ----
  61.       long    value;
  62.       int        page;
  63.       int        dragging = FALSE;
  64. +     int        dont_scroll_save = dont_scroll;
  65.   
  66.       sb = gui_find_scrollbar((long) GetControlReference (theControl));
  67.   
  68. ***************
  69. *** 1565,1571 ****
  70. --- 1578,1588 ----
  71.       else if (value < 0)
  72.       value = 0;*/
  73.   
  74. +     /* When "allow_scrollbar" is FALSE still need to remember the new
  75. +      * position, but don't actually scroll by setting "dont_scroll". */
  76. +     dont_scroll = !allow_scrollbar;
  77.       gui_drag_scrollbar(sb, value, dragging);
  78. +     dont_scroll = dont_scroll_save;
  79.   
  80.       out_flush();
  81.       gui_mch_set_scrollbar_thumb(sb, value, sb_info->size, sb_info->max);
  82. ***************
  83. *** 3468,3473 ****
  84. --- 3485,3492 ----
  85.   
  86.       entryTick = TickCount();
  87.   
  88. +     allow_scrollbar = TRUE;
  89.       do
  90.       {
  91.   /*    if (dragRectControl == kCreateEmpty)
  92. ***************
  93. *** 3483,3493 ****
  94.       }
  95.       /*
  96.        * Don't use gui_mch_update() because then we will spin-lock until a
  97. !      * char arrives, instead we use XtAppProcessEvent() to hang until an
  98.        * event arrives.  No need to check for input_buf_full because we are
  99. !      * returning as soon as it contains a single char.  Note that
  100. !      * XtAppNextEvent() may not be used because it will not return after a
  101. !      * timer event has arrived -- webb
  102.        */
  103.       /* TODO: reduce wtime accordinly???  */
  104.       if (wtime > -1)
  105. --- 3502,3510 ----
  106.       }
  107.       /*
  108.        * Don't use gui_mch_update() because then we will spin-lock until a
  109. !      * char arrives, instead we use WaitNextEventWrp() to hang until an
  110.        * event arrives.  No need to check for input_buf_full because we are
  111. !      * returning as soon as it contains a single char.
  112.        */
  113.       /* TODO: reduce wtime accordinly???  */
  114.       if (wtime > -1)
  115. ***************
  116. *** 3501,3512 ****
  117. --- 3518,3533 ----
  118.   #endif
  119.           gui_mac_handle_event (&event);
  120.           if (!vim_is_input_buf_empty())
  121. +         {
  122. +         allow_scrollbar = FALSE;
  123.           return OK;
  124. +         }
  125.       }
  126.       currentTick = TickCount();
  127.       }
  128.       while ((wtime == -1) || ((currentTick - entryTick) < 60*wtime/1000));
  129.   
  130. +     allow_scrollbar = FALSE;
  131.       return FAIL;
  132.   }
  133.   
  134. *** ../vim61.092/src/gui_w16.c    Sat May  4 22:23:07 2002
  135. --- src/gui_w16.c    Sun Jun  9 20:02:03 2002
  136. ***************
  137. *** 81,87 ****
  138.   #endif
  139.   
  140.   
  141.   #ifdef FEAT_MENU
  142.   /*
  143.    * Figure out how high the menu bar is at the moment.
  144. --- 81,86 ----
  145. ***************
  146. *** 149,154 ****
  147. --- 148,154 ----
  148.       int        nPos;
  149.   #endif
  150.       static UINT    prev_code = 0;   /* code of previous call */
  151. +     int        dont_scroll_save = dont_scroll;
  152.   
  153.       sb = gui_mswin_find_scrollbar(hwndCtl);
  154.       if (sb == NULL)
  155. ***************
  156. *** 239,246 ****
  157. --- 239,252 ----
  158.   
  159.       /* Don't let us be interrupted here by another message. */
  160.       s_busy_processing = TRUE;
  161. +     /* When "allow_scrollbar" is FALSE still need to remember the new
  162. +      * position, but don't actually scroll by setting "dont_scroll". */
  163. +     dont_scroll = !allow_scrollbar;
  164.       gui_drag_scrollbar(sb, val, dragging);
  165.       s_busy_processing = FALSE;
  166. +     dont_scroll = dont_scroll_save;
  167.   
  168.       return 0;
  169.   }
  170. *** ../vim61.092/src/gui_w32.c    Sat May  4 22:23:07 2002
  171. --- src/gui_w32.c    Sun Jun  9 20:04:41 2002
  172. ***************
  173. *** 365,370 ****
  174. --- 365,371 ----
  175.       int        nPos;
  176.   #endif
  177.       static UINT    prev_code = 0;   /* code of previous call */
  178. +     int        dont_scroll_save = dont_scroll;
  179.   
  180.       sb = gui_mswin_find_scrollbar(hwndCtl);
  181.       if (sb == NULL)
  182. ***************
  183. *** 457,464 ****
  184. --- 458,472 ----
  185.   
  186.       /* Don't let us be interrupted here by another message. */
  187.       s_busy_processing = TRUE;
  188. +     /* When "allow_scrollbar" is FALSE still need to remember the new
  189. +      * position, but don't actually scroll by setting "dont_scroll". */
  190. +     dont_scroll = !allow_scrollbar;
  191.       gui_drag_scrollbar(sb, val, dragging);
  192.       s_busy_processing = FALSE;
  193. +     dont_scroll = dont_scroll_save;
  194.   
  195.       return 0;
  196.   }
  197. *** ../vim61.092/src/gui_w48.c    Sat May  4 22:23:07 2002
  198. --- src/gui_w48.c    Sun Jun  9 20:03:16 2002
  199. ***************
  200. *** 166,171 ****
  201. --- 166,179 ----
  202.   
  203.   static int        s_need_activate = FALSE;
  204.   
  205. + /* This variable is set when waiting for an event, which is the only moment
  206. +  * scrollbar dragging can be done directly.  It's not allowed while commands
  207. +  * are executed, because it may move the cursor and that may cause unexpected
  208. +  * problems (e.g., while ":s" is working).
  209. +  */
  210. + static int allow_scrollbar = FALSE;
  211.   #ifdef GLOBAL_IME
  212.   # undef DefWindowProc
  213.   # define DefWindowProc(a, b, c, d) global_ime_DefWindowProc(a, b, c, d)
  214. ***************
  215. *** 1655,1660 ****
  216. --- 1663,1670 ----
  217.                                (TIMERPROC)_OnTimer);
  218.       }
  219.   
  220. +     allow_scrollbar = TRUE;
  221.       focus = gui.in_focus;
  222.       while (!s_timed_out)
  223.       {
  224. ***************
  225. *** 1697,1705 ****
  226. --- 1707,1717 ----
  227.               ;
  228.           s_wait_timer = 0;
  229.           }
  230. +         allow_scrollbar = FALSE;
  231.           return OK;
  232.       }
  233.       }
  234. +     allow_scrollbar = FALSE;
  235.       return FAIL;
  236.   }
  237.   
  238. *** ../vim61.092/src/version.c    Sun Jun  9 18:28:25 2002
  239. --- src/version.c    Sun Jun  9 20:31:49 2002
  240. ***************
  241. *** 608,609 ****
  242. --- 608,611 ----
  243.   {   /* Add new patch number below this line */
  244. + /**/
  245. +     93,
  246.   /**/
  247.  
  248. -- 
  249. hundred-and-one symptoms of being an internet addict:
  250. 146. You experience ACTUAL physical withdrawal symptoms when away
  251.      from your 'puter and the net.
  252.  
  253.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  254. ///   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   \\\
  255. \\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
  256.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  257.