annotate src/workshop.c @ 1796:4589d1792c03 v7.2.094

updated for version 7.2-094
author vimboss
date Wed, 04 Feb 2009 10:20:58 +0000
parents 5fafc42c22d2
children fc89a4f98a8b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4:
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 * Visual Workshop integration by Gordon Prieur
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 * See README.txt for an overview of the Vim source code.
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 #ifdef HAVE_CONFIG_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 # include "auto/config.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 #include <stdio.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 #include <stdlib.h>
44
af1bcb9a13c0 updated for version 7.0027
vimboss
parents: 7
diff changeset
16 #include <sys/types.h>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 #include <netdb.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 #include <netinet/in.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 #include <errno.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 #include <sys/socket.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 #ifdef HAVE_LIBGEN_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 # include <libgen.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 #include <unistd.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 #include <string.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 #include <stdlib.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 #include <ctype.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 #include <X11/Intrinsic.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 #include <Xm/Xm.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 #include <Xm/PushB.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 #include "integration.h" /* <EditPlugin/integration.h> */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 #include "version.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 #include "gui_beval.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 #include "workshop.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 void workshop_hotkeys(Boolean);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 static Boolean isShowing(int);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 static win_T *get_window(buf_T *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 #if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 static int get_buffer_number(buf_T *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 static void updatePriority(Boolean);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 static char *addUniqueMnemonic(char *, char *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 static char *fixup(char *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 static char *get_selection(buf_T *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 static char *append_selection(int, char *, int *, int *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 static void load_buffer_by_name(char *, int);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 #if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 static void load_buffer_by_number(int, int);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 static void load_window(char *, int lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 static void warp_to_pc(int);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 #ifdef FEAT_BEVAL
189
504c627f7474 updated for version 7.0057
vimboss
parents: 44
diff changeset
59 void workshop_beval_cb(BalloonEval *, int);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 static char *fixAccelText(char *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 static void addMenu(char *, char *, char *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 static char *lookupVerb(char *, int);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 static int computeIndex(int, char_u *, int);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 static void coloncmd(char *, Boolean);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 extern Widget vimShell;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 extern Widget textArea;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 extern XtAppContext app_context;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 static int tbpri; /* ToolBar priority */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 int usingSunWorkShop = 0; /* set if -ws flag is used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 char curMenuName[BUFSIZ];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 char curMenuPriority[BUFSIZ];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 static Boolean workshopInitDone = False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 static Boolean workshopHotKeysEnabled = False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 * The following enum is from <gp_dbx/gp_dbx_common.h>. We can't include it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 * here because its C++.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 enum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 GPLineEval_EVALUATE, /* evaluate expression */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 GPLineEval_INDIRECT, /* evaluate *<expression> */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 GPLineEval_TYPE /* type of expression */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 * Store each verb in the MenuMap. This lets us map from a verb to a menu.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 * There may be multiple matches for a single verb in this table.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 #define MENU_INC 50 /* menuMap incremental size increases */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 char *name; /* name of the menu */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 char *accel; /* optional accelerator key */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 char *verb; /* menu verb */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 } MenuMap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 static MenuMap *menuMap; /* list of verb/menu mappings */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 static int menuMapSize; /* current size of menuMap */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 static int menuMapMax; /* allocated size of menuMap */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 static char *initialFileCmd; /* save command but defer doing it */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 workshop_init()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 char_u buf[64];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 int is_dirty = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 int width, height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 XtInputMask mask;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 * Turn on MenuBar, ToolBar, and Footer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 STRCPY(buf, p_go);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 if (vim_strchr(p_go, GO_MENUS) == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 STRCAT(buf, "m");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 is_dirty = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 if (vim_strchr(p_go, GO_TOOLBAR) == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 STRCAT(buf, "T");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 is_dirty = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 if (vim_strchr(p_go, GO_FOOTER) == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 STRCAT(buf, "F");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 is_dirty = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 if (is_dirty)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 set_option_value((char_u *)"go", 0L, buf, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 * Set size from workshop_get_width_height().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 width = height = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 if (workshop_get_width_height(&width, &height))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 XtVaSetValues(vimShell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 XmNwidth, width,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 XmNheight, height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 * Now read in the initial messages from eserve.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 while ((mask = XtAppPending(app_context))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 && (mask & XtIMAlternateInput) && !workshopInitDone)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 XtAppProcessEvent(app_context, (XtInputMask)XtIMAlternateInput);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 workshop_postinit()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 do_cmdline_cmd((char_u *)initialFileCmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 ALT_INPUT_LOCK_OFF;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 free(initialFileCmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 initialFileCmd = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 ex_wsverb(exarg_T *eap)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 msg_clr_cmdline();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 workshop_perform_verb((char *) eap->arg, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 * Editor name
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 * This string is recognized by eserve and should be all lower case.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 * This is how the editor detects that it is talking to gvim instead
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 * of NEdit, for example, when the connection is initiated from the editor.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 workshop_get_editor_name()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 return "gvim";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 * Version number of the editor.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 * This number is communicated along with the protocol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 * version to the application.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 workshop_get_editor_version()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 return Version;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 * Answer functions: called by eserve
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 * Name:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 * workshop_load_file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 * Function:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 * Load a given file into the WorkShop buffer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 /*ARGSUSED*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 workshop_load_file(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 char *filename, /* the file to load */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 int line, /* an optional line number (or 0) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 char *frameid) /* used for multi-frame support */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 wstrace("workshop_load_file(%s, %d)\n", filename, line);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 #ifdef FEAT_BEVAL
189
504c627f7474 updated for version 7.0057
vimboss
parents: 44
diff changeset
220 bevalServers |= BEVAL_WORKSHOP;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 load_window(filename, line);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 * Reload the WorkShop buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 workshop_reload_file(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 char *filename,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 int line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 wstrace("workshop_reload_file(%s, %d)\n", filename, line);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 load_window(filename, line);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 workshop_show_file(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 char *filename)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 wstrace("workshop_show_file(%s)\n", filename);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 load_window(filename, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 workshop_goto_line(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 char *filename,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 int lineno)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 wstrace("workshop_goto_line(%s, %d)\n", filename, lineno);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 load_window(filename, lineno);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 /*ARGSUSED*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 workshop_front_file(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 char *filename)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 wstrace("workshop_front_file()\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 * Assumption: This function will always be called after a call to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 * workshop_show_file(), so the file is always showing.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 if (vimShell != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 XRaiseWindow(gui.dpy, XtWindow(vimShell));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 workshop_save_file(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 char *filename)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 char cbuf[BUFSIZ]; /* build vim command here */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 wstrace("workshop_save_file(%s)\n", filename);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 /* Save the given file */
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
295 vim_snprintf(cbuf, sizeof(cbuf), "w %s", filename);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 workshop_save_files()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 /* Save the given file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 wstrace("workshop_save_files()\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 add_to_input_buf((char_u *) ":wall\n", 6);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 workshop_quit()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 wstrace("workshop_quit()\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 add_to_input_buf((char_u *) ":qall\n", 6);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 workshop_minimize()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 wstrace("workshop_minimize()\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 workshop_minimize_shell(vimShell);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 workshop_maximize()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 wstrace("workshop_maximize()\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 workshop_maximize_shell(vimShell);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 workshop_add_mark_type(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 int idx,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 char *colorspec,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 char *sign)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 char gbuf[BUFSIZ]; /* buffer for sign name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 char cibuf[BUFSIZ]; /* color information */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 char cbuf[BUFSIZ]; /* command buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 char *bp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 char *cp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 cp = strrchr(sign, '/');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 if (cp == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 cp = sign;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 cp++; /* skip '/' character */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 wstrace("workshop_add_mark_type(%d, \"%s\", \"%s\")\n", idx,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 colorspec && *colorspec ? colorspec : "<None>", cp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 * Isolate the basename of sign in gbuf. We will use this for the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 * GroupName in the highlight command sent to vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 STRCPY(gbuf, gettail((char_u *)sign));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 bp = strrchr(gbuf, '.');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 if (bp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 *bp = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 if (gbuf[0] != '-' && gbuf[1] != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 if (colorspec != NULL && *colorspec)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 {
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
381 vim_snprintf(cbuf, sizeof(cbuf),
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
382 "highlight WS%s guibg=%s", gbuf, colorspec);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 coloncmd(cbuf, FALSE);
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
384 vim_snprintf(cibuf, sizeof(cibuf), "linehl=WS%s", gbuf);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 cibuf[0] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
389 vim_snprintf(cbuf, sizeof(cbuf),
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
390 "sign define %d %s icon=%s", idx, cibuf, sign);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 workshop_set_mark(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 char *filename, /* filename which gets the mark */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 int lineno, /* line number which gets the mark */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 int markId, /* unique mark identifier */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 int idx) /* which mark to use */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 char cbuf[BUFSIZ]; /* command buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 /* Set mark in a given file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 wstrace("workshop_set_mark(%s, %d (ln), %d (id), %d (idx))\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 filename, lineno, markId, idx);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
411 vim_snprintf(cbuf, sizeof(cbuf), "sign place %d line=%d name=%d file=%s",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 markId, lineno, idx, filename);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 workshop_change_mark_type(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 char *filename, /* filename which gets the mark */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 int markId, /* unique mark identifier */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 int idx) /* which mark to use */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 char cbuf[BUFSIZ]; /* command buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 /* Change mark type */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 wstrace("workshop_change_mark_type(%s, %d, %d)\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 filename, markId, idx);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
431 vim_snprintf(cbuf, sizeof(cbuf),
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
432 "sign place %d name=%d file=%s", markId, idx, filename);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 * Goto the given mark in a file (e.g. show it).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 * If message is not null, display it in the footer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 workshop_goto_mark(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 char *filename,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 int markId,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 char *message)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 char cbuf[BUFSIZ]; /* command buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448 /* Goto mark */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 wstrace("workshop_goto_mark(%s, %d (id), %s)\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452 filename, markId, message && *message &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 !(*message == ' ' && message[1] == NULL) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 message : "<None>");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
457 vim_snprintf(cbuf, sizeof(cbuf), "sign jump %d file=%s", markId, filename);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459 if (message != NULL && *message != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 gui_mch_set_footer((char_u *)message);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464 workshop_delete_mark(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465 char *filename,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466 int markId)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468 char cbuf[BUFSIZ]; /* command buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470 /* Delete mark */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
473 wstrace("workshop_delete_mark(%s, %d (id))\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
474 filename, markId);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
475 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
476
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
477 vim_snprintf(cbuf, sizeof(cbuf),
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
478 "sign unplace %d file=%s", markId, filename);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482 #if 0 /* not used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484 workshop_delete_all_marks(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 void *window,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486 Boolean doRefresh)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 wstrace("workshop_delete_all_marks(%#x, %s)\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 window, doRefresh ? "True" : "False");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 coloncmd("sign unplace *", TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499 workshop_get_mark_lineno(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 char *filename,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 int markId)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 buf_T *buf; /* buffer containing filename */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504 int lineno; /* line number of filename in buf */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506 /* Get mark line number */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
509 wstrace("workshop_get_mark_lineno(%s, %d)\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510 filename, markId);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513 lineno = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 buf = buflist_findname((char_u *)filename);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515 if (buf != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
516 lineno = buf_findsign(buf, markId);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
517
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
518 return lineno;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
519 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
520
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
521
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
522 #if 0 /* not used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
523 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
524 workshop_adjust_marks(Widget *window, int pos,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
525 int inserted, int deleted)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
526 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
527 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
528 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
529 wstrace("XXXworkshop_adjust_marks(%s, %d, %d, %d)\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
530 window ? XtName(window) : "<None>", pos, inserted, deleted);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
531 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
532 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
533 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
534
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
535 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
536 * Are there any moved marks? If so, call workshop_move_mark on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
537 * each of them now. This is how eserve can find out if for example
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
538 * breakpoints have moved when a program has been recompiled and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
539 * reloaded into dbx.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
540 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
541 /*ARGSUSED*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
543 workshop_moved_marks(char *filename)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
544 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
545 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
547 wstrace("XXXworkshop_moved_marks(%s)\n", filename);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
548 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
549 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
550
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
551 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
552 workshop_get_font_height()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 XmFontList fontList; /* fontList made from gui.norm_font */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555 XmString str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556 Dimension w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557 Dimension h;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561 wstrace("workshop_get_font_height()\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
562 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
564 /* Pick the proper signs for this font size */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
565 fontList = gui_motif_create_fontlist((XFontStruct *)gui.norm_font);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
566 h = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
567 if (fontList != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
568 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
569 str = XmStringCreateLocalized("A");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570 XmStringExtent(fontList, str, &w, &h);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 XmStringFree(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
572 XmFontListFree(fontList);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
575 return (int)h;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
576 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
577
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578 /*ARGSUSED*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
579 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580 workshop_footer_message(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
581 char *message,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
582 int severity) /* severity is currently unused */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
583 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
584 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
585 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586 wstrace("workshop_footer_message(%s, %d)\n", message, severity);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
588
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 gui_mch_set_footer((char_u *) message);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
591
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
592 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
593 * workshop_menu_begin() is passed the menu name. We determine its mnemonic
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
594 * here and store its name and priority.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
595 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
596 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
597 workshop_menu_begin(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
598 char *label)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
599 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
600 vimmenu_T *menu; /* pointer to last menu */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
601 int menuPriority = 0; /* priority of new menu */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
602 char mnembuf[64]; /* store menubar mnemonics here */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
603 char *name; /* label with a mnemonic */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
604 char *p; /* used to find mnemonics */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
605 int idx; /* index into mnembuf */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
606
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
607 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
608 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
609 wstrace("workshop_menu_begin()\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
610 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
612 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
613 * Look through all existing (non-PopUp and non-Toolbar) menus
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614 * and gather their mnemonics. Use this list to decide what
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615 * mnemonic should be used for label.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
618 idx = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619 mnembuf[idx++] = 'H'; /* H is mnemonic for Help */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
620 for (menu = root_menu; menu != NULL; menu = menu->next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
621 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
622 if (menu_is_menubar(menu->name))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 p = strchr((char *)menu->name, '&');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
625 if (p != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626 mnembuf[idx++] = *++p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 if (menu->next != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629 && strcmp((char *) menu->next->dname, "Help") == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
630 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
631 menuPriority = menu->priority + 10;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635 mnembuf[idx++] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636 name = addUniqueMnemonic(mnembuf, label);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
637
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
638 vim_snprintf(curMenuName, sizeof(curMenuName), "%s", name);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
639 sprintf(curMenuPriority, "%d.0", menuPriority);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
640 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
641
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
642 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643 * Append the name and priority to strings to be used in vim menu commands.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
645 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646 workshop_submenu_begin(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647 char *label)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
649 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
650 if (ws_debug && ws_dlevel & WS_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651 && strncmp(curMenuName, "ToolBar", 7) != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652 wstrace("workshop_submenu_begin(%s)\n", label);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655 strcat(curMenuName, ".");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
656 strcat(curMenuName, fixup(label));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
657
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
658 updatePriority(True);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
659 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
660
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
661 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
662 * Remove the submenu name and priority from curMenu*.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
663 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
664
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
665 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
666 workshop_submenu_end()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
667 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
668 char *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
669
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
670 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
671 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
672 && strncmp(curMenuName, "ToolBar", 7) != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
673 wstrace("workshop_submenu_end()\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
674 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
675
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
676 p = strrchr(curMenuPriority, '.');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
677 ASSERT(p != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
678 *p = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
679
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
680 p = strrchr(curMenuName, '.');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681 ASSERT(p != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
682 *p = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
683 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
684
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
685 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
686 * This is where menus are really made. Each item will generate an amenu vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
687 * command. The globals curMenuName and curMenuPriority contain the name and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688 * priority of the parent menu tree.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
689 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
690 /*ARGSUSED*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
691 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 workshop_menu_item(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
693 char *label,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
694 char *verb,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
695 char *accelerator,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
696 char *acceleratorText,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
697 char *name,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
698 char *filepos,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
699 char *sensitive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
700 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
701 char cbuf[BUFSIZ];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
702 char namebuf[BUFSIZ];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
703 char accText[BUFSIZ];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
704
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
705 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
706 if (WSDLEVEL(WS_TRACE_VERBOSE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
707 && strncmp(curMenuName, "ToolBar", 7) != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
708 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
709 if (ws_dlevel & WS_TRACE_VERBOSE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
710 wsdebug("workshop_menu_item(\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
711 "\tlabel = \"%s\",\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 "\tverb = %s,\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
713 "\taccelerator = %s,\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714 "\tacceleratorText = \"%s\",\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715 "\tname = %s,\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
716 "\tfilepos = %s,\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
717 "\tsensitive = %s)\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
718 label && *label ? label : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719 verb && *verb ? verb : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
720 accelerator && *accelerator ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
721 accelerator : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
722 acceleratorText && *acceleratorText ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
723 acceleratorText : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
724 name && *name ? name : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725 filepos && *filepos ? filepos : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726 sensitive);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
727 else if (ws_dlevel & WS_TRACE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728 wstrace("workshop_menu_item(\"%s\", %s)\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
729 label && *label ? label : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
730 verb && *verb ? verb : "<None>", sensitive);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
732 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
733 #ifdef WSDEBUG_SENSE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734 if (ws_debug)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
735 wstrace("menu: %-21.20s%-21.20s(%s)\n", label, verb,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
736 *sensitive == '1' ? "Sensitive" : "Insensitive");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
737 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
738
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
739 if (acceleratorText != NULL)
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
740 vim_snprintf(accText, sizeof(accText), "<Tab>%s", acceleratorText);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
741 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
742 accText[0] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
743 updatePriority(False);
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
744 vim_snprintf(namebuf, sizeof(namebuf), "%s.%s", curMenuName, fixup(label));
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
745 vim_snprintf(cbuf, sizeof(cbuf), "amenu %s %s%s\t:wsverb %s<CR>",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
746 curMenuPriority, namebuf, accText, verb);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
747
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
748 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
749 addMenu(namebuf, fixAccelText(acceleratorText), verb);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
750
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
751 if (*sensitive == '0')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
752 {
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
753 vim_snprintf(cbuf, sizeof(cbuf), "amenu disable %s", namebuf);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
754 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
755 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
756 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
757
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
758 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
759 * This function is called when a complete WorkShop menu description has been
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
760 * sent over from eserve. We do some menu cleanup.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
761 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
762
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
763 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
764 workshop_menu_end()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
765 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766 Boolean using_tearoff; /* set per current option setting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
767
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
768 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
769 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
770 wstrace("workshop_menu_end()\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
771 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
772
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
773 using_tearoff = vim_strchr(p_go, GO_TEAROFF) != NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
774 gui_mch_toggle_tearoffs(using_tearoff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
775 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
776
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
777 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
778 workshop_toolbar_begin()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
779 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
780 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
781 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
782 wstrace("workshop_toolbar_begin()\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
783 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
784
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
785 coloncmd("aunmenu ToolBar", True);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
786 tbpri = 10;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
787 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
788
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
789 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
790 workshop_toolbar_end()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
791 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
792 char_u buf[64];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
793
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
794 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
795 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
796 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
797 wstrace("workshop_toolbar_end()\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
798 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
799 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
800
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
801 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
802 * Turn on ToolBar.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
803 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
804 STRCPY(buf, p_go);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
805 if (vim_strchr(p_go, 'T') == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
806 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
807 STRCAT(buf, "T");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
808 set_option_value((char_u *)"go", 0L, buf, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
809 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
810 workshopInitDone = True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
811 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
812
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
813 /*ARGSUSED*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
814 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
815 workshop_toolbar_button(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816 char *label,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
817 char *verb,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
818 char *senseVerb,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
819 char *filepos,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
820 char *help,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
821 char *sense,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
822 char *file,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
823 char *left)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
824 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
825 char cbuf[BUFSIZ + MAXPATHLEN];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
826 char namebuf[BUFSIZ];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
827 static int tbid = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
828 char_u *p;
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
829 int len;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
830
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
831 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
832 if (WSDLEVEL(WS_TRACE_VERBOSE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
833 wsdebug("workshop_toolbar_button(\"%s\", %s, %s,\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
834 "\t%s, \"%s\", %s,\n\t\"%s\",\n\t<%s>)\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
835 label && *label ? label : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
836 verb && *verb ? verb : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
837 senseVerb && *senseVerb ? senseVerb : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
838 filepos && *filepos ? filepos : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
839 help && *help ? help : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
840 sense && *sense ? sense : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
841 file && *file ? file : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
842 left && *left ? left : "<None>");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
843 else if (WSDLEVEL(WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
844 wstrace("workshop_toolbar_button(\"%s\", %s)\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
845 label && *label ? label : "<None>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
846 verb && *verb ? verb : "<None>");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
847 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
848 #ifdef WSDEBUG_SENSE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
849 if (ws_debug)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
850 wsdebug("button: %-21.20s%-21.20s(%s)\n", label, verb,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
851 *sense == '1' ? "Sensitive" : "Insensitive");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
852 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
853
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
854 if (left && *left && atoi(left) > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
855 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
856 /* Add a separator (but pass the width passed after the ':') */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
857 sprintf(cbuf, "amenu 1.%d ToolBar.-sep%d:%s- <nul>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
858 tbpri - 5, tbid++, left);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
859
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
860 coloncmd(cbuf, True);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
861 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
862
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
863 p = vim_strsave_escaped((char_u *)label, (char_u *)"\\. ");
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
864 vim_snprintf(namebuf, sizeof(namebuf), "ToolBar.%s", p);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
865 vim_free(p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
866 STRCPY(cbuf, "amenu <silent> ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
867 if (file != NULL && *file != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
868 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
869 p = vim_strsave_escaped((char_u *)file, (char_u *)" ");
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
870 len = STRLEN(cbuf);
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
871 vim_snprintf(cbuf + len, sizeof(cbuf) - len, "icon=%s ", p);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
872 vim_free(p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
873 }
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
874 len = STRLEN(cbuf);
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
875 vim_snprintf(cbuf + len, sizeof(cbuf) - len,"1.%d %s :wsverb %s<CR>",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
876 tbpri, namebuf, verb);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
877
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
878 /* Define the menu item */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
879 coloncmd(cbuf, True);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
880
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
881 if (*sense == '0')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
882 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
883 /* If menu isn't sensitive at startup... */
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
884 vim_snprintf(cbuf, sizeof(cbuf), "amenu disable %s", namebuf);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
885 coloncmd(cbuf, True);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
887
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
888 if (help && *help)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
889 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890 /* Do the tooltip */
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
891 vim_snprintf(cbuf, sizeof(cbuf), "tmenu %s %s", namebuf, help);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
892 coloncmd(cbuf, True);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
893 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
894
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
895 addMenu(namebuf, NULL, verb);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896 tbpri += 10;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
897 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
898
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 workshop_frame_sensitivities(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901 VerbSense *vs) /* list of verbs to (de)sensitize */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903 VerbSense *vp; /* iterate through vs */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
904 char *menu_name; /* used in menu lookup */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905 int cnt; /* count of verbs to skip */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906 int len; /* length of nonvariant part of command */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 char cbuf[4096];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910 if (WSDLEVEL(WS_TRACE_VERBOSE) || WSDLEVEL(4))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
911 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912 wsdebug("workshop_frame_sensitivities(\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913 for (vp = vs; vp->verb != NULL; vp++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914 wsdebug("\t%-25s%d\n", vp->verb, vp->sense);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915 wsdebug(")\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 else if (WSDLEVEL(WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 wstrace("workshop_frame_sensitivities()\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 #ifdef WSDEBUG_SENSE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921 if (ws_debug)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
922 for (vp = vs; vp->verb != NULL; vp++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923 wsdebug("change: %-21.20s%-21.20s(%s)\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924 "", vp->verb, vp->sense == 1 ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
925 "Sensitive" : "Insensitive");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
929 * Look for all matching menu entries for the verb. There may be more
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 * than one if the verb has both a menu and toolbar entry.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
931 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
932 for (vp = vs; vp->verb != NULL; vp++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
933 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
934 cnt = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
935 strcpy(cbuf, "amenu");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
936 strcat(cbuf, " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
937 strcat(cbuf, vp->sense ? "enable" : "disable");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
938 strcat(cbuf, " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
939 len = strlen(cbuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
940 while ((menu_name = lookupVerb(vp->verb, cnt++)) != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
941 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
942 strcpy(&cbuf[len], menu_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
943 coloncmd(cbuf, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
944 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
945 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
946 gui_update_menus(0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
947 gui_mch_flush();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
948 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
949
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
950 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
951 workshop_set_option(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
952 char *option, /* name of a supported option */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
953 char *value) /* value to set option to */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
954 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
955 char cbuf[BUFSIZ]; /* command buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
956
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
957 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
958 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
959 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
960 wstrace("workshop_set_option(%s, %s)\n", option, value);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
961 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
962 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
963
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
964 cbuf[0] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
965 switch (*option) /* switch on 1st letter */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
966 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
967 case 's':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
968 if (strcmp(option, "syntax") == 0)
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
969 vim_snprintf(cbuf, sizeof(cbuf), "syntax %s", value);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
970 else if (strcmp(option, "savefiles") == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
971 ; /* XXX - Not yet implemented */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
972 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
973
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
974 case 'l':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
975 if (strcmp(option, "lineno") == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
976 sprintf(cbuf, "set %snu",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
977 (strcmp(value, "on") == 0) ? "" : "no");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
978 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
979
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
980 case 'p':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
981 if (strcmp(option, "parentheses") == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
982 sprintf(cbuf, "set %ssm",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
983 (strcmp(value, "on") == 0) ? "" : "no");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
984 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
985
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
986 case 'w':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
987 /* this option is set by a direct call */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
988 #ifdef WSDEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
989 wsdebug("workshop_set_option: "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
990 "Got unexpected workshopkeys option");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
991 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
992 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
993
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
994 case 'b': /* these options are set from direct calls */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
995 if (option[7] == NUL && strcmp(option, "balloon") == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
996 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
997 #ifdef WSDEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998 /* set by direct call to workshop_balloon_mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
999 wsdebug("workshop_set_option: "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1000 "Got unexpected ballooneval option");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1003 else if (strcmp(option, "balloondelay") == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1004 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1005 #ifdef WSDEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006 /* set by direct call to workshop_balloon_delay */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1007 wsdebug("workshop_set_option: "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1008 "Got unexpected balloondelay option");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1010 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1011 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1012 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1013 if (cbuf[0] != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1014 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1015 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1016
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1017
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1018 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1019 workshop_balloon_mode(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1020 Boolean on)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1021 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1022 char cbuf[BUFSIZ]; /* command buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1023
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1024 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1025 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1026 wstrace("workshop_balloon_mode(%s)\n", on ? "True" : "False");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1027 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1028
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1029 sprintf(cbuf, "set %sbeval", on ? "" : "no");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1030 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1032
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1034 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035 workshop_balloon_delay(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036 int delay)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038 char cbuf[BUFSIZ]; /* command buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1040 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1041 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1042 wstrace("workshop_balloon_delay(%d)\n", delay);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1043 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1044
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1045 sprintf(cbuf, "set bdlay=%d", delay);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1046 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1047 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1049
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1051 workshop_show_balloon_tip(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1052 char *tip)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1053 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1054 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1056 wstrace("workshop_show_balloon_tip(%s)\n", tip);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059 if (balloonEval != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060 gui_mch_post_balloon(balloonEval, (char_u *)tip);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1061 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1064 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1065 workshop_hotkeys(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1066 Boolean on)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068 char cbuf[BUFSIZ]; /* command buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1069 MenuMap *mp; /* iterate over menuMap entries */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1070
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1072 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1073 wstrace("workshop_hotkeys(%s)\n", on ? "True" : "False");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1075
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1076 workshopHotKeysEnabled = on;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1077 if (workshopHotKeysEnabled)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1078 for (mp = menuMap; mp < &menuMap[menuMapSize]; mp++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 if (mp->accel != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1081 {
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
1082 vim_snprintf(cbuf, sizeof(cbuf),
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
1083 "map %s :wsverb %s<CR>", mp->accel, mp->verb);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1084 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1086 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1087 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1088 for (mp = menuMap; mp < &menuMap[menuMapSize]; mp++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1089 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1090 if (mp->accel != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1091 {
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
1092 vim_snprintf(cbuf, sizeof(cbuf), "unmap %s", mp->accel);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1095 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1096 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1099 * A button in the toolbar has been pushed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1100 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101 /*ARGSUSED*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1102 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1103 workshop_get_positions(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1104 void *clientData, /* unused */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1105 char **filename, /* output data */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1106 int *curLine, /* output data */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1107 int *curCol, /* output data */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1108 int *selStartLine, /* output data */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1109 int *selStartCol, /* output data */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1110 int *selEndLine, /* output data */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1111 int *selEndCol, /* output data */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1112 int *selLength, /* output data */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1113 char **selection) /* output data */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1114 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1115 static char ffname[MAXPATHLEN];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1117 #ifdef WSDEBUG_TRACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1118 if (WSDLEVEL(WS_TRACE_VERBOSE | WS_TRACE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1119 wstrace("workshop_get_positions(%#x, \"%s\", ...)\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1120 clientData, (curbuf && curbuf->b_sfname != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1121 ? (char *)curbuf->b_sfname : "<None>");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1122 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1123
1756
5fafc42c22d2 updated for version 7.2-053
vimboss
parents: 1621
diff changeset
1124 if (curbuf->b_ffname == NULL)
5fafc42c22d2 updated for version 7.2-053
vimboss
parents: 1621
diff changeset
1125 ffname[0] = NUL;
5fafc42c22d2 updated for version 7.2-053
vimboss
parents: 1621
diff changeset
1126 else
5fafc42c22d2 updated for version 7.2-053
vimboss
parents: 1621
diff changeset
1127 /* copy so nobody can change b_ffname */
5fafc42c22d2 updated for version 7.2-053
vimboss
parents: 1621
diff changeset
1128 strcpy(ffname, (char *) curbuf->b_ffname);
5fafc42c22d2 updated for version 7.2-053
vimboss
parents: 1621
diff changeset
1129 *filename = ffname;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1130 *curLine = curwin->w_cursor.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1131 *curCol = curwin->w_cursor.col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1132
692
a28f83d37113 updated for version 7.0208
vimboss
parents: 456
diff changeset
1133 if (curbuf->b_visual.vi_mode == 'v' &&
a28f83d37113 updated for version 7.0208
vimboss
parents: 456
diff changeset
1134 equalpos(curwin->w_cursor, curbuf->b_visual.vi_end))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1135 {
692
a28f83d37113 updated for version 7.0208
vimboss
parents: 456
diff changeset
1136 *selStartLine = curbuf->b_visual.vi_start.lnum;
a28f83d37113 updated for version 7.0208
vimboss
parents: 456
diff changeset
1137 *selStartCol = curbuf->b_visual.vi_start.col;
a28f83d37113 updated for version 7.0208
vimboss
parents: 456
diff changeset
1138 *selEndLine = curbuf->b_visual.vi_end.lnum;
a28f83d37113 updated for version 7.0208
vimboss
parents: 456
diff changeset
1139 *selEndCol = curbuf->b_visual.vi_end.col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1140 *selection = get_selection(curbuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1141 if (*selection)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1142 *selLength = strlen(*selection);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1143 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1144 *selLength = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1145 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1146 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1147 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1148 *selStartLine = *selEndLine = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1149 *selStartCol = *selEndCol = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1150 *selLength = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1151 *selection = "";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1152 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1153
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1154 return True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1155 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1156
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1157
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1159 /************************************************************************
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1160 * Utility functions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1161 ************************************************************************/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1162
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1163 static char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1164 get_selection(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1165 buf_T *buf) /* buffer whose selection we want */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1166 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1167 pos_T *start; /* start of the selection */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1168 pos_T *end; /* end of the selection */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1169 char *lp; /* pointer to actual line data */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1170 int llen; /* length of actual line data */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1171 char *sp; /* pointer to selection buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1172 int slen; /* string length in selection buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1173 int size; /* size of selection buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1174 char *new_sp; /* temp pointer to new sp */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1175 int lnum; /* line number we are appending */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1176
692
a28f83d37113 updated for version 7.0208
vimboss
parents: 456
diff changeset
1177 if (buf->b_visual.vi_mode == 'v')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1178 {
692
a28f83d37113 updated for version 7.0208
vimboss
parents: 456
diff changeset
1179 start = &buf->b_visual.vi_start;
a28f83d37113 updated for version 7.0208
vimboss
parents: 456
diff changeset
1180 end = &buf->b_visual.vi_end;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1181 if (start->lnum == end->lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1182 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1183 /* selection is all on one line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1184 lp = (char *) ml_get_pos(start);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1185 llen = end->col - start->col + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1186 sp = (char *) malloc(llen + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1187 if (sp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1188 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1189 strncpy(sp, lp, llen);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1190 sp[llen] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1191 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1192 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1193 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1194 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1195 /* multi-line selection */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1196 lp = (char *) ml_get_pos(start);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1197 llen = strlen(lp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1198 sp = (char *) malloc(BUFSIZ + llen);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1199 if (sp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1200 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1201 size = BUFSIZ + llen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1202 strcpy(sp, lp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1203 sp[llen] = '\n';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1204 slen = llen + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1205
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1206 lnum = start->lnum + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1207 while (lnum < end->lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1208 sp = append_selection(lnum++, sp, &size, &slen);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1209
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1210 lp = (char *) ml_get(end->lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1211 llen = end->col + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1212 if ((slen + llen) >= size)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1213 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1214 new_sp = (char *)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1215 realloc(sp, slen + llen + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1216 if (new_sp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1217 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1218 size += llen + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1219 sp = new_sp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1220 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1221 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1222 if ((slen + llen) < size)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1223 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1224 strncpy(&sp[slen], lp, llen);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1225 sp[slen + llen] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1226 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1227
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1228 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1229 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1230 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1231 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1232 sp = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1234 return sp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1235 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1237 static char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1238 append_selection(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1239 int lnum, /* line number to append */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1240 char *sp, /* pointer to selection buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1241 int *size, /* ptr to size of sp */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1242 int *slen) /* ptr to length of selection string */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1243 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1244 char *lp; /* line of data from buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1245 int llen; /* strlen of lp */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1246 char *new_sp; /* temp pointer to new sp */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1247
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1248 lp = (char *)ml_get((linenr_T)lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1249 llen = strlen(lp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1250
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1251 if ((*slen + llen) <= *size)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1252 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1253 new_sp = (char *) realloc((void *) sp, BUFSIZ + *slen + llen);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1254 if (*new_sp != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1255 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1256 *size = BUFSIZ + *slen + llen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1257 sp = new_sp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1258 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1259 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1260 if ((*slen + llen) > *size)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1261 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1262 strcat(&sp[*slen], lp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1263 *slen += llen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1264 sp[*slen++] = '\n';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1265 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1266
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1267 return sp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1268 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1270
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1271
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1272 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1273 load_buffer_by_name(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1274 char *filename, /* the file to load */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1275 int lnum) /* an optional line number (or 0) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1276 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1277 char lnumbuf[16]; /* make line number option for :e */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1278 char cbuf[BUFSIZ]; /* command buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1279
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1280 if (lnum > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1281 sprintf(lnumbuf, "+%d", lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1282 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1283 lnumbuf[0] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1284
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
1285 vim_snprintf(cbuf, sizeof(cbuf), "e %s %s", lnumbuf, filename);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1286 coloncmd(cbuf, False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1287 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1289
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1290 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1291 load_window(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1292 char *filename, /* filename to load */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1293 int lnum) /* linenumber to go to */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1294 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1295 buf_T *buf; /* buffer filename is stored in */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1296 win_T *win; /* window filenme is displayed in */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1297
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1298 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1299 * Make sure filename is displayed and is the current window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1300 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1301
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1302 buf = buflist_findname((char_u *)filename);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1303 if (buf == NULL || (win = get_window(buf)) == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1304 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1305 /* No buffer or buffer is not in current window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1306 /* wsdebug("load_window: load_buffer_by_name(\"%s\", %d)\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1307 filename, lnum); */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1308 load_buffer_by_name(filename, lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1309 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1310 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1311 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1312 /* buf is in a window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1313 if (win != curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1314 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1315 win_enter(win, False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1316 /* wsdebug("load_window: window endter %s\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1317 win->w_buffer->b_sfname); */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1318 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1319 if (lnum > 0 && win->w_cursor.lnum != lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1320 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1321 warp_to_pc(lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1322 /* wsdebug("load_window: warp to %s[%d]\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1323 win->w_buffer->b_sfname, lnum); */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1324 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1325 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1326 out_flush();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1327 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1328
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1329
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1330
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1331 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1332 warp_to_pc(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1333 int lnum) /* line number to warp to */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1334 {
1212
e085b0f7b036 updated for version 7.1b
vimboss
parents: 692
diff changeset
1335 char lbuf[256]; /* build line command here */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1336
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1337 if (lnum > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1338 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1339 if (State & INSERT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1340 add_to_input_buf((char_u *) "\033", 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1341 if (isShowing(lnum))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1342 sprintf(lbuf, "%dG", lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1343 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1344 sprintf(lbuf, "%dz.", lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1345 add_to_input_buf((char_u *) lbuf, strlen(lbuf));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1346 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1347 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1348
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1349 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1350 isShowing(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1351 int lnum) /* tell if line number is showing */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1352 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1353 return lnum >= curwin->w_topline && lnum < curwin->w_botline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1354 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1355
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1356
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1357
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1358 static win_T *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1359 get_window(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1360 buf_T *buf) /* buffer to find window for */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1361 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1362 win_T *wp = NULL; /* window filename is in */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1363
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1364 for (wp = firstwin; wp != NULL; wp = W_NEXT(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1365 if (buf == wp->w_buffer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1366 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1367 return wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1368 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1369
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1370
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1371 #if 0 /* not used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1372 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1373 get_buffer_number(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1374 buf_T *buf) /* buffer to get position of */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1375 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1376 buf_T *bp; /* iterate over buffer list */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1377 int pos; /* the position in the buffer list */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1378
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1379 pos = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1380 for (bp = firstbuf; bp != NULL; bp = bp->b_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1381 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1382 if (bp == buf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1383 return pos;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1384 pos++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1385 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1386
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1387 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1388 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1389 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1390
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1391 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1392 updatePriority(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1393 Boolean subMenu) /* if True then start new submenu pri */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1394 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1395 int pri; /* priority of this menu/item */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1396 char *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1397
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1398 p = strrchr(curMenuPriority, '.');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1399 ASSERT(p != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1400 *p++ = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1401
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1402 pri = atoi(p) + 10; /* our new priority */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1404 if (subMenu)
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
1405 vim_snprintf(curMenuPriority, sizeof(curMenuPriority),
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
1406 "%s.%d.0", curMenuPriority, pri);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1407 else
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
1408 vim_snprintf(curMenuPriority, sizeof(curMenuPriority),
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
1409 "%s.%d", curMenuPriority, pri);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1410 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1411
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1412 static char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1413 addUniqueMnemonic(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1414 char *mnemonics, /* currently used mnemonics */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1415 char *label) /* label of menu needing mnemonic */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1416 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1417 static char name[BUFSIZ]; /* buffer for the updated name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1418 char *p; /* pointer into label */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1419 char *found; /* pointer to possible mnemonic */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1420
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1421 found = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1422 for (p = label; *p != NUL; p++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1423 if (strchr(mnemonics, *p) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1424 if (found == NULL || (isupper((int)*p) && islower((int)*found)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1425 found = p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1426
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1427 if (found != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1428 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1429 strncpy(name, label, (found - label));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1430 strcat(name, "&");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1431 strcat(name, found);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1432 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1433 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1434 strcpy(name, label);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1435
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1436 return name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1437 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1438
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1439 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1440 * Some characters in a menu name must be escaped in vim. Since this is vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1441 * specific, it must be done on this side.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1442 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1443 static char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1444 fixup(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1445 char *label)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1446 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1447 static char buf[BUFSIZ];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1448 char *bp; /* pointer into buf */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1449 char *lp; /* pointer into label */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1450
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1451 lp = label;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1452 bp = buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1453 while (*lp != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1454 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1455 if (*lp == ' ' || *lp == '.')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1456 *bp++ = '\\';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1457 *bp++ = *lp++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1458 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1459 *bp = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1460
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1461 return buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1462 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1463
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1464
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1465 #ifdef NOHANDS_SUPPORT_FUNCTIONS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1466
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1467 /* For the NoHands test suite */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1468
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1469 char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1470 workshop_test_getcurrentfile()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1471 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1472 char *filename, *selection;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1473 int curLine, curCol, selStartLine, selStartCol, selEndLine;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1474 int selEndCol, selLength;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1475
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1476 if (workshop_get_positions(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1477 NULL, &filename, &curLine, &curCol, &selStartLine,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1478 &selStartCol, &selEndLine, &selEndCol, &selLength,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1479 &selection))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1480 return filename;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1481 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1482 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1483 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1484
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1485 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1486 workshop_test_getcursorrow()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1487 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1488 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1489 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1490
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1491 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1492 workshop_test_getcursorcol()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1493 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1494 char *filename, *selection;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1495 int curLine, curCol, selStartLine, selStartCol, selEndLine;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1496 int selEndCol, selLength;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1497
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1498 if (workshop_get_positions(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1499 NULL, &filename, &curLine, &curCol, &selStartLine,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1500 &selStartCol, &selEndLine, &selEndCol, &selLength,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1501 &selection))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1502 return curCol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1503 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1504 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1505 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1506
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1507 char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1508 workshop_test_getcursorrowtext()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1509 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1510 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1511 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1513 char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1514 workshop_test_getselectedtext()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1515 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1516 char *filename, *selection;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1517 int curLine, curCol, selStartLine, selStartCol, selEndLine;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1518 int selEndCol, selLength;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1519
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1520 if (workshop_get_positions(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1521 NULL, &filename, &curLine, &curCol, &selStartLine,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1522 &selStartCol, &selEndLine, &selEndCol, &selLength,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1523 &selection))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1524 return selection;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1525 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1526 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1527 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1528
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1529 /*ARGSUSED*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1530 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1531 workshop_save_sensitivity(char *filename)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1532 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1533 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1534
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1535 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1537 static char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1538 fixAccelText(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1539 char *ap) /* original acceleratorText */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1540 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1541 char buf[256]; /* build in temp buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1542 char *shift; /* shift string of "" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1543
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1544 if (ap == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1545 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1546
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1547 /* If the accelerator is shifted use the vim form */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1548 if (strncmp("Shift+", ap, 6) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1549 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1550 shift = "S-";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1551 ap += 6;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1552 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1553 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1554 shift = "";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1555
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1556 if (*ap == 'F' && atoi(&ap[1]) > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1557 {
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
1558 vim_snprintf(buf, sizeof(buf), "<%s%s>", shift, ap);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1559 return strdup(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1560 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1561 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1562 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1563 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1564
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1565 #ifdef FEAT_BEVAL
189
504c627f7474 updated for version 7.0057
vimboss
parents: 44
diff changeset
1566 void
504c627f7474 updated for version 7.0057
vimboss
parents: 44
diff changeset
1567 workshop_beval_cb(
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1568 BalloonEval *beval,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1569 int state)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1570 {
189
504c627f7474 updated for version 7.0057
vimboss
parents: 44
diff changeset
1571 win_T *wp;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1572 char_u *text;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1573 int type;
189
504c627f7474 updated for version 7.0057
vimboss
parents: 44
diff changeset
1574 linenr_T lnum;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1575 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1576 int idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1577 char buf[MAXPATHLEN * 2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1578 static int serialNo = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1579
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1580 if (!p_beval)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1581 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1582
189
504c627f7474 updated for version 7.0057
vimboss
parents: 44
diff changeset
1583 if (get_beval_info(beval, FALSE, &wp, &lnum, &text, &col) == OK)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1584 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1585 if (text && text[0])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1586 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1587 /* Send debugger request */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1588 if (strlen((char *) text) > (MAXPATHLEN/2))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1589 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1590 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1591 * The user has probably selected the entire
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1592 * buffer or something like that - don't attempt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1593 * to evaluate it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1594 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1595 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1596 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1597
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1598 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1599 * WorkShop expects the col to be a character index, not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1600 * a column number. Compute the index from col. Also set
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1601 * line to 0 because thats what dbx expects.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1602 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1603 idx = computeIndex(col, text, beval->ts);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1604 if (idx > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1605 {
189
504c627f7474 updated for version 7.0057
vimboss
parents: 44
diff changeset
1606 lnum = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1607
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1608 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1609 * If successful, it will respond with a balloon cmd.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1610 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1611 if (state & ControlMask)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1612 /* Evaluate *(expression) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1613 type = (int)GPLineEval_INDIRECT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1614 else if (state & ShiftMask)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1615 /* Evaluate type(expression) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1616 type = (int)GPLineEval_TYPE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1617 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1618 /* Evaluate value(expression) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1619 type = (int)GPLineEval_EVALUATE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1620
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1621 /* Send request to dbx */
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
1622 vim_snprintf(buf, sizeof(buf), "toolVerb debug.balloonEval "
189
504c627f7474 updated for version 7.0057
vimboss
parents: 44
diff changeset
1623 "%s %ld,0 %d,0 %d,%d %ld %s\n",
504c627f7474 updated for version 7.0057
vimboss
parents: 44
diff changeset
1624 (char *)wp->w_buffer->b_ffname,
504c627f7474 updated for version 7.0057
vimboss
parents: 44
diff changeset
1625 (long)lnum, idx, type, serialNo++,
504c627f7474 updated for version 7.0057
vimboss
parents: 44
diff changeset
1626 (long)strlen((char *)text), (char *)text);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1627 balloonEval = beval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1628 workshop_send_message(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1629 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1630 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1631 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1632 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1633 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1634
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1635
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1636 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1637 computeIndex(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1638 int wantedCol,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1639 char_u *line,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1640 int ts)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1641 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1642 int col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1643 int idx = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1644
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1645 while (line[idx])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1646 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1647 if (line[idx] == '\t')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1648 col += ts - (col % ts);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1649 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1650 col++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1651 idx++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1652 if (col >= wantedCol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1653 return idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1654 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1655
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1656 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1657 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1658
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1659 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1660 addMenu(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1661 char *menu, /* menu name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1662 char *accel, /* accelerator text (optional) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1663 char *verb) /* WorkShop action-verb */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1664 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1665 MenuMap *newMap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1666 char cbuf[BUFSIZ];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1667
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1668 if (menuMapSize >= menuMapMax)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1669 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1670 newMap = realloc(menuMap,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1671 sizeof(MenuMap) * (menuMapMax + MENU_INC));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1672 if (newMap != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1673 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1674 menuMap = newMap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1675 menuMapMax += MENU_INC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1676 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1677 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1678 if (menuMapSize < menuMapMax)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1679 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1680 menuMap[menuMapSize].name = strdup(menu);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1681 menuMap[menuMapSize].accel = accel && *accel ? strdup(accel) : NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1682 menuMap[menuMapSize++].verb = strdup(verb);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1683 if (accel && workshopHotKeysEnabled)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1684 {
273
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
1685 vim_snprintf(cbuf, sizeof(cbuf),
2463194c8cdd updated for version 7.0073
vimboss
parents: 189
diff changeset
1686 "map %s :wsverb %s<CR>", accel, verb);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1687 coloncmd(cbuf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1688 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1689 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1690 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1691
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1692 static char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1693 nameStrip(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1694 char *raw) /* menu name, possibly with & chars */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1695 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1696 static char buf[BUFSIZ]; /* build stripped name here */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1697 char *bp = buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1698
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1699 while (*raw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1700 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1701 if (*raw != '&')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1702 *bp++ = *raw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1703 raw++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1704 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1705 *bp = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1706 return buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1707 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1708
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1709
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1710 static char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1711 lookupVerb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1712 char *verb,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1713 int skip) /* number of matches to skip */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1714 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1715 int i; /* loop iterator */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1716
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1717 for (i = 0; i < menuMapSize; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1718 if (strcmp(menuMap[i].verb, verb) == 0 && skip-- == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1719 return nameStrip(menuMap[i].name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1720
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1721 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1722 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1723
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1724
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1725 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1726 coloncmd(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1727 char *cmd, /* the command to print */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1728 Boolean force) /* force cursor update */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1729 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1730 char_u *cpo_save = p_cpo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1731
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1732 #ifdef WSDEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1733 if (WSDLEVEL(WS_TRACE_COLONCMD))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1734 wsdebug("Cmd: %s\n", cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1735 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1736
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1737 p_cpo = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1738
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1739 ALT_INPUT_LOCK_ON;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1740 do_cmdline_cmd((char_u *)cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1741 ALT_INPUT_LOCK_OFF;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1742
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1743 p_cpo = cpo_save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1744
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1745 if (force)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1746 gui_update_screen();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1747 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1748
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1749 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1750 * setDollarVim - Given the run directory, search for the vim install
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1751 * directory and set $VIM.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1752 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1753 * We can be running out of SUNWspro/bin or out of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1754 * SUNWspro/contrib/contrib6/vim5.6/bin so we check
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1755 * relative to both of these directories.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1756 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1757 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1758 setDollarVim(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1759 char *rundir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1760 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1761 char buf[MAXPATHLEN];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1762 char *cp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1763
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1764 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1765 * First case: Running from <install-dir>/SUNWspro/bin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1766 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1767 strcpy(buf, rundir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1768 strcat(buf, "/../contrib/contrib6/vim" VIM_VERSION_SHORT "/share/vim/"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1769 VIM_VERSION_NODOT "/syntax/syntax.vim");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1770 if (access(buf, R_OK) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1771 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1772 strcpy(buf, "SPRO_WSDIR=");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1773 strcat(buf, rundir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1774 cp = strrchr(buf, '/');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1775 if (cp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1776 strcpy(cp, "/WS6U2");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1777 putenv(strdup(buf));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1778
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1779 strcpy(buf, "VIM=");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1780 strcat(buf, rundir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1781 strcat(buf, "/../contrib/contrib6/vim" VIM_VERSION_SHORT "/share/vim/"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1782 VIM_VERSION_NODOT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1783 putenv(strdup(buf));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1784 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1785 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1786
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1787 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1788 * Second case: Probably running from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1789 * <install-dir>/SUNWspro/contrib/contrib6/vim5.6/bin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1790 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1791 strcpy(buf, rundir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1792 strcat(buf, "/../../../contrib/contrib6/vim" VIM_VERSION_SHORT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1793 "/share/vim/" VIM_VERSION_NODOT "/syntax/syntax.vim");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1794 if (access(buf, R_OK) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1795 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1796 strcpy(buf, "SPRO_WSDIR=");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1797 strcat(buf, rundir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1798 cp = strrchr(buf, '/');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1799 if (cp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1800 strcpy(cp, "../../../../WS6U2");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1801 putenv(strdup(buf));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1802
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1803 strcpy(buf, "VIM=");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1804 strcat(buf, rundir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1805 strcat(buf, "/../../../contrib/contrib6/vim" VIM_VERSION_SHORT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1806 "/share/vim/" VIM_VERSION_NODOT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1807 putenv(strdup(buf));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1808 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1809 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1810 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1811
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1812 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1813 * findYourself - Find the directory we are running from. This is used to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1814 * set $VIM. We need to set this because users can install
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1815 * the package in a different directory than the compiled
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1816 * directory. This is a Sun Visual WorkShop requirement!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1817 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1818 * Note: We override a user's $VIM because it won't have the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1819 * WorkShop specific files. S/he may not like this but its
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1820 * better than getting the wrong files (especially as the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1821 * user is likely to have $VIM set to 5.4 or later).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1822 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1823 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1824 findYourself(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1825 char *argv0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1826 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1827 char *runpath = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1828 char *path;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1829 char *pathbuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1830
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1831 if (*argv0 == '/')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1832 runpath = strdup(argv0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1833 else if (*argv0 == '.' || strchr(argv0, '/'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1834 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1835 runpath = (char *) malloc(MAXPATHLEN);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1836 getcwd(runpath, MAXPATHLEN);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1837 strcat(runpath, "/");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1838 strcat(runpath, argv0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1839 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1840 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1841 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1842 path = getenv("PATH");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1843 if (path != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1844 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1845 runpath = (char *) malloc(MAXPATHLEN);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1846 pathbuf = strdup(path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1847 path = strtok(pathbuf, ":");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1848 do
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1849 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1850 strcpy(runpath, path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1851 strcat(runpath, "/");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1852 strcat(runpath, argv0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1853 if (access(runpath, X_OK) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1854 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1855 } while ((path = strtok(NULL, ":")) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1856 free(pathbuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1857 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1858 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1859
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1860 if (runpath != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1861 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1862 char runbuf[MAXPATHLEN];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1863
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1864 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1865 * We found the run directory. Now find the install dir.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1866 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1867 (void)vim_FullName((char_u *)runpath, (char_u *)runbuf, MAXPATHLEN, 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1868 path = strrchr(runbuf, '/');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1869 if (path != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1870 *path = NUL; /* remove the vim/gvim name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1871 path = strrchr(runbuf, '/');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1872 if (path != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1873 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1874 if (strncmp(path, "/bin", 4) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1875 setDollarVim(runbuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1876 else if (strncmp(path, "/src", 4) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1877 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1878 *path = NUL; /* development tree */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1879 setDollarVim(runbuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1880 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1881 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1882 free(runpath);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1883 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1884 }