annotate src/os_qnx.c @ 11664:e3bfe624ba0a v8.0.0714

patch 8.0.0714: when a timer causes a command line redraw " goes missing commit https://github.com/vim/vim/commit/a92522fbf3a49d06e08caf010f7d7b0f58d2e131 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 15 15:21:38 2017 +0200 patch 8.0.0714: when a timer causes a command line redraw " goes missing Problem: When a timer causes a command line redraw the " that is displayed for CTRL-R goes missing. Solution: Remember an extra character to display.
author Christian Brabandt <cb@256bit.org>
date Sat, 15 Jul 2017 15:30:04 +0200
parents 4aead6a9b7a9
children cd5c83115ec6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10042
4aead6a9b7a9 commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents: 7833
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 * QNX port by Julian Kinraid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 * os_qnx.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 #if defined(FEAT_GUI_PHOTON)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 int is_photon_available;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21
7833
c079097365f3 commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents: 5735
diff changeset
22 void qnx_init(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 #if defined(FEAT_GUI_PHOTON)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 PhChannelParms_t parms;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
27 memset(&parms, 0, sizeof(parms));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 parms.flags = Ph_DYNAMIC_BUFFER;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
30 is_photon_available = (PhAttach(NULL, &parms) != NULL) ? TRUE : FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 #if (defined(FEAT_GUI_PHOTON) && defined(FEAT_CLIPBOARD)) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 #define CLIP_TYPE_VIM "VIMTYPE"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 #define CLIP_TYPE_TEXT "TEXT"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 /* Turn on the clipboard for a console vim when photon is running */
7833
c079097365f3 commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents: 5735
diff changeset
40 void qnx_clip_init(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 {
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
42 if (is_photon_available == TRUE && !gui.in_use)
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
43 clip_init(TRUE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 /*****************************************************************************/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 /* Clipboard */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 /* No support for owning the clipboard */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 int
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
51 clip_mch_own_selection(VimClipboard *cbd)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 void
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
57 clip_mch_lose_selection(VimClipboard *cbd)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 void
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
62 clip_mch_request_selection(VimClipboard *cbd)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 int type = MLINE, clip_length = 0, is_type_set = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 void *cbdata;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 PhClipHeader *clip_header;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 char_u *clip_text = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
69 cbdata = PhClipboardPasteStart(PhInputGroup(NULL));
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
70 if (cbdata != NULL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 /* Look for the vim specific clip first */
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
73 clip_header = PhClipboardPasteType(cbdata, CLIP_TYPE_VIM);
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
74 if (clip_header != NULL && clip_header->data != NULL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 {
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
76 switch(*(char *) clip_header->data)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 default: /* fallthrough to line type */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 case 'L': type = MLINE; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 case 'C': type = MCHAR; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 case 'B': type = MBLOCK; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 is_type_set = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 /* Try for just normal text */
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
87 clip_header = PhClipboardPasteType(cbdata, CLIP_TYPE_TEXT);
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
88 if (clip_header != NULL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 clip_text = clip_header->data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 clip_length = clip_header->length - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
93 if (clip_text != NULL && is_type_set == FALSE)
2896
fd4224d9ee09 updated for version 7.3.221
Bram Moolenaar <bram@vim.org>
parents: 419
diff changeset
94 type = MAUTO;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
97 if ((clip_text != NULL) && (clip_length > 0))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 {
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
99 clip_yank_selection(type, clip_text, clip_length, cbd);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
102 PhClipboardPasteFinish(cbdata);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 void
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
107 clip_mch_set_selection(VimClipboard *cbd)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 long_u len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 char_u *text_clip, vim_clip[2], *str = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 PhClipHeader clip_header[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 /* Prevent recursion from clip_get_selection() */
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
115 if (cbd->owned == TRUE)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 cbd->owned = TRUE;
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
119 clip_get_selection(cbd);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 cbd->owned = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
122 type = clip_convert_selection(&str, &len, cbd);
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
123 if (type >= 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 {
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
125 text_clip = lalloc(len + 1, TRUE); /* Normal text */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
127 if (text_clip && vim_clip)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 {
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
129 memset(clip_header, 0, sizeof(clip_header));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
131 STRNCPY(clip_header[0].type, CLIP_TYPE_VIM, 8);
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
132 clip_header[0].length = sizeof(vim_clip);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 clip_header[0].data = vim_clip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
135 STRNCPY(clip_header[1].type, CLIP_TYPE_TEXT, 8);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 clip_header[1].length = len + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 clip_header[1].data = text_clip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
139 switch(type)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 default: /* fallthrough to MLINE */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 case MLINE: *vim_clip = 'L'; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 case MCHAR: *vim_clip = 'C'; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 case MBLOCK: *vim_clip = 'B'; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
147 vim_strncpy(text_clip, str, len);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 vim_clip[ 1 ] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
151 PhClipboardCopy(PhInputGroup(NULL), 2, clip_header);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 }
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
153 vim_free(text_clip);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 }
3100
fc0804089b29 updated for version 7.3.321
Bram Moolenaar <bram@vim.org>
parents: 2896
diff changeset
155 vim_free(str);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 #endif