Skip to content

AutoFormat.java, Mk III#3002

Merged
benfry merged 9 commits into
processing:masterfrom
GKFX:autoform2
Jan 19, 2015
Merged

AutoFormat.java, Mk III#3002
benfry merged 9 commits into
processing:masterfrom
GKFX:autoform2

Conversation

@GKFX
Copy link
Copy Markdown
Contributor

@GKFX GKFX commented Dec 6, 2014

This is a finished copy of what was #2560.
Fix #2540, fix #1041.

GKFX added 8 commits June 4, 2014 14:45
Miscellaneous fixes. I broke the indent-on-continued-lines feature, but it
was bad to start with.
This wraps up my changes to the autoformatter.
Am commiting before attempting to fix by mass deletion of code.
This adds proper support for indents caused by continuing to a new line, allows arrays to be expressed in more compact form, prevents the final line being eaten if it isn't properly ended, and neatens code.
Sort out arrays and do-while loops. Fix some more bugs.
…utoform2

Conflicts:
	app/src/processing/mode/java/AutoFormat.java
@GKFX GKFX closed this Dec 7, 2014
@GKFX GKFX reopened this Jan 9, 2015
@GKFX
Copy link
Copy Markdown
Contributor Author

GKFX commented Jan 9, 2015

Done!

Fix if-else regression
@GKFX
Copy link
Copy Markdown
Contributor Author

GKFX commented Jan 15, 2015

Just to review what's happened:

  • Line overflow indent mechanism replaced, including special array handling. Arrays need not be split over many lines now, although if an array is split it will be formatted like that.
  • s_ind and ind converted to boolean – they were int arrays holding only 0 and 1.
  • Do-while loops properly handled so they appear as
do {
  f;
} while (a);
  • castFlags removed – didn't seem very useful as it only looked at a few types. Replaced by a check for if-for-while structures
  • Delete get_string entirely, as it's useless.
  • Neaten/clarify stuff.
  • Split lookup into two methods: bufStarts and bufEnds.
  • Ensure that no code is deleted.
  • Prevent exceptions on many consecutive single-line ifs. (`if(a)\n if(a)\n if(a)\n if(a)\n ..."). It's unusual code, but there shouldn't be an exception.
  • Avoid removing the whole margin for labels: that's a C convention I haven't seen in Java.

@GKFX
Copy link
Copy Markdown
Contributor Author

GKFX commented Jan 15, 2015

Brief close after noticing what may be significant typo. Didn't do any harm in testing but worth correcting.

@GKFX GKFX closed this Jan 15, 2015
@GKFX
Copy link
Copy Markdown
Contributor Author

GKFX commented Jan 17, 2015

Actually, it's not a problem. In fact, it's an improvement. (gotElse now isn't called in case '\n' for the code else x(); (no newline inside), but seeing as it's already been called in case ' ', it doesn't matter at all.)

@GKFX GKFX reopened this Jan 17, 2015
benfry added a commit that referenced this pull request Jan 19, 2015
@benfry benfry merged commit e92e6d7 into processing:master Jan 19, 2015
@benfry
Copy link
Copy Markdown
Contributor

benfry commented Jan 19, 2015

Thanks! Merging; fingers crossed.

@github-actions
Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Autoformat deletes the last line of this code. Auto Format adds extra indent

2 participants