]> git.pld-linux.org Git - packages/vim.git/blame - vim-autopaste.patch
up to 9.0.1664
[packages/vim.git] / vim-autopaste.patch
CommitLineData
1eeb3fe4
JP
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.
326cec69
AG
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 @@
b5ccbaa1 40 {"autoindent", "ai", P_BOOL|P_VI_DEF,
4431d3b0 41 (char_u *)&p_ai, PV_AI, NULL,
079815b6 42 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
b5ccbaa1 43+ {"autopaste", "apa", P_BOOL|P_VI_DEF,
4431d3b0 44+ (char_u *)&p_apa, PV_NONE, NULL,
079815b6 45+ {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
b5ccbaa1 46 {"autoprint", "ap", P_BOOL|P_VI_DEF,
4431d3b0 47 (char_u *)NULL, PV_NONE, NULL,
079815b6 48 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
326cec69
AG
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.297536 seconds and 4 git commands to generate.