Re: [code] Questions

From: Mitchell <m.att.foicica.com>
Date: Thu, 11 Jun 2020 09:50:02 -0400 (EDT)

Hi James,

On Thu, 11 Jun 2020, James Reynolds wrote:

> I have a ton of questions and wishes.
>
> In the GUI version is it possible to change the order of the tabs?

This is not possible at the moment. I don't use tabs, so this has never been high on the priority list.

> Shell shortcuts do not work in shell execution command, like ~/. Using semicolons to make a new command also seems to be ignored. "echo hi ; echo bye" prints "hi ; echo bye". I realize this is because shell interpolation isn't in effect. Is it possible to add shell interpolation?

Limited interpolation would be possible via Lua's string.gsub(), and you could split commands by semi-colon to execute a chain, but shell commands are always run separately and not in the same shell session, so something like 'cd foo; ./bar' would not work. What you really need is a persistent terminal session, but Textadept doesn't support that out of the box. I've been meaning to explore adding terminal functionality to a module, but haven't found the time yet.

> Is it possible to have it remember the current directory? So the result of a cd would affect future commands?

Like I said, shell commands are always run separately, so there's no way to keep track of the current directory without a persistent session. That said, you could try and parse a `cd` command and then call `os.spawn()` with your saved directory, but any bash scripts that `cd` would not be captured.

> Is it possible to add a shell command execution mode to append the output to the current file or the Message Buffer instead of replacing the selected text of the current file? I like that feature too (especially with sort and uniq), but it would also be cool to be able append.
>
> Another cool feature would be to have a command that executed the selected text and paste the output after (just like a shell, but the whole thing is editable).

Yes, you could modify *modules/textadept/editing.lua*'s `filter_through()` function (or create your own) that prints output to wherever you want it.

> If a command returns non-zero nothing is shown. Is it possible to get the output even if it's non-zero? I noticed this with diff.

I think it's possible. `textadept.editing.filter_through()` throws any read output away on error, but you could do something with it if you wanted to.

> How does Textadept handle editing files as root? That is, is it safe to run as root? Do I dare use it as a replacement for vi? Or is it possible for it to elevate permissions for open/save operations?

Textadept does not elevate permissions. You'd have to run it as root. I haven't ever actually done this. I'd be wary running as root if I had any 3rd party modules installed. Otherwise, stock Textadept would be okay.

> If the cursor is in the find field command-g doesn't do anything. It would be great if it did.

This would be a nice feature, but it will require some complicated key handling in the C core that I don't feel belongs there.

> I think this is preference, but it would be nice if searching for something moved focus to the text view instead of the find field.

I thought that putting in your *~/.textadept/init.lua*:

   events.connect(events.FIND, ui.find.focus, 1)

would hide the pane, but it doesn't. (Despite the name, the function should toggle visibility.) I think this is a bug and will look into it. Otherwise, you should be able use that as your preference.

> When option click dragging text, the selection wont extend past the last line.
>
> If I move the mouse down, then it unselects the rest of 3 and 4.

Set `buffer.virtual_space_options = buffer.VS_RECTANGULARSELECTION` in your *~/textadept/init.lua* or the command entry. At least, I think option-click makes a rectangular selection on Mac.

> ---
>
> I'm hoping that it's possible to make the macOS version act more macOS but I'm not sure if it's possible because of GTK and Scintilla. Here's my list of hopes.
>
> - This is the first macOS app I've seen that doesn't flash a menu when a keyboard shortcut is pressed. That is, if pressing command-c (copy) the "Edit" menu always flashes indicating that's where the command is located. Is it possible to flash the menu?

This is in the GTK-OSX domain, and since it doesn't happen, I don't think this is supported.

> - When in the Find field, pressing tab will move to the Replace field, but pressing tab in the Replace field goes nowhere. I don't know if it's possible but can tab move to the buttons, e.g. "Find Next", then "Find Pref", "Replace", etc?

The Find & Replace pane's buttons are set to not allow focus, and I'm pretty sure you can't focus buttons on Mac anyway. You can enable key mnemonics if they're not already available. I don't have a Mac in front of me, but somewhere in Textadept.app/Contents/Resources there's a GTK theme file that has a "mnemonics" or similar setting.

> - Open/Save File Dailogs - In macOS there are many keyboard shortcuts like command-shift-d (go to the desktop).
>
> - In macOS Open/Save File Dialogs pressing tab always moves focus to some element. Tab completion only works when pressing command-shift-g ("go to the folder"). Command-period always cancels, return always selects the colored button, and a button with a focus (the glow) is selectable with the space key.

GTK-OSX does not use the native Mac file browser, so it does not support the same behavior. I cannot change this.

> [cid:FAAE2220-95A0-4F41-8C31-CB34BF772C89.att.utah.edu]
>
> - Open/Save File Dialogs without an open/saved document defaults to ~/ or the last directory. Textadept defaults to / (which is annoying).

If you haven't started Textadept.app from the terminal, open the command entry and type `lfs.currentdir()`, hit enter and see what the output is. This is likely the directory the open dialog starts in.

Try putting this in your *~/.textadept/init.lua*:

   if OSX and not CURSES then
     lfs.chdir(os.getenv('HOME'))
   end

You may need to tweak the if conditional to also check if `lfs.currentdir() == '...'` whatever your experiment produced in case Textadept uses relative filepaths for anything on startup (unlikely if you're not starting Textadept from a terminal).

> - It doesn't look like folder icons are used in the Open/Save dialogs in the right view.

Probably a GTK-OSX bug then.

> - Almost all Mac document based apps (Photoshop is the only exception I can think of) support command clicking the title bar to pull up a path and optionally select one of them to open it in Finder. This is from a different app.

Unfortunately, I don't know how to add that feature.

> - If the Mac OS key bindings are going to be different from curses/Windows/Linux, it makes more sense to have them act more like other Mac apps. I know I can change them for myself. I'm just curious if you're open to changing them officially? I'm not sure what the reasoning is for some of the keyboard short cuts. Examples:
> On macOS all web browsers, the Finder, and Terminal all support tabs and moving between them is with command-shift-[ and command-shift-].
> On almost all text fields on macOS command-e copies the selected text and pastes it into the search field. So selecting text and pressing command-e then command-g will search for the next instance of that text.

The default set of keybindings is designed to be as close to the same between platforms as possible, but to also accomodate basic platform defaults (e.g. Mac text entries have emacs-style commands, but not on Windows). I am open to changing them to better suit platforms.

> Is Scintilla the reason Textadept supports only one window?

No, this was a design decision to reduce complexity.

> - I don't know if this is intentional but in the View menu there's an option to show and hide the tab bar and it does nothing but show an empty area above the tabs. This also messes up the Open/Save dialog spacing.
>
> See empty area above the tabs?

Probably a GTK-OSX limitation. When I have some time I will investigate.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Thu 11 Jun 2020 - 09:50:02 EDT

This archive was generated by hypermail 2.2.0 : Fri 12 Jun 2020 - 06:29:56 EDT