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

Match Mixed Indent of Previous Line #606

Closed
JoelProminic opened this issue Aug 5, 2019 · 10 comments
Closed

Match Mixed Indent of Previous Line #606

JoelProminic opened this issue Aug 5, 2019 · 10 comments

Comments

@JoelProminic
Copy link
Contributor

I was working with a Java Maven project and the latest Bamboo build of Monshine today, and I noticed that Moonshine did not always automatically match the indent of the previous line when adding a new line. After some investigation I found that when the previous line was indented with tabs, it worked, but when indented with spaces, it didn't work.

image

I would like to see the auto-indent reproduce both tabs and spaces.

Note that we will eventually need some tools to let the user choose to work with either tabs or spaces for the indent - this is a common problem when working with other developers with different editors.

@JoelProminic
Copy link
Contributor Author

I still see this problem on v2.5.1, and it continues to be a problem when I load Java projects from other IDEs. For now, I am mostly interested in matching the whitespace of the previous line - the tab/whitespace configuration will probably need to be a separate issue.

@rat-moonshine
Copy link
Collaborator

You can test the behavior now, @JoelProminic . You can test this with OSX branch build.

@rat-moonshine rat-moonshine added test ready Feature/bug ready for testing and removed in-progress labels Feb 21, 2020
@JoelProminic
Copy link
Contributor Author

This mostly worked, but I see an extra space in the new line after the tab only line.
image

Here is my test file:
TestMixedIndent_606.java.zip

@JoelProminic
Copy link
Contributor Author

I noticed that the default Java file for a new Java Gradle project has mixed spaces and tabs. We should check the templates to make sure that we are using the same indent consistently (tabs for now, until we have more Moonshine support for switching between tabs and spaces).

@rat-moonshine
Copy link
Collaborator

I noticed a bug during my tests where the line with no indent duplicates when pressed Enter against. This issue is now fixed.

The tiny tab problem, it seems an old editor issue. To test, I downloaded last stable build, where I able to reproduce the problem as well:

  1. Open editor
  2. In any new line do two tabs and write something, press Enter
  3. In the new line, start from the extreme left, press 1 tab and 4 space
  4. Press tab, cursor reacts as hit by a tiny tab

We probably need to go into more deeper in editor source.

@rat-moonshine
Copy link
Collaborator

This issue now merged into master.

@JoelProminic
Copy link
Contributor Author

I tested this again in a Java class, and the indentation is duplicated like I expect.

I still see the "tiny tab" issue, though. In my case, I can trigger this by pressing Tab, four spaces, and then Tab again on the first (or last) line of the file.

@rat-moonshine
Copy link
Collaborator

rat-moonshine commented Mar 9, 2020

Some more investigation into tiny tab issue taken me to this portion of the codes - https://github.com/prominic/Moonshine-IDE/blob/master/ide/MoonshineSharedCore/src/actionScripts/ui/editor/text/TextLineRenderer.as#L49. It seems we have a static char-width which possibly creates different behaviour between scenarios. This possibly makes sense since a tab can consists of multiply of char-widths.

I confirm if I manually modify the value I can get mixed Tab+Space results where mostly breaks after a certain time. This value generation maybe never worked-on by the author which was initially planned to.

I do not have any immediate fix on this regard, yet.

@piotrzarzycki21 piotrzarzycki21 removed the test ready Feature/bug ready for testing label Apr 2, 2020
@piotrzarzycki21
Copy link
Collaborator

I still see the "tiny tab" issue, though. In my case, I can trigger this by pressing Tab, four spaces, and then Tab again on the first (or last) line of the file.

@rat-moonshine Expose this as separate issue. I'm closing this cause according to your message it's merged.

@JoelProminic
Copy link
Contributor Author

I did some quick tests with the merged code in master, and created a separate issue for the "tiny tab" bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

3 participants