mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-19 09:42:11 +03:00
Merging r327:r331 of the branches/processing-sync into the trunk. This adds the Processing core, and some new features including printing, copy for discourse, better auto-format, improved keyboard shortcuts, etc.
This commit is contained in:
@ -136,9 +136,10 @@ public abstract class InputHandler extends KeyAdapter
|
||||
{
|
||||
String name = (String)en.nextElement();
|
||||
ActionListener _listener = getAction(name);
|
||||
if(_listener == listener)
|
||||
if(_listener == listener) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -180,7 +181,6 @@ public abstract class InputHandler extends KeyAdapter
|
||||
/**
|
||||
* Grabs the next key typed event and invokes the specified
|
||||
* action with the key as a the action command.
|
||||
* @param action The action
|
||||
*/
|
||||
public void grabNextKeyStroke(ActionListener listener)
|
||||
{
|
||||
@ -743,19 +743,32 @@ public abstract class InputHandler extends KeyAdapter
|
||||
{
|
||||
JEditTextArea textArea = getTextArea(evt);
|
||||
int caret = textArea.getCaretPosition();
|
||||
|
||||
if(caret == textArea.getDocumentLength())
|
||||
{
|
||||
if (textArea.getSelectionStart() !=
|
||||
textArea.getSelectionEnd()) {
|
||||
// just move to the end of the selection
|
||||
textArea.select(caret, caret);
|
||||
} else {
|
||||
// beep at the user for being annoying
|
||||
textArea.getToolkit().beep();
|
||||
return;
|
||||
}
|
||||
|
||||
if(select)
|
||||
textArea.select(textArea.getMarkPosition(),
|
||||
caret + 1);
|
||||
else
|
||||
} else if (select) {
|
||||
textArea.select(textArea.getMarkPosition(), caret+1);
|
||||
|
||||
} else {
|
||||
int start = textArea.getSelectionStart();
|
||||
int end = textArea.getSelectionEnd();
|
||||
if (start != end) {
|
||||
textArea.select(end, end);
|
||||
} else {
|
||||
textArea.setCaretPosition(caret + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class next_line implements ActionListener
|
||||
{
|
||||
@ -774,7 +787,13 @@ public abstract class InputHandler extends KeyAdapter
|
||||
|
||||
if(line == textArea.getLineCount() - 1)
|
||||
{
|
||||
textArea.getToolkit().beep();
|
||||
//textArea.getToolkit().beep();
|
||||
int doc = textArea.getDocumentLength();
|
||||
if (select) {
|
||||
textArea.select(textArea.getMarkPosition(), doc);
|
||||
} else {
|
||||
textArea.setCaretPosition(doc);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -901,13 +920,19 @@ public abstract class InputHandler extends KeyAdapter
|
||||
return;
|
||||
}
|
||||
|
||||
if(select)
|
||||
textArea.select(textArea.getMarkPosition(),
|
||||
caret - 1);
|
||||
else
|
||||
if (select) {
|
||||
textArea.select(textArea.getMarkPosition(), caret-1);
|
||||
} else {
|
||||
int start = textArea.getSelectionStart();
|
||||
int end = textArea.getSelectionEnd();
|
||||
if (start != end) {
|
||||
textArea.select(start, start);
|
||||
} else {
|
||||
textArea.setCaretPosition(caret - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class prev_line implements ActionListener
|
||||
{
|
||||
@ -926,7 +951,14 @@ public abstract class InputHandler extends KeyAdapter
|
||||
|
||||
if(line == 0)
|
||||
{
|
||||
textArea.getToolkit().beep();
|
||||
if (select) {
|
||||
if (textArea.getSelectionStart() != 0) {
|
||||
textArea.select(textArea.getMarkPosition(), 0);
|
||||
}
|
||||
} else {
|
||||
textArea.setCaretPosition(0);
|
||||
}
|
||||
//textArea.getToolkit().beep();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user