Various minor feature/improvement requests

I installed 010 Editor the other day and immediately had a much better experience than with ImHex - just purchased my license. That being said, I also found a number of possible improvements (mostly minor stuff). It would be nice if these could be considered for a future release.

Text editor
Pressing Shift-Backspace does nothing, so if you’re in the middle of typing an all-caps enum member and make a typo, you need to let go of Shift, press Backspace, and then hold Shift again. Could Shift-Backspace be made to do the same as Backspace, as is also the case in e.g. Notepad++ and VS Code?

Shift-Tab only performs an unindent if you have multiple lines selected. It would be useful if this also worked for single lines - including without having anything selected at all - again like in the above editors. (I tried assigning it as a shortcut for the Format → Decrease Line Indent menu item, but pressing Shift-Tab in the “Press Shortcut” textbox changes the focus to another control rather than registering the shortcut.)

Typing { and pressing Enter automatically indents, but } doesn’t automatically unindent.

Even though template files get opened in a floating tab group, you can’t drag&drop additional templates onto that tab group to open those - you need to drop them on the main window instead.

Jumping to template fields doesn’t always work
If you run the following template, you’ll see that it correctly highlights both value fields:

typedef struct
{
    int value;
} Inner <style=sHeading2>;

typedef struct
{
    int value;
    local int prevPos = FTell();
    FSeek(0x10);
    Inner inner;
    FSeek(prevPos);
} Outer <style=sHeading1>;

Outer outer;

However, if you place the hex editor cursor in the second field and press Ctrl-J to jump to it in the Template Results, 010 says “No template variable found.”

It works if you expand outer in the Template Results, but because Inner is not an on-demand structure and because the highlighting shows that it did in fact get parsed, I would expect it to work straight away.

(The main real-life use case here is structures such as Inner getting pointed to by a file offset in Outer. If I see the Inner color in the hex editor, I’d like to jump to it in the template results to find the Outer struct that references it.)

Attributes for struct Data {…}
The following doesn’t work for some reason:

struct Data <style=sHeading1>
{
};

Neither does this:

struct Data
{
} <style=sHeading1>;

However, this does:

typedef struct
{
} Data <style=sHeading1>;

Is this intentional? It would be nice if one of the non-typedef variants were possible, as this would allow us to always place the struct name before its definition rather than after - just like we’re doing for enums and functions.

Compact field positioning syntax
I’m currently templating a file format that contains lots of file offsets to structures. Right now, I have to do the following each time:

int dataPos;

local int prevPos = FTell();
FSeek(dataPos);
Data data;
FSeek(prevPos);

This gets quite tedious after a while, especially if you compare it to ImHex where you can just do this:

s32 dataPos;
Data data @ dataPos;

Would it be possible to add something similar to 010?

bool data type
The scripting language has true and false keywords, but no bool data type. While we can of course just use byte, bool would better express the intended usage. (And although we can use typedef byte bool;, this doesn’t give us syntax highlighting.)

Declaring variables in for loops
The following is currently not possible:

for (local int i = 0; i < 10; i++)
{
}

Allowing it would make code a bit more compact.

Reference variables
This is already possible:

void workWithItem(Item& item)
{
    // Do stuff with item
}

Item items[100];
local int i;
for (i = 0; i < 100; i++)
{
    workWithItem(items[i]);
}

However, this is not (syntax error):

for (i = 0; i < 100; i++)
{
    local Item& item = items[i];
    // Do stuff with item
}

And neither is this (“Incompatible types” error):

local Item item = items[i];

So we either need to repeat items[i] (which could be a much longer expression) each time we want to access one of its fields, or write a function. Would it be possible to also allow reference variables?

FAlign(alignment) function
It could be useful to have a builtin function for seeking ahead to the next multiple of the given number, as some file formats have this kind of padding.


Overall, 010 has been great to work with so far, and I thank you for creating it.

Hello arc. Thanks for your message and lots of good ideas here. I’ve tried to answer your questions below:

Text Editor
We will get Shift+Backspace working in the future but you can fix it yourself now. To do this go to the ‘Shortcuts’ section of the Options dialog and under ‘Editor > Delete Previous’ enable the ‘Allow Multiple’ toggle. Then click the shortcut field and press Shift+Backspace on your keyboard. This should add a second shortcut.

Shift+Tab currently only works when lines are selected but you are right that it would be nice to work if nothing is selected too. We’ll have to make that change internally and I don’t think there is any way for a user to adjust this.

Unindent is coming and hopefully much smarter indent is coming too.

Yes, it would be nice if drag and drag from Windows Explorer would work on floating tabs and we’ll see if we can add that.

Jumping to template fields doesn’t always work
Yes, there are some bugs with jumping to template variables when structs contain variables outside their bounds (we call them disjoint structs). Some other functionality can break with disjoint structs too and we are going to be doing a better job in handling that in a future version.

Attributes for struct Data {…}
Only the typedef struct style of adding attributes currently works. It would be nice if this format worked too:

struct Data <style=sHeading1>
{
};

We’ll have to add that in. The middle format will only work when you create variables and the attributes are applied to each variable

Compact field positioning syntax
We have had a few requests to support the ‘@’ operator and we’re honestly on the fence. There is always a balance when creating a language whether to add a lot of features or try to minimize the number of things you can do (RISC versus CISC). The @ operator does make for cleaner code in this case and we are considering it. One complication is whether the @ operator is relative to the start of the file or to the start of the current struct. Maybe another operator is needed like @@ or @+ for relative to the start of the struct.

bool data type
We never added the bool data type by default because the size is ambiguous so we leave it up to the user to typedef it. In the next version syntax highlighting should work much better and will highlight bool by default if you typedef it.

Declaring variables in for loops
Yes, we’ve had a number of requests to support variables inside for statements like this. There are issues with scoping in templates where scoping works slightly differently than ANSI C but I think we should be able to add this in unless we run into any major issues.

Reference variables
Yes, you are correct that references are supported in functions and we are planning on adding support for references in general, it’s just getting all the details implemented.

FAlign(alignment) function
This is a nice idea for a function we we should be able to add it in.

Lots of interesting ideas and lots of work for us to do :). We’ll see what we can get in!

Graeme
SweetScape Software

Thank you for the in-depth reply!

For the “@” operator, I agree that having too many syntax features is also not a good thing. I found myself a middle ground in the meantime with two custom functions:

int dataPos;
SeekPush(dataPos);
Data data;
SeekPop();

This lessens the boilerplate and is already much more bearable than my first version.

Concerning bool, I thought it could be a built-in alias for byte, matching the 1-byte size it has in C++. But if we can typedef it and get it highlighted as though it were built-in, I would be perfectly fine with that.

Looking forward to the next release!