Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support adding/deleting text at arbitrary cursor position in a command line #27

Open
kevin-he-01 opened this issue Jul 24, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@kevin-he-01
Copy link

Issue

LibTerm does not seem to support line-editing features, such as editing in the middle of a command. For example, if you have typed echo some long string to be displayed and realized that you want to insert very between some and long to make the command echo some very long string to be displayed, you would have to delete all the text up to some and insert very, which is very annoying.

This may be considered a bug, since the shell prompt should behave mostly like edit, which allows editing at any cursor position, but this is more like a feature request since one would be to detect whether the cursor position is "legal" (somewhere in the current command line and not in the shell prompt hostname $ or in previous commands)

The discontinued OpenTerm does support such editing feature. One can try it out by building it from source (no longer available from the App Store though). Furthermore, on a normal bash session on a computer you can use the arrow keys and insert some text in the middle assuming one have GNU readline enabled (by default on an interactive shell). I know iOS do not have cursor keys in its built in on screen keyboard but there are still plenty ways to change the cursor position without using an external keyboard.
Moving the cursor is possible by clicking at a position in the command line or deep pressing the on screen keyboard and move your finger to move the cursor.

Steps to reproduce

  1. Open LibTerm
  2. Enter a long line, such as echo some long string to be displayed
  3. Move the cursor to anywhere except at the end of the command line in a way described above
  4. Enter text, notice that nothing you type is displayed (typing have no effect)

Expected Behavior

The characters typed are inserted in the command line at the cursor position.

Actual Behavior

One can move the cursor, but typing have no effect unless the cursor is at the end of the command line.

@ColdGrub1384
Copy link
Owner

I will work on it

@ColdGrub1384 ColdGrub1384 added the enhancement New feature or request label Aug 11, 2019
@dullbananas
Copy link

Are you still working on it?

@ColdGrub1384
Copy link
Owner

I tried sometime ago but I couldn't find a way to do it. I'll keep trying.

@ColdGrub1384
Copy link
Owner

ColdGrub1384 commented Nov 10, 2019

I found a way to do it but it does not currently work for commands like the Python REPL, the Lua REPL or bc

@ongyx
Copy link

ongyx commented Nov 12, 2019

The Libterm 5.1.4 update yesterday has fixed this. I checked it myself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants