StaSh updates - Unified I/O UI, external keyboard support and more
The Input/Output areas are now unified with a single TextView
- No more screen flashing, smooth scroll at all time
- Support device rotation for all directions
External keyboard support
- Tab for command line auto-completion
- Cmd (⌘) + Up/Down for navigating through history
Swipe gesture on the virtual key row to position cursor,
similar to what Pythonista builtin editor offers
Larger collection of command scripts including
Single file Installation
now requires no additional steps.
Just run once to get the full stack of files installed.
If you have StaSh already installed, please type
selfupdatefrom within StaSh to get the latest v0.4.0.
Is the server side repo that you are trying to push into a local one, i.e. the repo resides inside Pythonista, not on GitHub.
Based on my quick browse of
dulwich/client.py, the code seems to always shell out for native git when the push path is a local path.
dulwich is very sensitive to the url scheme you are trying to push. Not only local path, if you have a typo, e.g.:
http//, it will calls out for default/subprocess git client, which will throw the "operation not permitted" error.
This new version is quite excellent. Great work. The UI makes so much more sense now and just works ask you would expect.
The support for external keyboards is mostly working for me. I can not seem to get the cmd-U/D to work. Can you give me a suggestion on how to debug this? Is there some easy way to log what it coming in from the external keyboard? I see that there are some --debug command line options.
As a stretch, I would like to see if I could hook the up down arrows on the keyboard to do history up down instead of allowing the cursor to move up or down in the view. There does not seem to be any utility to allowing the cursor to move off the command input line anyway.
Speaking of the cursor - in the default config it is a blinking blue line. Is this configurable? I would like to switch to white as the blue is difficult to see on a black background.
This shell is so good at this point that it should be part of the distribution IMHO. Pair that with a README on how to do some basic git stuff and you could make a lot of peoples nooby problems go away.
Poly, I suspect what is happening is that you are doing something like
git push origin
Dulwich treats this as a Local repo, and uses subprocess. I have a patch for the git command that checks the list of remotes for matching names, and replaces with he url, but haven't posted it yet, will do so tonight. The older git command requires you to use https://github.com/owner/repo.git
the only problem is only in gitview (gitui). I hit the "push" button and off we don't go. See the traceback above in this thread. What would be nice woudl be:
git branch some_new_branch
The cursor color can be configured via the
TINT_COLORoption in the
.stash_configfile. For the white color, just set
TINT_COLOR=(1.0, 1.0, 1.0)under the
_DEFAULT_CONFIGin the source code for an example).
The support for cmd+up/dn really is just an approximation, because the UI system does not have any events to handle special key strokes. One important note is do NOT mix use of on-screen Up/Dn buttons and external keyboard.
The way it works is to detect whether the cursor is now at (0, 0), i.e. position 0 with 0 char selected. This is basically what the cmd+up key combo does in a TextView. At least that's how it works with my Bluetooth keyboard (Logitech keys-to-go). So if your keyboard also moves cursor to the very beginning of a document when cmd+up is pressed (you can test that in Pythonista builtin editor) and the cursor was previously at input position, it should work for navigating up through the history.
Navigating down (cmd+dn) through the history is a bit more involved. But in principle it detects whether the cursor is now at the end of a document (what cmd+dn does). So if your cmd+dn key does that and the cursor is at input position, it should be good.
By now you probably see why I didn't map just up/down to history navigation. Because there are too many variations of the results thus not reliable. Plus it is impossible to implement the history down with just the down key.
Currently there is no easy way for you to debug the external keyboard bit (not without modifying the source code). The debug options are mostly for the parser and runtime. I'll keep this noted and see if debug system can be improved.
Thanks for your nice words. I am glad to know you like it. It would be a great honour for StaSh to be distributed as part of Pythonista. But I won't get my hope high on that.
How do you capture a keyboard event? I'd like to enable external keyboard interaction with chordcalc, but really have no idea where to start. Looking at your code does not make it any clearer. Not your code, my ignorance.
Git branch -b creates a new branch.
Also, you can copy .git/refs/heads files to another name.
Also, in gitview, be sure to select remote before pressing push.
I think you can only capture keyboard events inside a textview, using the delegate methods. Specifically, you can look for specific types of cursor movement.
@ywangd - thank you so much for the detailed explanation. I believe that the reason I am not seeing correct behavior for cmd-up/down is that my keyboard is a relatively old Logitech Ultrathin. It has fn, ctrl, option, cmd and the arrow keys but they do not seem to produce all the correct codes for ios. I have to use the fn keys for select, cut, copy, paste. Arrow keys work fine. Probably should upgrade to a newer model.
@polymerchm, this proof of concept I wrote demonstrates how external keyboard input can be detected. The only problem is that the cursor needs to stay inside a text field all the time, if something else is focused no more keyboard inputs are handled. You'd also need to somehow detect whether someone is using an external keyboard (which I don't think is possible) and disable the text field if they don't - otherwise the on-screen keyboard would display and cover half of your app.
@dgelessus and @ywand - thanks for reminding me about the keyboard proof of concept app. I used it to check my keyboard and the POC correctly detects cmd-up/down with my keyboard. This lead me to just grab the absolute latest copy of stash. It turned out I was running one from the dev branch. The latest one works just fine. Sorry for the false alarm user error.
Also - I noticed that the latest update keeps the history pane updated in real time. Very nice.
How can I download a file with stash?
if you mean from github, here's an example:
$ cd Documents<br>
$ mkdir chordcalc<br>
$ cd chordcalc<br>
$ git clone https://github.com/polymerchm/chordcalc.git<br>
To download a single file, use
wget. Use the
-ooption to specify the destination file name, otherwise it will download to the clipboard:
wget http://www.example.com/path/to/file -o file.py