1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Do not allow negative font resize

Fix #6359 (again)
This commit is contained in:
Cristian Maglie 2017-08-28 17:57:20 +02:00
parent fcd88e6a43
commit 5427f94b9d

View File

@ -1854,11 +1854,18 @@ public class Base {
* Adjust font size
*/
public void handleFontSizeChange(int change) {
String pieces[] = PApplet.split(PreferencesData.get("editor.font"), ',');
String pieces[] = PreferencesData.get("editor.font").split(",");
try {
int newSize = Integer.parseInt(pieces[2]) + change;
if (newSize < 4)
newSize = 4;
pieces[2] = String.valueOf(newSize);
PreferencesData.set("editor.font", PApplet.join(pieces, ','));
this.getEditors().forEach(processing.app.Editor::applyPreferences);
} catch (NumberFormatException e) {
// ignore
return;
}
PreferencesData.set("editor.font", StringUtils.join(pieces, ','));
getEditors().forEach(Editor::applyPreferences);
}
// XXX: Remove this method and make librariesIndexer non-static