gphalkes / tilde

The Tilde text editor
389 stars 20 forks source link

Add a "view mode" which doesn't allow to write files #29

Open gphalkes opened 6 years ago

gphalkes commented 6 years ago

Sometimes it is nice to just be able to view a text file with an editor, but be sure that you don't modify the file. In other words: to use Tilde as a viewer, rather than as an editor.

cheapy commented 6 years ago

I would like to use Tilde in View mode under Midnight Commander to replace the internal viewer for text files. One nice thing about this would be if I was also using Tilde as my editor (which I am now), then I would have all Tilde's features for searches, navigation and windowing available.

Would it be possible to also implement the ability to exit with a ESC-ESC sequence as well as the ^Q? This would be like Midnight Commander and the old Norton Commander. I was able to do it with a couple lines of code change in main.cc {action_id_t::FILE_EXIT, "Exit", {EKEY_ESC}}, and panel->add_item("E_xit", "ESC-ESC or ^Q", action_id_t::FILE_EXIT);

Thanks, this is the best terminal editor out there!

gphalkes commented 6 years ago

I see two problems with adding ESC-ESC as the exit sequence:

ulno commented 6 years ago

Hi BobC,

I had the same idea with mc and esc-esc as you, but I then thought, maybe it's not tilde doing it wrong but mc. It's pretty easy to set exit in mc to ctrl-q - already have it in my muscle memory - maybe an alternate solution for you?

ulno

On Sat, Mar 17, 2018 at 2:29 AM, BobC notifications@github.com wrote:

I would like to use Tilde in View mode under Midnight Commander to replace the internal viewer for text files. One nice thing about this would be if I was also using Tilde as my editor (which I am now), then I would have all Tilde's features for searches, navigation and windowing available.

Would it be possible to also implement the ability to exit with a ESC-ESC sequence as well as the ^Q? This would be like Midnight Commander and the old Norton Commander. I was able to do it with 1 line of code in main.cc {action_id_t::FILE_EXIT, "Exit", {EKEY_ESC}},

Thanks, this is the best terminal editor out there!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gphalkes/tilde/issues/29#issuecomment-373898248, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEa8twS6-Jn6M3WSL-iHYF5aU11Y-jBks5tfK0vgaJpZM4SnTbV .

-- title+name: Dr. Ulrich Norbisrath web: http://ulno.net; address+phone+fax: http://ulno.net/contact mailto:ulno@ulno.net

cheapy commented 6 years ago

I installed and tried Xterm, Urxvt, Urxvt-unicode and Lxterminal, as well as Mrxvt-mini, all with Mc not loaded, and Esc-Esc doesn't work on any of them to exit from Tilde. Esc-Esc does work on all of them to exit from Midnight Commander's internal viewer as well as it's internal editor. Esc-Esc also works (yes, I sill have a few machines with it that run) on the Norton Commander 2.0 internal viewer and editor.

I do understand that if its likely to cause trouble for others, it would be silly to add the option for it, and yes, I'm sure I would eventually get used to control Q, which also worked on Norton Commander IIRC, but my purpose is to end up with a super light but totally integrated mult-tier working environnment based on terminal tabs with midnight commander running on many, where the keys used between IceWm, Mrxvt, Mc, and Tilde work in harmony to do the things I typically do efficiently.

Today I went through the IceWm and Mrxvt key bindings and minimized them down to what I actually want to use. With very-very few exceptions, where it was actually needed, I basically limited each level to a group of keys, ie all Mrxvt keys are Ctrl-Shift based, and no IceWm, Tilde Keys or Mc keys are Ctrl-Shift based, so there will be no more conflicts with Mrxvt key mapping. I also unmapped almost all IceWm keys, leaving only the few that I actually use, again simplifying what keys I need to remember and reducing possible conflicts as a result. It was a mess that needed to be cleaned up anyway. :)