mirror of
https://github.com/TrianguloY/LightningLauncher.git
synced 2024-12-27 09:58:48 +01:00
Merge branch 'scriptEditor' of lightning-dev/lightning_launcher into 14.3-beta7
This commit is contained in:
commit
1b8bf77246
1 changed files with 14 additions and 2 deletions
|
@ -64,7 +64,6 @@ import net.pierrox.lightning_launcher.script.api.ImageNinePatch;
|
||||||
import net.pierrox.lightning_launcher.script.api.ImageScript;
|
import net.pierrox.lightning_launcher.script.api.ImageScript;
|
||||||
import net.pierrox.lightning_launcher.script.api.ImageSvg;
|
import net.pierrox.lightning_launcher.script.api.ImageSvg;
|
||||||
import net.pierrox.lightning_launcher.script.api.Item;
|
import net.pierrox.lightning_launcher.script.api.Item;
|
||||||
import net.pierrox.lightning_launcher.script.api.LL;
|
|
||||||
import net.pierrox.lightning_launcher.script.api.Lightning;
|
import net.pierrox.lightning_launcher.script.api.Lightning;
|
||||||
import net.pierrox.lightning_launcher.script.api.PageIndicator;
|
import net.pierrox.lightning_launcher.script.api.PageIndicator;
|
||||||
import net.pierrox.lightning_launcher.script.api.Panel;
|
import net.pierrox.lightning_launcher.script.api.Panel;
|
||||||
|
@ -619,7 +618,20 @@ public class ScriptEditor extends ResourceWrapperActivity implements View.OnClic
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||||
if(keyCode == KeyEvent.KEYCODE_TAB) {
|
if(keyCode == KeyEvent.KEYCODE_TAB) {
|
||||||
|
if(event.isShiftPressed()){
|
||||||
|
// Shift tab, decrease indent
|
||||||
|
Pair<Integer, Integer> selectionI =
|
||||||
|
Indentation.modifyIndent(mScriptText.getSelectionStart(), mScriptText.getSelectionEnd(), false, mScriptText.getEditableText());
|
||||||
|
mScriptText.setSelection(selectionI.first, selectionI.second);
|
||||||
|
}else if(mScriptText.hasSelection()){
|
||||||
|
// No shift tab && selection, increase indent
|
||||||
|
Pair<Integer, Integer> selectionI =
|
||||||
|
Indentation.modifyIndent(mScriptText.getSelectionStart(), mScriptText.getSelectionEnd(), true, mScriptText.getEditableText());
|
||||||
|
mScriptText.setSelection(selectionI.first, selectionI.second);
|
||||||
|
}else {
|
||||||
|
// No shift tab && no selection, add tab char
|
||||||
mScriptText.getText().insert(mScriptText.getSelectionStart(), "\t");
|
mScriptText.getText().insert(mScriptText.getSelectionStart(), "\t");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onKeyUp(keyCode, event);
|
return super.onKeyUp(keyCode, event);
|
||||||
|
|
Loading…
Reference in a new issue