CodeEdit icon indicating copy to clipboard operation
CodeEdit copied to clipboard

✨ Focus Editor On File Creation

Open adsalad opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe.

I think it would be nice if the user could start typing write away after launching an empty file, instead of having to click on the first line

Describe the solution you'd like

Typically when you launch a new empty file in most code editors, the cursor will automatically be focused on the first line allowing the user to start typing right away. At worst, the user may have to refocus the screen by clicking somewhere in the window. Currently, one has to click on the first line exactly.

Describe alternatives you've considered

N/A

Additional context

If this may be a bug or something irreproducible, we can just close this issue

Below, is a video of what I am seeing: https://streamable.com/a0cclr

adsalad avatar Jul 29 '22 21:07 adsalad

Good catch @adsalad!

austincondiff avatar Jul 30 '22 16:07 austincondiff

I'll try and get something working for this, PR will be linked back here if something works out.

adsalad avatar Aug 07 '22 23:08 adsalad

I was thinking of maybe adding a becomeFirstResponder() to one of the UIKit text input views as a possible fix. One of CodeEditTextView or STTextViewController files seem like a good place to start. However, these files seem to be read-only.

adsalad avatar Aug 10 '22 18:08 adsalad

@adsalad What is the status of this? Are you still planning on working on this?

austincondiff avatar Sep 30 '22 18:09 austincondiff

This one was more difficult than I thought, I think someone else should take a crack at it.

For anyone planning on taking it on:

  • Depending on the approach, you may need to import some of the TextView package(s) to edit the files handling input in the editor, such as CodeEditTextView.

adsalad avatar Sep 30 '22 19:09 adsalad

Hi, as I mentioned on Discord, I'm taking a look at this issue now. As @adsalad mentioned, the solution might be within CodeEditTextView or even in STTextView.

RenanGreca avatar Feb 17 '23 06:02 RenanGreca