mirror of
https://github.com/TrianguloY/LightningLauncher.git
synced 2024-12-26 09:58:20 +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.ImageSvg;
|
||||
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.PageIndicator;
|
||||
import net.pierrox.lightning_launcher.script.api.Panel;
|
||||
|
@ -619,7 +618,20 @@ public class ScriptEditor extends ResourceWrapperActivity implements View.OnClic
|
|||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
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");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.onKeyUp(keyCode, event);
|
||||
|
|
Loading…
Reference in a new issue