Differences From Artifact [6b830d51dc]:
- File src/console.mm — part of check-in [b81e2948d7] at 2025-03-15 23:42:51 on branch trunk — Migrate last strings (user: js, size: 6286) [annotate] [blame] [check-ins using]
To Artifact [c4ec2131b8]:
- File
src/console.mm
— part of check-in
[489124a92f]
at
2025-03-16 10:11:39
on branch trunk
— Use one autorelease pool per frame
This way, nowhere else autorelease pools need to be managed. (user: js, size: 6146) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
79 80 81 82 83 84 85 | fflush(stdout); #endif } void conoutf(OFConstantString *format, ...) { | < | | | | | | | | | | | < | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | fflush(stdout); #endif } void conoutf(OFConstantString *format, ...) { va_list arguments; va_start(arguments, format); OFString *string = [[OFString alloc] initWithFormat:format arguments:arguments]; va_end(arguments); int n = 0; while (string.length > WORDWRAP) { conline([string substringToIndex:WORDWRAP], n++ != 0); string = [string substringFromIndex:WORDWRAP]; } conline(string, n != 0); } // render buffer taking into account time & scrolling void renderconsole() { int nd = 0; |
︙ | ︙ | |||
177 178 179 180 181 182 183 | commandbuf = [init mutableCopy]; } COMMAND(saycommand, ARG_VARI) void mapmsg(OFString *s) { | < | | < < | < | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | commandbuf = [init mutableCopy]; } COMMAND(saycommand, ARG_VARI) void mapmsg(OFString *s) { memset(hdr.maptitle, '\0', sizeof(hdr.maptitle)); strncpy(hdr.maptitle, s.UTF8String, 127); } COMMAND(mapmsg, ARG_1STR) void pasteconsole() { [commandbuf appendString:@(SDL_GetClipboardText())]; } static OFMutableArray<OFString *> *vhistory; static int histpos = 0; void history(int n) |
︙ | ︙ | |||
258 259 260 261 262 263 264 | default: resetcomplete(); } } else { if (code == SDLK_RETURN) { if (commandbuf.length > 0) { | < | | | | | | | | | < < | < | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | default: resetcomplete(); } } else { if (code == SDLK_RETURN) { if (commandbuf.length > 0) { if (vhistory == nil) vhistory = [[OFMutableArray alloc] init]; if (vhistory.count == 0 || ![vhistory.lastObject isEqual:commandbuf]) { // cap this? [vhistory addObject:[commandbuf copy]]; } histpos = vhistory.count; if ([commandbuf hasPrefix:@"/"]) execute(commandbuf, true); else toserver(commandbuf); } |
︙ | ︙ |