mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
improving indent/outdent and general format and key binding issues
This commit is contained in:
@@ -286,7 +286,14 @@ public class EditorListener {
|
||||
origIndex += offset; // ARGH!#(* WINDOWS#@($*
|
||||
*/
|
||||
|
||||
// if the previous thing is a brace (whether prev line or
|
||||
// up farther) then the correct indent is the number of spaces
|
||||
// on that line + 'indent'.
|
||||
// if the previous line is not a brace, then just use the
|
||||
// identical indentation to the previous line
|
||||
|
||||
// calculate the amount of indent on the previous line
|
||||
// this will be used *only if the prev line is not an indent*
|
||||
int spaceCount = calcSpaceCount(origIndex, contents);
|
||||
|
||||
// If the last character was a left curly brace, then indent.
|
||||
@@ -302,6 +309,9 @@ public class EditorListener {
|
||||
if (index2 != -1) {
|
||||
// still won't catch a case where prev stuff is a comment
|
||||
if (contents[index2] == '{') {
|
||||
// intermediate lines be damned,
|
||||
// use the indent for this line instead
|
||||
spaceCount = calcSpaceCount(index2, contents);
|
||||
spaceCount += tabSize;
|
||||
}
|
||||
}
|
||||
@@ -318,6 +328,13 @@ public class EditorListener {
|
||||
extraCount++;
|
||||
index++;
|
||||
}
|
||||
int braceCount = 0;
|
||||
while ((index < contents.length) && (contents[index] != '\n')) {
|
||||
if (contents[index] == '}') {
|
||||
braceCount++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
// hitting return on a line with spaces *after* the caret
|
||||
// can cause trouble. for 0099, was ignoring the case, but this is
|
||||
@@ -331,6 +348,12 @@ public class EditorListener {
|
||||
//if (spaceCount < 0) spaceCount = 0;
|
||||
//System.out.println("extraCount is " + extraCount);
|
||||
|
||||
// now, check to see if the current line contains a } and if so,
|
||||
// outdent again by indent
|
||||
//if (braceCount > 0) {
|
||||
//spaceCount -= 2;
|
||||
//}
|
||||
|
||||
if (spaceCount < 0) {
|
||||
// for rev 0122, actually delete extra space
|
||||
//textarea.setSelectionStart(origIndex + 1);
|
||||
@@ -341,6 +364,19 @@ public class EditorListener {
|
||||
textarea.setSelectedText(insertion);
|
||||
}
|
||||
|
||||
// not gonna bother handling more than one brace
|
||||
if (braceCount > 0) {
|
||||
int sel = textarea.getSelectionStart();
|
||||
textarea.select(sel - tabSize, sel);
|
||||
String s = Editor.EMPTY.substring(0, tabSize);
|
||||
// if these are spaces that we can delete
|
||||
if (textarea.getSelectedText().equals(s)) {
|
||||
textarea.setSelectedText("");
|
||||
} else {
|
||||
textarea.select(sel, sel);
|
||||
}
|
||||
}
|
||||
|
||||
// mark this event as already handled
|
||||
event.consume();
|
||||
return true;
|
||||
|
||||
@@ -174,6 +174,7 @@ public class Runner implements MessageConsumer {
|
||||
|
||||
//params.add("-Xint"); // interpreted mode
|
||||
//params.add("-Xprof"); // profiler
|
||||
//params.add("-Xaprof"); // allocation profiler
|
||||
//params.add("-Xrunhprof:cpu=samples"); // old-style profiler
|
||||
|
||||
String options = Preferences.get("run.options");
|
||||
|
||||
@@ -2154,8 +2154,7 @@ public class JEditTextArea extends JComponent
|
||||
|
||||
// If the user clicked on a non-letter char,
|
||||
// we select the surrounding non-letters
|
||||
boolean selectNoLetter = (!Character
|
||||
.isLetterOrDigit(ch)
|
||||
boolean selectNoLetter = (!Character.isLetterOrDigit(ch)
|
||||
&& noWordSep.indexOf(ch) == -1);
|
||||
|
||||
int wordStart = 0;
|
||||
@@ -2173,8 +2172,7 @@ public class JEditTextArea extends JComponent
|
||||
for(int i = offset; i < lineText.length(); i++)
|
||||
{
|
||||
ch = lineText.charAt(i);
|
||||
if(selectNoLetter ^ (!Character
|
||||
.isLetterOrDigit(ch) &&
|
||||
if(selectNoLetter ^ (!Character.isLetterOrDigit(ch) &&
|
||||
noWordSep.indexOf(ch) == -1))
|
||||
{
|
||||
wordEnd = i;
|
||||
|
||||
@@ -32,25 +32,33 @@ public class PdeTextAreaDefaults extends TextAreaDefaults {
|
||||
public PdeTextAreaDefaults() {
|
||||
|
||||
inputHandler = new DefaultInputHandler();
|
||||
inputHandler.addDefaultKeyBindings();
|
||||
//inputHandler.addDefaultKeyBindings(); // 0122
|
||||
|
||||
// use option on mac for things that are ctrl on windows/linux
|
||||
String mod = Base.isMacOS() ? "A" : "C";
|
||||
|
||||
inputHandler.addKeyBinding("S+BACK_SPACE", InputHandler.BACKSPACE);
|
||||
inputHandler.addKeyBinding("S+DELETE", InputHandler.DELETE);
|
||||
// right now, ctrl-up/down is select up/down, but mod should be
|
||||
// used instead, because the mac expects it to be option(alt)
|
||||
|
||||
inputHandler.addKeyBinding("BACK_SPACE", InputHandler.BACKSPACE);
|
||||
inputHandler.addKeyBinding("DELETE", InputHandler.DELETE);
|
||||
|
||||
//inputHandler.addKeyBinding("S+BACK_SPACE", InputHandler.BACKSPACE);
|
||||
// for 0122, shift-backspace is delete
|
||||
inputHandler.addKeyBinding("S+BACK_SPACE", InputHandler.DELETE);
|
||||
inputHandler.addKeyBinding("S+DELETE", InputHandler.DELETE);
|
||||
|
||||
// the following two were changing for 0122 for better mac/pc compatability
|
||||
inputHandler.addKeyBinding(mod+"+BACK_SPACE", InputHandler.BACKSPACE_WORD);
|
||||
inputHandler.addKeyBinding(mod+"+DELETE", InputHandler.DELETE_WORD);
|
||||
|
||||
inputHandler.addKeyBinding("ENTER", InputHandler.INSERT_BREAK);
|
||||
inputHandler.addKeyBinding("TAB", InputHandler.INSERT_TAB);
|
||||
// handled by listener, don't bother here
|
||||
//inputHandler.addKeyBinding("ENTER", InputHandler.INSERT_BREAK);
|
||||
//inputHandler.addKeyBinding("TAB", InputHandler.INSERT_TAB);
|
||||
|
||||
inputHandler.addKeyBinding("INSERT", InputHandler.OVERWRITE);
|
||||
inputHandler.addKeyBinding("C+\\", InputHandler.TOGGLE_RECT);
|
||||
// disabling for 0122, not sure what this does
|
||||
//inputHandler.addKeyBinding("C+\\", InputHandler.TOGGLE_RECT);
|
||||
|
||||
// beginning and ending of the current line
|
||||
/*
|
||||
@@ -70,13 +78,13 @@ public class PdeTextAreaDefaults extends TextAreaDefaults {
|
||||
if (Base.isMacOS()) {
|
||||
inputHandler.addKeyBinding("M+LEFT", InputHandler.HOME);
|
||||
inputHandler.addKeyBinding("M+RIGHT", InputHandler.END);
|
||||
inputHandler.addKeyBinding("M+S+LEFT", InputHandler.SELECT_HOME); // 0122
|
||||
inputHandler.addKeyBinding("M+S+RIGHT", InputHandler.SELECT_END); // 0122
|
||||
inputHandler.addKeyBinding("MS+LEFT", InputHandler.SELECT_HOME); // 0122
|
||||
inputHandler.addKeyBinding("MS+RIGHT", InputHandler.SELECT_END); // 0122
|
||||
} else {
|
||||
inputHandler.addKeyBinding("C+LEFT", InputHandler.HOME); // 0122
|
||||
inputHandler.addKeyBinding("C+RIGHT", InputHandler.END); // 0122
|
||||
inputHandler.addKeyBinding("C+S+HOME", InputHandler.SELECT_HOME); // 0122
|
||||
inputHandler.addKeyBinding("C+S+END", InputHandler.SELECT_END); // 0122
|
||||
inputHandler.addKeyBinding("CS+HOME", InputHandler.SELECT_HOME); // 0122
|
||||
inputHandler.addKeyBinding("CS+END", InputHandler.SELECT_END); // 0122
|
||||
}
|
||||
|
||||
inputHandler.addKeyBinding("PAGE_UP", InputHandler.PREV_PAGE);
|
||||
|
||||
@@ -11,6 +11,15 @@ ABOUT REV 0122 - XX November 2006
|
||||
|
||||
[ bug fixes ]
|
||||
|
||||
+ Lots of work done to improve the formatting, and also make the
|
||||
key combinations work more appropriately for the various platforms.
|
||||
For instance, HOME and END keys now move to the beginning or end
|
||||
of the document, while ctrl-left and right (cmd-left and right on mac)
|
||||
moves to the beginning or the end of a line. Outdenting when a brace
|
||||
is used and some other quirks have been ironed out more.
|
||||
Shift-backspace now also produces 'delete', which is a useful thing
|
||||
found in many programming text editors.
|
||||
|
||||
+ Forgot to mention, there was a fix added in revision 0120 that
|
||||
prevented files dragged into a sketch from bouncing back to the
|
||||
desktop on Mac OS X. (It formerly gave the impression that the
|
||||
|
||||
+13
-9
@@ -7,7 +7,19 @@ _ test this out for a bit
|
||||
_ though that's awkward b/c colors always RGB
|
||||
_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Suggestions;action=display;num=1160096087
|
||||
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=428
|
||||
fixed earlier, bug cleaning
|
||||
X gray background in pdf (using both gl and p3d)
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=324
|
||||
X verified as fixed in 0122
|
||||
|
||||
_ using gl, lines don't show up in pdf with record (they're ok with p3d)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=325
|
||||
|
||||
_ tint() and noTint() switching problem in P2D
|
||||
_ this should be a quick fix
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=222
|
||||
_ ARGB problems with createGraphics
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=428
|
||||
_ related to the fill bugs: when fill is identical, no fill applied
|
||||
_ actually tint() should take over for fill as per-vertex color
|
||||
_ when textured images are being used
|
||||
@@ -185,11 +197,6 @@ _ lines will occlude tris and vice versa
|
||||
_ will need to split each based on the other
|
||||
_ sort issues will affect both
|
||||
|
||||
_ gray background in pdf (using both gl and p3d)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=324
|
||||
_ using gl, lines don't show up in pdf with record (they're ok with p3d)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=325
|
||||
|
||||
_ pixel operations are broken in opengl
|
||||
_ get(), set(), copy(), blend(), loadPixels, updatePixels()
|
||||
_ set(x, y, image) y reversed in openGL
|
||||
@@ -274,9 +281,6 @@ _ dataFolder() might be flawed b/c it's referring to contents of jar file
|
||||
_ for input, better to use openStream
|
||||
_ clear up the documentation on this
|
||||
|
||||
_ tint() and noTint() switching problem in P2D
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=222
|
||||
|
||||
_ add texture support to recordShapesRaw (this might be pretty obscure...)
|
||||
|
||||
_ STROKE_WEIGHT field in PGraphics3 is a disaster, because it's an int
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
0122 pde
|
||||
X improve editor listener to not add so many extraneous indents
|
||||
X with text selected, hitting left or right arrow should move to beginning/end
|
||||
X right now, it deselects the text and moves over one char
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=349
|
||||
X cmd-shift-left and cmd-shift right should select the entire line
|
||||
X cmd-left and cmd-right move back and forth properly
|
||||
o option for behavior of HOME and END
|
||||
X right now goes to begin/end of line.. should be begin/end of file?
|
||||
X change to begin/end of file, and use cmd or alt, based on platform
|
||||
_ other quirks with handling of keyboard shortcuts?
|
||||
_ http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGUserInput/chapter_11_section_3.html#//apple_ref/doc/uid/TP30000361-TP22
|
||||
|
||||
_ when running externally, set window frame title to the sketch name
|
||||
_ is this only a problem on macosx?
|
||||
|
||||
fixed earlier or wontfix
|
||||
X double-click only selects part of underscored word
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=261
|
||||
X this is actually a feature
|
||||
|
||||
_ when drawing large video, the two triangles for the rect are out of sync
|
||||
_ only shows up in P3D
|
||||
|
||||
|
||||
libraries
|
||||
_ add control for dependencies (i.e. svg needs xml), needed for export
|
||||
@@ -57,6 +79,8 @@ _ also something i forgot to add to the opengl faq stuff
|
||||
_ move the bugs section of the troubleshooting page to dev.processing.org/bugs
|
||||
_ search for ALL in the bugs db turns up:
|
||||
http://dev.processing.org/bugs/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED
|
||||
http://dev.processing.org/bugs/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED
|
||||
_ http://dev.processing.org/bugs/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&query_format=advanced&order=bugs.priority,bugs.priority%2Cbugs.resolution%2Cbugs.bug_id&query_based_on=
|
||||
_ add note to bugs db asking to please use archive sketch and attach
|
||||
_ make a web page that describes how to use the bugs db
|
||||
_ don't change the bug subject/summary text
|
||||
@@ -404,9 +428,10 @@ _ http://processing.org/bugs/show_bug.cgi?id=51
|
||||
_ code coloring is imperfect because it's not based on a parser
|
||||
_ i.e. mousePressed() is red but mouseMoved() is brown
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=113
|
||||
_ quirks in selection and arrow keys
|
||||
_ clicking i-- ) between -- and ) will select "-- )"
|
||||
_ in eclipse, it looks to see which is closest and selects that
|
||||
_ need to check behavior for word and bbedit
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=348
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=349
|
||||
_ implement emacs keybindings (list is at the bug report)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=401
|
||||
|
||||
|
||||
Reference in New Issue
Block a user