The story is apparently as following: hittung Undo() tries to restore to a previous state and to find out what this previous state is, it queries with SearchObjectByLocation() for the object to remove. This works in normal mode. It does not work in names-only mode, because in this case SearchObjectByLocation() doesn't accept a line object and returns empty, NO_TYPE.
The comment in action.c, line 6281, stating that this query always succeeds, is wrong.
I can see four solutions:
1. Add a lot more special case code to check not only for mode flags like ONLYNAMESFLAG in search.c, but also under which conditions this search happens. This easily makes one special case for every other case. 3 names modes x 12 drawing modes = 36 cases.
2. Disable modes like track drawing mode while in names only mode. Also a lot of code and on top of this, unexpected user behaviour ("I can't draw tracks anymore and don't know why").
3. Try to make Undo() independent from this query. It's "Undo", after all, no "undo the object under the crosshair", after all.
4. Remove these special modes. That'd be LOCKNAMESFLAG, HIDENAMESFLAG and ONLYNAMESFLAG. Chances are good they're barely known anyways and modal behaviour is usually considered to be bad for an inutitive user interface. It should certainly be possible to prefer or avoid text by the standard means (hiding or activating the corresponding layers).
The story is apparently as following: hittung Undo() tries to restore to a previous state and to find out what this previous state is, it queries with SearchObjectByL ocation( ) for the object to remove. This works in normal mode. It does not work in names-only mode, because in this case SearchObjectByL ocation( ) doesn't accept a line object and returns empty, NO_TYPE.
The comment in action.c, line 6281, stating that this query always succeeds, is wrong.
I can see four solutions:
1. Add a lot more special case code to check not only for mode flags like ONLYNAMESFLAG in search.c, but also under which conditions this search happens. This easily makes one special case for every other case. 3 names modes x 12 drawing modes = 36 cases.
2. Disable modes like track drawing mode while in names only mode. Also a lot of code and on top of this, unexpected user behaviour ("I can't draw tracks anymore and don't know why").
3. Try to make Undo() independent from this query. It's "Undo", after all, no "undo the object under the crosshair", after all.
4. Remove these special modes. That'd be LOCKNAMESFLAG, HIDENAMESFLAG and ONLYNAMESFLAG. Chances are good they're barely known anyways and modal behaviour is usually considered to be bad for an inutitive user interface. It should certainly be possible to prefer or avoid text by the standard means (hiding or activating the corresponding layers).
5.: 3. and 4. together.
I tend to do 4., then 3.