I don't know how to quote from other users' posts or do attachments etc so apologies in advance for blunders.
filbo wrote: ↑Sun Dec 28, 2025 1:31 am
Your paste pipeline is apparently sending in CR (0x0D) and LF (0x0A), while Holger only expected one of those (probably LF). So, RnD should silently absorb one or both of those.
I think Holger has implemented it handling CRLF, and the 2 characters are treated as one when pasting this way; so the question mark element is a response to CRLF, rather than to LF alone. I say this because the feature also handles Tabs, which are a single character, this way.
Your example shows some '?' in left column (well, left column of what I assume is the rectangular area you were targeting with your paste). But not every line starts with one, so I deduce that these are at the end of each line (we can't see the right-ends of your '#include' etc. lines). So, that makes sense: the input stream would have been like '#include <foo.h><CR><LF><CR><LF><CR><LF>#define blah...' -- in which CR generates a '?' at the end of each line (which also happens to be the beginning, on the two blank lines); and LF moves on to the beginning of the next line.
Yes I think I pasted from RnD, \src\editor.c
from the start, for about 100 lines.
i.e.
// ============================================================================
// Rocks'n'Diamonds - McDuffin Strikes Back!
// ----------------------------------------------------------------------------
// (c) 1995-2014 by Artsoft Entertainment
// Holger Schemel
//
info@artsoft.org
//
https://www.artsoft.org/
// ----------------------------------------------------------------------------
// editor.c
// ============================================================================
#include <math.h>
#include "libgame/libgame.h"
#include "editor.h"
#include "screens.h"
#include "tools.h"
#include "files.h"
#include "game.h"
#include "init.h"
#include "tape.h"
#define INFOTEXT_UNKNOWN_ELEMENT "unknown"
// ----------------------------------------------------------------------------
// screen and artwork graphic pixel position definitions
// ----------------------------------------------------------------------------
// values for the control window
#define ED_CTRL1_BUTTONS_HORIZ 4 // toolbox
#define ED_CTRL1_BUTTONS_VERT 4
#define ED_CTRL2_BUTTONS_HORIZ 3 // level
#define ED_CTRL2_BUTTONS_VERT 2
#define ED_CTRL3_BUTTONS_HORIZ 3 // CE and GE
#define ED_CTRL3_BUTTONS_VERT 1
#define ED_CTRL4_BUTTONS_HORIZ 2 // CE and GE
#define ED_CTRL4_BUTTONS_VERT 1
#define ED_CTRL5_BUTTONS_HORIZ 1 // properties
#define ED_CTRL5_BUTTONS_VERT 1
#define ED_CTRL6_BUTTONS_HORIZ 3 // properties
#define ED_CTRL6_BUTTONS_VERT 1
#define ED_CTRL7_BUTTONS_HORIZ 1 // palette
#define ED_CTRL7_BUTTONS_VERT 1
#define ED_NUM_CTRL1_BUTTONS (ED_CTRL1_BUTTONS_HORIZ * ED_CTRL1_BUTTONS_VERT)
#define ED_NUM_CTRL2_BUTTONS (ED_CTRL2_BUTTONS_HORIZ * ED_CTRL2_BUTTONS_VERT)
#define ED_NUM_CTRL3_BUTTONS (ED_CTRL3_BUTTONS_HORIZ * ED_CTRL3_BUTTONS_VERT)
#define ED_NUM_CTRL4_BUTTONS (ED_CTRL4_BUTTONS_HORIZ * ED_CTRL4_BUTTONS_VERT)
#define ED_NUM_CTRL5_BUTTONS (ED_CTRL5_BUTTONS_HORIZ * ED_CTRL5_BUTTONS_VERT)
and so on, but above is what corresponds to in the screenshot of the level I have attached, see below.
And you're sending TAB characters. For that, primarily, I would suggest that you shouldn't be sending TAB characters! Deal with that at your source end.
But, of course, RnD should also do something sensible with those. Which I would suggest is either: ignore completely; or move one space forward (not overwriting a grid square, just skipping it).
Yes, moving forward/to the right just 'fits' with the concept of a Tab.
The real-world situation for encountering Tabs is, if you copy from a spreadsheet; every cell has a Tab following it, followed [optionally] by another cell, and so on. Not sure if trailing Tabs are excluded by Windows Clipboard.
The Tabs are because spreadsheet cells contain variable-length data, unlike RnD element token values [numeric], but the same as RnD element token values [string], which have now been implemented as a means of data transfer, but which I would like to keep out of this post.
Even if Tabs were interpreted as I want, pasting from a spreadsheet into RnD would 'explode' the result, by putting an additional column between each non-tab character. Which might be what is wanted sometimes, but not usually.
I can deal with this by pasting into a text editor and removing all Tabs, for sure.
Spaces, I think, should be handled as 'put a space of the currently-being-written character set into the grid square'. Otherwise you would have unpleasantly weird results from pasting 'this is a test' into the middle of some noisy field.
This is where we most definitely disagree; I love the idea of 'merging' text into preexisting levels, as opposed to just a 'replace all', which is what a paste usually is.
My suggestion is to have the ability to do both, maybe with different commands (Ctrl+V vs Ctrl+Shift+V? Ctrl+Alt+V?)
TABs in source files mean that the same source displays differently in every editing / viewing tool, differently in every user's editor. And they can leave behind invisible detritus (stuff like 'space space TAB space TAB TAB' -- you can't see the spaces, but they can have a real effect in some situations). Any project with >1 person editing code should shun TABs. I mean, it should be in the project rules: NO TABs, PERIOD, except in Makefiles or any other obscure example where they're required by the file's language syntax. The 'commit to source code management' pipeline (`git commit` or whatever) should have an active 'hook' that errors out if it smells TABs.
[/quote]
I only use VBA, and in many situations the VBIDE replaces Tabs with runs of Spaces, typically 4. But no I wouldn't see any need to paste from the VBIDE into RnD. I see I made a mistake by using a source code file to test; I should have gone ahead with a spreadsheet example, which is much more real-world, because a spreadsheet can be used to do level operations that are difficult in RnD, e.g.
- insert rows between rows
- insert columns between columns
- autogenerate a level, 15 by 15, containing one each of elements 000 to 224
- drag and drop blocks of cells, instead of only being able to copy-paste them, as with the Grab Brush [apologies if it does have a cut-paste feature and I haven't learned it]
- delete n rows or no columns from anywhere in the level
- do scripted operations, eg a series of replaces
I will try to rustle up a spreadsheet example sometime.
John