Cube  Diff

Differences From Artifact [2a75e21fbb]:

To Artifact [45e0d06f5e]:


122
123
124
125
126
127
128
129




130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192

193
194
195
196
197
198
199
	}
}
COMMANDN(bind, bindkey, ARG_2STR)

void
saycommand(char *init) // turns input to the command line on or off
{
	SDL_EnableUNICODE(saycommandon = (init != NULL));




	if (!editmode)
		keyrepeat(saycommandon);
	if (!init)
		init = "";
	strcpy_s(commandbuf, init);
}
COMMAND(saycommand, ARG_VARI)

void
mapmsg(OFString *s)
{
	@autoreleasepool {
		strn0cpy(hdr.maptitle, s.UTF8String, 128);
	}
}
COMMAND(mapmsg, ARG_1STR)

#if !defined(OF_WINDOWS) && !defined(OF_MACOS)
# include <SDL_syswm.h>
# include <X11/Xlib.h>
#endif

void
pasteconsole()
{
#if defined(OF_WINDOWS)
	if (!IsClipboardFormatAvailable(CF_TEXT))
		return;
	if (!OpenClipboard(NULL))
		return;
	char *cb = (char *)GlobalLock(GetClipboardData(CF_TEXT));
	strcat_s(commandbuf, cb);
	GlobalUnlock(cb);
	CloseClipboard();
#elif !defined(OF_MACOS)
	SDL_SysWMinfo wminfo;
	SDL_VERSION(&wminfo.version);
	wminfo.subsystem = SDL_SYSWM_X11;
	if (!SDL_GetWMInfo(&wminfo))
		return;
	int cbsize;
	char *cb = XFetchBytes(wminfo.info.x11.display, &cbsize);
	if (!cb || !cbsize)
		return;
	int commandlen = strlen(commandbuf);
	for (char *cbline = cb, *cbend;
	     commandlen + 1 < _MAXDEFSTR && cbline < &cb[cbsize];
	     cbline = cbend + 1) {
		cbend = (char *)memchr(cbline, '\0', &cb[cbsize] - cbline);
		if (!cbend)
			cbend = &cb[cbsize];
		if (commandlen + cbend - cbline + 1 > _MAXDEFSTR)
			cbend = cbline + _MAXDEFSTR - commandlen - 1;
		memcpy(&commandbuf[commandlen], cbline, cbend - cbline);
		commandlen += cbend - cbline;
		commandbuf[commandlen] = '\n';
		if (commandlen + 1 < _MAXDEFSTR && cbend < &cb[cbsize])
			++commandlen;
		commandbuf[commandlen] = '\0';
	};
	XFree(cb);
#endif
};


cvector vhistory;
int histpos = 0;

void
history(int n)
{







|
>
>
>
>

|















<
<
<
<
<



<
<
<
|
<
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
>







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150





151
152
153



154


155































156
157
158
159
160
161
162
163
	}
}
COMMANDN(bind, bindkey, ARG_2STR)

void
saycommand(char *init) // turns input to the command line on or off
{
	saycommandon = (init != NULL);
	if (saycommandon)
		SDL_StartTextInput();
	else
		SDL_StopTextInput();
	if (!editmode)
		keyrepeat = saycommandon;
	if (!init)
		init = "";
	strcpy_s(commandbuf, init);
}
COMMAND(saycommand, ARG_VARI)

void
mapmsg(OFString *s)
{
	@autoreleasepool {
		strn0cpy(hdr.maptitle, s.UTF8String, 128);
	}
}
COMMAND(mapmsg, ARG_1STR)






void
pasteconsole()
{



	char *cb = SDL_GetClipboardText();


	strcat_s(commandbuf, cb);































}

cvector vhistory;
int histpos = 0;

void
history(int n)
{