1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-18 12:54:25 +01:00

IDE: "New/rename tab" now allow numbers as first char

Fix #6656
Related to #6592 and 4545283ae773b6351d089e37b6d4080905ea8fd5
This commit is contained in:
Cristian Maglie 2017-08-28 14:35:49 +02:00
parent 5bbb9054d4
commit fcd88e6a43

View File

@ -316,21 +316,12 @@ public class EditorStatus extends JPanel {
editField.setCaretPosition(start + 1);
event.consume();
} else if ((c == '_') || (c == '.') || ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))) { // allow .pde and .java
// these are ok, allow them through
} else if ((c >= '0') && (c <= '9')) {
// getCaretPosition == 0 means that it's the first char
// and the field is empty.
// getSelectionStart means that it *will be* the first
// char, because the selection is about to be replaced
// with whatever is typed.
if ((editField.getCaretPosition() == 0) ||
(editField.getSelectionStart() == 0)) {
// number not allowed as first digit
event.consume();
}
// these are ok, allow them through
} else {
event.consume();
}