]> git.pld-linux.org Git - packages/vim.git/blob - vim-autopaste.patch
Up to 9.1.0168
[packages/vim.git] / vim-autopaste.patch
1 --- vim-8.2.2529/src/getchar.c.orig     2021-02-17 21:57:03.000000000 +0100
2 +++ vim-8.2.2529/src/getchar.c  2021-03-02 14:00:33.809422212 +0100
3 @@ -1637,6 +1637,13 @@
4      int
5  vgetc(void)
6  {
7 +    static time_t last_call = 0;
8 +    static int cps = 0;
9 +    char_u sPaste[] = "paste";
10 +    time_t now;
11 +    if (p_apa)
12 +      now = time(NULL);
13 +
14      int                c, c2;
15      int                n;
16      char_u     buf[MB_MAXBYTES + 1];
17 @@ -1649,6 +1656,19 @@
18         garbage_collect(FALSE);
19  #endif
20  
21 +    if (p_apa && !p_paste) {
22 +      if (last_call == now)
23 +        ++cps;
24 +      else
25 +        cps = 0;
26 +      if (cps >= 30) {
27 +        cps = 0;
28 +       do_set(&sPaste, 0);
29 +       showmode();
30 +      }
31 +      last_call = now;
32 +    }
33 +
34      /*
35       * If a character was put back with vungetc, it was already processed.
36       * Return it directly.
37 --- vim72/src/optiondefs.h~     2009-05-18 22:23:40.000000000 +0300
38 +++ vim72/src/optiondefs.h      2009-05-18 22:30:25.277259155 +0300
39 @@ -377,6 +377,9 @@
40      {"autoindent",  "ai",   P_BOOL|P_VI_DEF,
41                             (char_u *)&p_ai, PV_AI, NULL, NULL,
42                             {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
43 +    {"autopaste",   "apa",  P_BOOL|P_VI_DEF,
44 +                            (char_u *)&p_apa, PV_NONE, NULL, NULL,
45 +                            {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
46      {"autoprint",   "ap",   P_BOOL|P_VI_DEF,
47                             (char_u *)NULL, PV_NONE, NULL, NULL,
48                             {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
49 --- vim72/src/option.h~ 2009-05-18 22:23:40.000000000 +0300
50 +++ vim72/src/option.h  2009-05-18 22:30:25.277259155 +0300
51 @@ -312,6 +312,7 @@
52  #if defined(FEAT_GUI) && defined(MACOS_X)
53  EXTERN int     *p_antialias;   // 'antialias'
54  #endif
55 +EXTERN int      p_apa;          /* 'autopaste' */
56  EXTERN int     p_ar;           // 'autoread'
57  EXTERN int     p_aw;           // 'autowrite'
58  EXTERN int     p_awa;          // 'autowriteall'
This page took 0.187135 seconds and 3 git commands to generate.