deadpixi / sam

An updated version of the sam text editor.
Other
430 stars 46 forks source link

Spaces aren't allowed in file names #83

Open dertuxmalwieder opened 6 years ago

dertuxmalwieder commented 6 years ago

My favorite Plan 9 problem is present in sam (including yours) as well.

I use sam, acme et al. on Windows 10, thanks to Microsoft's Linux Subsystem. That works surprisingly well, minus the need to prefix absolute paths with /mnt/.... Now it is rather common on Windows to have files (and folders) which contain a space character. sam does not understand that.

e somefile.txt
 +.

But:

e "some file.txt"
?newline expected

I would like to suggest that this is considered to be fixed.

Potentially related: plan9port issue (where deadpixi/sam was mentioned as a better example - ha!).

deadpixi commented 6 years ago

This problem has been tentatively fixed in the experimental branch of sam, where spaces can be escaped using backslashes. Please try out that branch and let me know if it works for you.

dertuxmalwieder commented 6 years ago

Hmm, does not seem so:

git fetch
git checkout experimental
git pull
make ; make install

Starting sam...

!ls som*
some file.txt
!
e some\ file.txt
?newline expected

😢

deadpixi commented 6 years ago

Hm. I'll look at it some more today. Does the escaping work with the B command?

dertuxmalwieder commented 6 years ago

You mean, from inside sam?

!B some\ file.txt
some: No such file or directory
file.txt: No such file or directory

Or from the shell?

B some\ file.txt

Then this happens in sam:

B  /mnt/c/Users/myUserName/Desktop/some file.txt
 -. file.txt
?can't open "file.txt"

I'd say that it doesn't. (But I'm really new to the Plan 9 tools, coming from Emacs - I might be doing it wrong, after all.)

deadpixi commented 6 years ago

Inside sam, yeah. When I get back to my desk I'll make sure I have the code pushed up to GitHub. I know it was working for me...

dertuxmalwieder commented 6 years ago

Don't worry. I have all the time it takes. :-)

deadpixi commented 6 years ago

Hey @dertuxmalwieder, please try the latest experimental branch and let me know how that works for you.

dertuxmalwieder commented 6 years ago

Almost!

I can open a file with spaces now, but sam refuses to let me edit it. I can't type anything in the window. Still works with files without spaces from the same directory.

deadpixi commented 6 years ago

Hey @dertuxmalwieder I'm not able to replicate that...is it happening on the master branch too? The master branch just had a big IO rewrite (which was merged into the experimental branch), so that might be the root cause.

dertuxmalwieder commented 6 years ago

Hey @deadpixi :-),

git checkout master
make clean ; make
sudo make install

Starting sam:

e some\ file.txt

I get an empty (!) buffer - which is somewhat logical: The master branch can't use files with spaces just yet ... how should I reproduce it?

deadpixi commented 6 years ago

Hi @dertuxmalwieder

Sorry, I didn't mean the spaces-in-filenames thing for the master branch, just that you were able to edit files in master at all.

Please try pulling the latest master just to be sure. Also, what environment are you running in? If it's Linux I know that there was an issue with some fairly old versions of glibc that was fixed but had very similar symptoms to what you were describing with the being unable to edit...

Thanks again for your patience in helping me debug this.

dertuxmalwieder commented 6 years ago

Yes, editing generally works - with non-spaced files, that is. I see no typing issues at all with e somefile.txt.

Please try pulling the latest master just to be sure.

I seem to use the latest master:

$ git branch
  experimental
* master

$ git pull
Already up-to-date.

Also, what environment are you running in?

Debian 9 running on Windows 10.

$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"

Not sure which glibc version that is though. I performed my most recent apt full-upgrade just today.

Thanks again for your patience in helping me debug this.

Well, the alternative would be to write my own Windows version of sam, and, while that seems to be reasonably easy (assuming that I skip plumbing, sam is mostly a very basic MDI text editor), I am lazy. Really, really lazy. So I'm perfectly fine with spending more time to get this fixed instead. :-)

deadpixi commented 6 years ago

Hm. If the glibc issue were the root cause, it would be affecting you when building off master too, so that's not it.

When sam doesn't let you type, is it just typing that's forbidden? That is, can you still open menus, etc? Can you still type in the command window, and if so, do those commands actually do anything?

Thanks again.

dertuxmalwieder commented 6 years ago

Smart me has just left the office for the day.

I'll report back tomorrow!

dertuxmalwieder commented 6 years ago

Whoops. Almost forgot you (busy day).

So yes, it's just typing.

ghost commented 6 years ago

Can you do space hell escaping like in rc? 'file name' instead of file\ name

dertuxmalwieder commented 6 years ago

No, that won't work at all.