pkulchenko / ZeroBraneStudio

Lightweight Lua-based IDE for Lua with code completion, syntax highlighting, live coding, remote debugger, and code analyzer; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and other Lua interpreters on Windows, macOS, and Linux
http://studio.zerobrane.com/
Other
2.6k stars 519 forks source link

Filenames starting with `$` are not handled correctly #1108

Closed pkulchenko closed 3 years ago

pkulchenko commented 3 years ago

This is a continuation of the discussion that started in #1107

pkulchenko commented 3 years ago

This turns out to be related to the normalization function that also takes into account environment variable replacement: https://docs.wxwidgets.org/trunk/filename_8h.html#a18dd81e40b3fad4a089077e28e5dce22abbef459f086e433d5d40cc35aa56ff25. I'll have to look into disabling it, but there are some other implications that need to be taken into account.

pkulchenko commented 3 years ago

It also looks like the settings with $ values following a slash are not restored correctly by the wxwidgets component. For example, "foo\bar\$baz" gets restored to "foo\bar\$baz" (the second slash before $ is missing), which then throws "invalid escape" message during deserialization.

qgenesist commented 3 years ago

The problem also occurs with files that start with %. I wonder if there is some magic problem in the wx code?

files that start with: ! exclamation

pound

& ampersand ( left paren ) right paren , comma . period ' single quote ; semicolon @ at ^ power _ underline ` accent ~ not { left brace } right brace

This is windows only Paul, so I am sure there are other concerns with other os', that may make other things possible or impossible for file naming.

pkulchenko commented 3 years ago

Yes, I think it's related to environment variable substitution, which uses both $ and % on Windows. Are you saying all these other characters are working fine or not (it looks like the sentence wasn't finished)?

qgenesist commented 3 years ago

no, I guess I am not, saying they work fine, after some further work, it will load files names like that correctly, but may not save or rename them inside ZBS. I think the cuttof happened by interpretation of my typing in the box. do not know about delete or create. I have done crt, dlt outside of ZBS for the moment while conceiving of every nasty legal ascii filename, havent even looked into utf8. this all started because I need a way to sort and classify where I am at with my projects inside my projects, priorities, fix code, in process, next and so on.... I don't wake up saying I am going to make PaulKs life miserable today, believe me, I can imagine you got some real problems with your body of code that you need to work on and not this foolishness. everywhere I look for something I want to do, and get a background, your name appears.

pkulchenko commented 3 years ago

@qgenesist, this should be fixed now. There is a still a small issue with files that have % in their names (during rename), but other than that, it should all work correctly now. Let me know if you run into any issues.

qgenesist commented 3 years ago

I will let you know what I know when I know it, hopefully it is mostly closed. do I start a new prob for % or do you handle that?

pkulchenko commented 3 years ago

It's already been fixed in 55e32e38. I tagged the commit with #1107, but it's the same issue I mentioned earlier.

qgenesist commented 3 years ago

it looks like it works for crt, dlt, edt, chg, rnm. I have not tried % because I am confused a bit where you are at with that. are you saying also fixed?

qgenesist commented 3 years ago

oh, and thank you, doing a gangbusters job out here on this, PaulK

pkulchenko commented 3 years ago

I have not tried % because I am confused a bit where you are at with that. are you saying also fixed?

Yes, it should also be fixed, as previously if you rename a file to %foobar.lua, it would only show foobar.lua in the tab label.

qgenesist commented 3 years ago

Paul, no, I have tried %blahblahblah after installing your fix, and I cannot rename it, or edit it, no reason to try more.

pkulchenko commented 3 years ago

@qgenesist, are you using the current master branch? I've tried creating, renaming, deleting and everything works for me. If this still doesn't work for you in the master branch, can you describe specific steps to make sure we're using the same process? Thanks.

qgenesist commented 3 years ago

Wait Paul, I am a neophyte. I did only the +- code changes you gave me. I do not have luarocks, github or whatever, I install. what branch sourse should I pull. sorry to be so obtuse.

pkulchenko commented 3 years ago

No problem; just make sure to include the changes from this commit (55e32e3), which should fix the issue with %.

qgenesist commented 3 years ago

this is larger than it appears. to begin with, I cannot get file starting with % to work correctly, after installing your fix. files that start with # will not enumerate their functions in the outline tab. filenames that start with or contain these characters are legal in windows. ! exclamation

pound

$ dollar % percent & ampersand ( left paren ) right paren , comma . period ; semicolon @ at [ left bracket ] right bracket ^ power _ underline ` accent { left brace } right brace ~ not

I am not a clever person in lua. If you could provide me some functional areas as you see them, for example edt, crt, dlt, chg, rnm, add, rmv, filetree ops, and outline ops, and whatever functional areas you see your code as, I could make a truth table for each leadinc char file type for each functional area, to help you track down the areas of code that handle each correctly and those that do not. (If it helps to get the whole picture). Additionally, where are how to questions best asked, here or on the IRC?

pkulchenko commented 3 years ago

I don't see any issue with the listed symbols (and the patch in 55e32e38 that I referenced fixes the handling of %). I also see that the outline correctly displays all the methods and the filename/tab shows those symbols that you listed. The only issue I see is with * when trying to rename the file, but it's returned by the OS call, so likely has nothing to do with the IDE code.

If you have the problem with one of the characters (let's pick ! for example), you can provide a description of what you're trying to do along with some screenshots, as I can't reproduce this using the code in the current master branch.