commit schismtracker for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package schismtracker for openSUSE:Factory checked in at 2024-03-29 13:10:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/schismtracker (Old) and /work/SRC/openSUSE:Factory/.schismtracker.new.1905 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "schismtracker" Fri Mar 29 13:10:36 2024 rev:29 rq:1163416 version:20240328 Changes: -------- --- /work/SRC/openSUSE:Factory/schismtracker/schismtracker.changes 2024-03-10 20:26:21.093815966 +0100 +++ /work/SRC/openSUSE:Factory/.schismtracker.new.1905/schismtracker.changes 2024-03-29 13:13:37.301003924 +0100 @@ -1,0 +2,7 @@ +Fri Mar 29 01:28:32 UTC 2024 - Jan Engelhardt <jengelh@inai.de> + +- Update to release 20240328 + * Fix entering line breaks into the message editor + * Don't abort when IT files report an order list size over 256 + +------------------------------------------------------------------- Old: ---- 20240308.tar.gz New: ---- 20240328.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ schismtracker.spec ++++++ --- /var/tmp/diff_new_pack.zGIqSq/_old 2024-03-29 13:13:37.945027582 +0100 +++ /var/tmp/diff_new_pack.zGIqSq/_new 2024-03-29 13:13:37.949027729 +0100 @@ -17,7 +17,7 @@ Name: schismtracker -Version: 20240308 +Version: 20240328 Release: 0 Summary: Music editor that matches the look and feel of Impulse Tracker License: GPL-2.0-or-later ++++++ 20240308.tar.gz -> 20240328.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240308/configure.ac new/schismtracker-20240328/configure.ac --- old/schismtracker-20240308/configure.ac 2024-03-09 03:29:25.000000000 +0100 +++ new/schismtracker-20240328/configure.ac 2024-03-29 01:43:25.000000000 +0100 @@ -85,7 +85,8 @@ dnl Headers, typedef crap, et al. AC_HEADER_DIRENT -AC_HEADER_TIME +AC_CHECK_HEADERS_ONCE([sys/time.h]) + AC_CHECK_HEADERS(inttypes.h fcntl.h limits.h signal.h unistd.h sys/param.h sys/ioctl.h sys/kd.h linux/fb.h byteswap.h sys/soundcard.h poll.h sys/poll.h) AM_CONDITIONAL([USE_OSS], [test "$ac_cv_header_sys_soundcard_h" = yes]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240308/fmt/flac.c new/schismtracker-20240328/fmt/flac.c --- old/schismtracker-20240308/fmt/flac.c 2024-03-09 03:29:25.000000000 +0100 +++ new/schismtracker-20240328/fmt/flac.c 2024-03-29 01:43:25.000000000 +0100 @@ -30,41 +30,50 @@ #include "disko.h" #include "sndfile.h" #include "log.h" +#include "util.h" #include <stdint.h> struct flac_file { FLAC__StreamMetadata_StreamInfo streaminfo; + struct { - char *name; - int32_t sample_rate; + char name[32]; + uint32_t sample_rate; uint8_t pan; uint8_t vol; struct { - uint32_t type; + int32_t type; uint32_t start; uint32_t end; } loop; } flags; + struct { const uint8_t* data; size_t len; - } raw_data; - uint8_t* uncomp_buf; + } compressed; + + struct { + uint8_t* data; + size_t len; + + uint32_t samples_decoded, samples_read; + } uncompressed; }; -static uint32_t samples_decoded = 0, samples_read = 0; -static size_t total_size = 0; static void on_meta(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { struct flac_file* flac_file = (struct flac_file*)client_data; int32_t loop_start = -1, loop_length = -1; + switch (metadata->type) { case FLAC__METADATA_TYPE_STREAMINFO: - flac_file->streaminfo = metadata->data.stream_info; + memcpy(&flac_file->streaminfo, &metadata->data.stream_info, sizeof(flac_file->streaminfo)); break; case FLAC__METADATA_TYPE_VORBIS_COMMENT: - for (FLAC__uint32 i = 0; i < metadata->data.vorbis_comment.num_comments; i++) { + for (size_t i = 0; i < metadata->data.vorbis_comment.num_comments; i++) { const char *tag = (const char*)metadata->data.vorbis_comment.comments[i].entry; const FLAC__uint32 length = metadata->data.vorbis_comment.comments[i].length; + if (length > 6 && !strncasecmp(tag, "TITLE=", 6) && flac_file->flags.name) strncpy(flac_file->flags.name, tag + 6, 32); else if (length > 11 && !strncasecmp(tag, "SAMPLERATE=", 11)) @@ -74,33 +83,35 @@ else if (length > 11 && !strncasecmp(tag, "LOOPLENGTH=", 11)) loop_length = strtol(tag + 11, NULL, 10); } + if (loop_start > 0 && loop_length > 1) { flac_file->flags.loop.type = 0; flac_file->flags.loop.start = loop_start; flac_file->flags.loop.end = loop_start + loop_length - 1; } + break; case FLAC__METADATA_TYPE_APPLICATION: { const uint8_t *data = (const uint8_t *)metadata->data.application.data; - uint32_t chunk_id = *(uint32_t *)data; data += 4; - uint32_t chunk_len = *(uint32_t *)data; data += 4; + uint32_t chunk_id = *(uint32_t*)data; data += sizeof(uint32_t); + uint32_t chunk_len = *(uint32_t*)data; data += sizeof(uint32_t); if (chunk_id == 0x61727478 && chunk_len >= 8) { // "xtra" - uint32_t xtra_flags = *(uint32_t *)data; data += 4; + uint32_t xtra_flags = *(uint32_t*)data; data += sizeof(uint32_t); // panning (0..256) if (xtra_flags & 0x20) { - uint16_t tmp_pan = *(uint16_t *)data; + uint16_t tmp_pan = *(uint16_t*)data; if (tmp_pan > 255) tmp_pan = 255; flac_file->flags.pan = (uint8_t)tmp_pan; } - data += 2; + data += sizeof(uint16_t); // volume (0..256) - uint16_t tmp_vol = *(uint16_t *)data; + uint16_t tmp_vol = *(uint16_t*)data; if (tmp_vol > 256) tmp_vol = 256; @@ -110,13 +121,13 @@ if (chunk_id == 0x6C706D73 && chunk_len > 52) { // "smpl" data += 28; // seek to first wanted byte - uint32_t num_loops = *(uint32_t *)data; data += 4; + uint32_t num_loops = *(uint32_t *)data; data += sizeof(uint32_t); if (num_loops == 1) { - data += 4+4; // skip "samplerData" and "identifier" + data += 4 + 4; // skip "samplerData" and "identifier" - flac_file->flags.loop.type = *(uint32_t *)data; data += 4; - flac_file->flags.loop.start = *(uint32_t *)data; data += 4; - flac_file->flags.loop.end = *(uint32_t *)data; data += 4; + flac_file->flags.loop.type = *(uint32_t *)data; data += sizeof(uint32_t); + flac_file->flags.loop.start = *(uint32_t *)data; data += sizeof(uint32_t); + flac_file->flags.loop.end = *(uint32_t *)data; data += sizeof(uint32_t); } } break; @@ -125,18 +136,20 @@ break; } - (void)client_data; - (void)decoder; + (void)decoder, (void)client_data; } static FLAC__StreamDecoderReadStatus on_read(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) { struct flac_file* flac_file = (struct flac_file*)client_data; - if (samples_read < flac_file->raw_data.len) { - if (*bytes > (flac_file->raw_data.len-samples_read)) - *bytes = flac_file->raw_data.len-samples_read; - memcpy(buffer, flac_file->raw_data.data+samples_read, *bytes); - samples_read += *bytes; + if (flac_file->uncompressed.samples_read < flac_file->compressed.len) { + size_t needed = flac_file->compressed.len - flac_file->uncompressed.samples_read; + if (*bytes > needed) + *bytes = needed; + + memcpy(buffer, flac_file->compressed.data + flac_file->uncompressed.samples_read, *bytes); + flac_file->uncompressed.samples_read += *bytes; + return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; } else { *bytes = 0; @@ -146,86 +159,67 @@ (void)decoder; } -static void on_error(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - (void)decoder, (void)client_data; - +static void on_error(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) { log_appendf(4, "Error loading FLAC: %s", FLAC__StreamDecoderErrorStatusString[status]); + + (void)decoder, (void)client_data; } static FLAC__StreamDecoderWriteStatus on_write(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *const buffer[], void *client_data) { struct flac_file* flac_file = (struct flac_file*)client_data; - if (!flac_file->streaminfo.total_samples || !flac_file->streaminfo.channels) + /* invalid? */ + if (!flac_file->streaminfo.total_samples || !flac_file->streaminfo.channels + || flac_file->streaminfo.channels > 2) return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - if (flac_file->streaminfo.channels > 2) - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; + if (frame->header.number.sample_number == 0) { + /* allocate our buffer */ + flac_file->uncompressed.len = (size_t)(flac_file->streaminfo.total_samples * flac_file->streaminfo.channels * flac_file->streaminfo.bits_per_sample/8); + flac_file->uncompressed.data = (uint8_t*)mem_alloc(flac_file->uncompressed.len * ((flac_file->streaminfo.bits_per_sample == 8) ? sizeof(int8_t) : sizeof(int16_t))); - switch (flac_file->streaminfo.bits_per_sample) { - case 8: case 12: case 16: - case 20: case 24: case 32: - break; - default: - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; + flac_file->uncompressed.samples_decoded = 0; } - if (frame->header.number.sample_number == 0) - { - total_size = (size_t)(flac_file->streaminfo.total_samples * flac_file->streaminfo.channels * flac_file->streaminfo.bits_per_sample/8); - flac_file->uncomp_buf = (uint8_t*)malloc(total_size * ((flac_file->streaminfo.bits_per_sample == 8) ? sizeof(int8_t) : sizeof(int16_t))); - if (flac_file->uncomp_buf == NULL) { - log_appendf(4, "Error loading FLAC: Out of memory!"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } + uint32_t block_size = frame->header.blocksize * flac_file->streaminfo.channels; - samples_decoded = 0; - } + const uint32_t samples_allocated = flac_file->streaminfo.total_samples * flac_file->streaminfo.channels; + if (flac_file->uncompressed.samples_decoded + block_size > samples_allocated) + block_size = samples_allocated - flac_file->uncompressed.samples_decoded; - /* this isn't true, but it works fine for what we do */ - uint32_t block_size = frame->header.blocksize*flac_file->streaminfo.channels; + if (flac_file->streaminfo.bits_per_sample <= 8) { + int8_t* buf_ptr = flac_file->uncompressed.data + flac_file->uncompressed.samples_decoded; + uint32_t bit_shift = 8 - flac_file->streaminfo.bits_per_sample; - const uint32_t samples_allocated = flac_file->streaminfo.total_samples*flac_file->streaminfo.channels; - if (samples_decoded+block_size > samples_allocated) - block_size = samples_allocated - samples_decoded; - - uint32_t i = 0, j = 0; - switch (flac_file->streaminfo.bits_per_sample) { - case 8: { - int8_t *buf_ptr = flac_file->uncomp_buf + samples_decoded; - for (i = 0, j = 0; i < block_size; j++) { - buf_ptr[i++] = (int8_t)buffer[0][j]; - if (flac_file->streaminfo.channels == 2) - buf_ptr[i++] = (int8_t)buffer[1][j]; - } - break; + size_t i, j; + for (i = 0, j = 0; i < block_size; j++) { + buf_ptr[i++] = (int8_t)(buffer[0][j] << bit_shift); + if (flac_file->streaminfo.channels == 2) + buf_ptr[i++] = (int8_t)(buffer[1][j] << bit_shift); } - /* here we cheat by just increasing 12-bit to 16-bit */ - case 12: case 16: { - int16_t *buf_ptr = (int16_t*)flac_file->uncomp_buf + samples_decoded; - uint32_t bit_shift = 16 - flac_file->streaminfo.bits_per_sample; - for (i = 0, j = 0; i < block_size; j++) { - buf_ptr[i++] = buffer[0][j] << bit_shift; - if (flac_file->streaminfo.channels == 2) - buf_ptr[i++] = buffer[1][j] << bit_shift; - } - break; + } else if (flac_file->streaminfo.bits_per_sample <= 16) { + int16_t* buf_ptr = (int16_t*)flac_file->uncompressed.data + flac_file->uncompressed.samples_decoded; + uint32_t bit_shift = 16 - flac_file->streaminfo.bits_per_sample; + + size_t i, j; + for (i = 0, j = 0; i < block_size; j++) { + buf_ptr[i++] = buffer[0][j] << bit_shift; + if (flac_file->streaminfo.channels == 2) + buf_ptr[i++] = buffer[1][j] << bit_shift; } - /* here we just make everything 16-bit, we don't support - 24-bit anyway */ - case 20: case 24: case 32: { - int16_t *buf_ptr = (int16_t*)flac_file->uncomp_buf + samples_decoded; - uint32_t bit_shift = flac_file->streaminfo.bits_per_sample - 16; - for (i = 0, j = 0; i < block_size; j++) { - buf_ptr[i++] = buffer[0][j] >> bit_shift; - if (flac_file->streaminfo.channels == 2) - buf_ptr[i++] = buffer[1][j] >> bit_shift; - } - break; + } else { /* >= 16 */ + int16_t* buf_ptr = (int16_t*)flac_file->uncompressed.data + flac_file->uncompressed.samples_decoded; + uint32_t bit_shift = flac_file->streaminfo.bits_per_sample - 16; + + size_t i, j; + for (i = 0, j = 0; i < block_size; j++) { + buf_ptr[i++] = buffer[0][j] >> bit_shift; + if (flac_file->streaminfo.channels == 2) + buf_ptr[i++] = buffer[1][j] >> bit_shift; } } - samples_decoded += block_size; + flac_file->uncompressed.samples_decoded += block_size; return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; @@ -233,20 +227,26 @@ } #define FLAC_ERROR(x) \ - if (decoder != NULL) FLAC__stream_decoder_delete(decoder); \ - return x -static int flac_load(struct flac_file* flac_file, size_t len, int meta_only) { - if (memcmp(flac_file->raw_data.data, "fLaC", 4)) + do { \ + if (!decoder) FLAC__stream_decoder_delete(decoder); \ + return x; \ + } while (0); + +static int flac_load(struct flac_file* flac_file, int meta_only) { + if (flac_file->compressed.len < 4) return 0; - FLAC__StreamDecoder *decoder = FLAC__stream_decoder_new(); - if (decoder == NULL) + + if (memcmp(flac_file->compressed.data, "fLaC", 4)) + return 0; + + FLAC__StreamDecoder* decoder = FLAC__stream_decoder_new(); + if (!decoder) return 0; FLAC__stream_decoder_set_metadata_respond_all(decoder); FLAC__StreamDecoderInitStatus initStatus = - FLAC__stream_decoder_init_stream - ( + FLAC__stream_decoder_init_stream( decoder, on_read, NULL, NULL, NULL, @@ -256,32 +256,29 @@ ); if (meta_only) { - if (!FLAC__stream_decoder_process_until_end_of_metadata(decoder)) { + if (!FLAC__stream_decoder_process_until_end_of_metadata(decoder)) FLAC_ERROR(0); - } } else { - if (!FLAC__stream_decoder_process_until_end_of_stream(decoder)) { + if (!FLAC__stream_decoder_process_until_end_of_stream(decoder)) FLAC_ERROR(0); - } } FLAC__stream_decoder_finish(decoder); FLAC__stream_decoder_delete(decoder); + return 1; } #undef FLAC_ERROR int fmt_flac_load_sample(const uint8_t *data, size_t len, song_sample_t *smp) { - samples_read = 0; - samples_decoded = 0; - total_size = 0; - struct flac_file flac_file; - flac_file.raw_data.data = data; - flac_file.raw_data.len = len; - flac_file.flags.name = smp->name; - flac_file.flags.sample_rate = -1; + struct flac_file flac_file = {0}; + flac_file.compressed.data = data; + flac_file.compressed.len = len; + strncpy(flac_file.flags.name, smp->name, ARRAY_SIZE(flac_file.flags.name)); + flac_file.flags.sample_rate = 0; flac_file.flags.loop.type = -1; - if (!flac_load(&flac_file, len, 0)) + + if (!flac_load(&flac_file, 0)) return 0; smp->volume = 64 * 4; @@ -290,50 +287,40 @@ smp->length = flac_file.streaminfo.total_samples; if (flac_file.flags.loop.type != -1) { smp->loop_start = flac_file.flags.loop.start; - smp->loop_end = flac_file.flags.loop.end+1; + smp->loop_end = flac_file.flags.loop.end + 1; smp->flags |= (flac_file.flags.loop.type ? (CHN_LOOP | CHN_PINGPONGLOOP) : CHN_LOOP); } - if (flac_file.flags.sample_rate > 0) { + + if (flac_file.flags.sample_rate) smp->c5speed = flac_file.flags.sample_rate; - } // endianness uint32_t flags = SF_LE; + // channels flags |= (flac_file.streaminfo.channels == 2) ? SF_SI : SF_M; + // bit width - switch (flac_file.streaminfo.bits_per_sample) { - case 8: flags |= SF_8; break; - case 12: - case 16: - case 20: - case 24: - case 32: flags |= SF_16; break; - default: - free(flac_file.uncomp_buf); - return 0; - } + flags |= (flac_file.streaminfo.bits_per_sample <= 8) ? SF_8 : SF_16; + // libFLAC always returns signed flags |= SF_PCMS; - int ret = csf_read_sample(smp, flags, flac_file.uncomp_buf, total_size); - free(flac_file.uncomp_buf); + + int ret = csf_read_sample(smp, flags, flac_file.uncompressed.data, flac_file.uncompressed.len); + free(flac_file.uncompressed.data); return ret; } int fmt_flac_read_info(dmoz_file_t *file, const uint8_t *data, size_t len) { - samples_read = 0; - samples_decoded = 0; - total_size = 0; - struct flac_file flac_file; - flac_file.raw_data.data = data; - flac_file.raw_data.len = len; - flac_file.flags.name = NULL; + struct flac_file flac_file = {0}; + flac_file.compressed.data = data; + flac_file.compressed.len = len; flac_file.flags.loop.type = -1; - if (!flac_load(&flac_file, len, 1)) { + + if (!flac_load(&flac_file, 1)) return 0; - } file->smp_flags = 0; @@ -342,32 +329,23 @@ !flac_file.streaminfo.channels) return 0; - switch (flac_file.streaminfo.bits_per_sample) { - case 12: - case 16: - case 20: - case 24: - case 32: - file->smp_flags |= CHN_16BIT; - case 8: - break; - default: - return 0; - } + if (flac_file.streaminfo.bits_per_sample > 8) + file->smp_flags |= CHN_16BIT; if (flac_file.streaminfo.channels == 2) file->smp_flags |= CHN_STEREO; file->smp_speed = flac_file.streaminfo.sample_rate; file->smp_length = flac_file.streaminfo.total_samples; + if (flac_file.flags.loop.type != -1) { file->smp_loop_start = flac_file.flags.loop.start; - file->smp_loop_end = flac_file.flags.loop.end+1; + file->smp_loop_end = flac_file.flags.loop.end + 1; file->smp_flags |= (flac_file.flags.loop.type ? (CHN_LOOP | CHN_PINGPONGLOOP) : CHN_LOOP); } - if (flac_file.flags.sample_rate > 0) { + + if (flac_file.flags.sample_rate) file->smp_speed = flac_file.flags.sample_rate; - } file->description = "FLAC Audio File"; file->type = TYPE_SAMPLE_COMPR; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240308/fmt/it.c new/schismtracker-20240328/fmt/it.c --- old/schismtracker-20240308/fmt/it.c 2024-03-09 03:29:25.000000000 +0100 +++ new/schismtracker-20240328/fmt/it.c 2024-03-29 01:43:25.000000000 +0100 @@ -505,8 +505,8 @@ hdr.reserved = bswapLE32(hdr.reserved); // Screwy limits? - if (hdr.ordnum > MAX_ORDERS || hdr.insnum > MAX_INSTRUMENTS - || hdr.smpnum > MAX_SAMPLES || hdr.patnum > MAX_PATTERNS) { + if (hdr.insnum > MAX_INSTRUMENTS || hdr.smpnum > MAX_SAMPLES + || hdr.patnum > MAX_PATTERNS) { return LOAD_FORMAT_ERROR; } @@ -516,7 +516,7 @@ song->title[25] = 0; rtrim_string(song->title); - if (hdr.cmwt < 0x0214) + if (hdr.cmwt < 0x0214 && hdr.cwtv < 0x0214) ignoremidi = 1; if (hdr.special & 4) { /* "reserved" bit, experimentally determined to indicate presence of otherwise-documented row @@ -571,7 +571,28 @@ channel->volume = MIN(hdr.chan_vol[n], 64); } - slurp_read(fp, song->orderlist, hdr.ordnum); + /* only read what we can and ignore the rest */ + slurp_read(fp, song->orderlist, MIN(hdr.ordnum, MAX_ORDERS)); + + /* show a warning in the message log if there's too many orders */ + if (hdr.ordnum > MAX_ORDERS) { + const int lostord = hdr.ordnum - MAX_ORDERS; + int show_warning = 1; + + /* special exception: ordnum == 257 is valid ONLY if the final order is ORDER_LAST */ + if (lostord == 1) { + uint8_t ord; + slurp_read(fp, &ord, sizeof(ord)); + + show_warning = (ord != ORDER_LAST); + } else { + slurp_seek(fp, SEEK_CUR, lostord); + } + + if (show_warning) + log_appendf(4, " Warning: Too many orders in the order list (%d skipped)", lostord); + } + slurp_read(fp, para_ins, 4 * hdr.insnum); slurp_read(fp, para_smp, 4 * hdr.smpnum); slurp_read(fp, para_pat, 4 * hdr.patnum); @@ -614,7 +635,7 @@ } if (ignoremidi) { if (hdr.special & 8) { - log_appendf(4, " Warning: ignoring embedded MIDI data (CMWT is too old)"); + log_appendf(4, " Warning: ignoring embedded MIDI data (CWTV/CMWT is too old)"); slurp_seek(fp, sizeof(midi_config_t), SEEK_CUR); } memset(&song->midi_config, 0, sizeof(midi_config_t)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240308/include/headers.h new/schismtracker-20240328/include/headers.h --- old/schismtracker-20240308/include/headers.h 2024-03-09 03:29:25.000000000 +0100 +++ new/schismtracker-20240328/include/headers.h 2024-03-29 01:43:25.000000000 +0100 @@ -137,16 +137,10 @@ #ifdef NEED_TIME -# if TIME_WITH_SYS_TIME +# if HAVE_SYS_TIME_H # include <sys/time.h> -# include <time.h> -# else -# if HAVE_SYS_TIME_H -# include <sys/time.h> -# else -# include <time.h> -# endif # endif +# include <time.h> # ifndef timersub // from FreeBSD # define timersub(tvp, uvp, vvp) \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/schismtracker-20240308/schism/page_message.c new/schismtracker-20240328/schism/page_message.c --- old/schismtracker-20240308/schism/page_message.c 2024-03-09 03:29:25.000000000 +0100 +++ new/schismtracker-20240328/schism/page_message.c 2024-03-29 01:43:25.000000000 +0100 @@ -110,18 +110,13 @@ (*line) = (*line) - 1; if (*line < 0) *line = 0; len = get_nth_line(text, *line, &ptr); - if (len < 0) { - *ch = 0; - } else { - *ch = len; - } + *ch = (len < 0) ? 0 : len; pos = 0; - } else if (len >= pos) { *ch = pos; pos = 0; } else { - pos -= (len+1); /* EOC */ + pos -= (len + 1); /* EOC */ (*line) = (*line) + 1; } } @@ -563,11 +558,10 @@ return 0; for (; *text; text++) { - if (*text == '\n' || *text == '\t' || *text >= 32) { - if (clippy_owner(CLIPPY_SELECT) == widgets_message) - _delete_selection(); - message_insert_char(*text); - } else return 0; + if (clippy_owner(CLIPPY_SELECT) == widgets_message) + _delete_selection(); + + message_insert_char(*text); } return 1; } @@ -695,16 +689,32 @@ return 0; if (k->state == KEY_RELEASE) return 1; - if (k->sym.sym && clippy_owner(CLIPPY_SELECT) == widgets_message) { + + if (clippy_owner(CLIPPY_SELECT) == widgets_message) _delete_selection(); - } else { + else message_delete_next_char(); - } + return 1; + case SDLK_RETURN: + if (NO_MODIFIER(k->mod)) { + if (k->state == KEY_RELEASE) + return 1; + + if (clippy_owner(CLIPPY_SELECT) == widgets_message) + _delete_selection(); + + message_insert_char('\r'); + + return 1; + } + return 0; default: + /* keybinds... */ if (k->mod & KMOD_CTRL) { if (k->state == KEY_RELEASE) return 1; + if (k->sym.sym == SDLK_t) { message_extfont = !message_extfont; break; @@ -716,6 +726,7 @@ } else if (k->mod & KMOD_ALT) { if (k->state == KEY_RELEASE) return 1; + if (k->sym.sym == SDLK_c) { prompt_message_clear(); return 1;
participants (1)
-
Source-Sync