p-e-w / finalterm

At last – a modern terminal emulator (NO LONGER MAINTAINED)
http://finalterm.org
GNU General Public License v3.0
3.84k stars 179 forks source link

Escape filenames for use with semantic menu commands #335

Closed nashley closed 9 years ago

nashley commented 9 years ago

Fixes #266 by escaping filenames with quotes so that they can be properly used by tools listed in the semantic menu. This approach (as opposed to that found in a0def85875f8625aedcb50c19a83094955c098e0) is better for readability and for use with the clipboard if a group of text is selected and then copied.

p-e-w commented 9 years ago

I like the simplicity of this solution, but unfortunately, it breaks if the parameter contains single quotes that are already escaped :(

nashley commented 9 years ago

@p-e-w By "already escaped" do you mean filenames such as \'test? I'm using the latest commit (ea68d4706c187f49b0dca6a61761e2971a214c16), and I can't even get the semantic menu to recognize the file (on another note, the \t in \test is converted into a tab when displayed in finalterm; try touch \\test && ls). However, this method should work correctly if the menu recognized the name. \'test turns into '\'\''test', which is correctly interpreted by bash as \'test. What am I missing here?

p-e-w commented 9 years ago

I ran a few more tests and found that indeed, I cannot seem to break this solution in practice, which is awesome and means it is definitely a step forward.

Therefore: Merged!

I would like to give you credit for your contribution in Final Term's About dialog, but I did not find your name anywhere. If you want to see your name listed there, just drop me a line and it will happen. Otherwise, no problem either; in any case your work is very much appreciated!

nashley commented 9 years ago

@p-e-w Sweet! My name, which I've now added to my profile, is "Nick Ashley." I'm glad that I can be a part of this project, and I'd like to help solve more bugs when possible.

p-e-w commented 9 years ago

Well, Nick, you've just been immortalized :smile_cat:!