opt: functions keyboard auto insert brackets
This commit is contained in:
@@ -257,6 +257,12 @@ public class CodeMirrorEditor extends FrameLayout {
|
|||||||
" {line: editor.getCursor().line + 1, ch: 0});");
|
" {line: editor.getCursor().line + 1, ch: 0});");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void moveCursor(int dLine, int dCh) {
|
||||||
|
evalJavaScript(String.format(Locale.getDefault(),
|
||||||
|
"editor.setCursor({line: editor.getCursor().line + (%d), ch: editor.getCursor().ch + (%d)});",
|
||||||
|
dLine, dCh));
|
||||||
|
}
|
||||||
|
|
||||||
public void copyLine() {
|
public void copyLine() {
|
||||||
getLine()
|
getLine()
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
@@ -561,7 +567,7 @@ public class CodeMirrorEditor extends FrameLayout {
|
|||||||
post(CodeMirrorEditor.this::selectAll);
|
post(CodeMirrorEditor.this::selectAll);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(id == android.R.id.startSelectingText){
|
if (id == android.R.id.startSelectingText) {
|
||||||
evalJavaScript("editor.setSelection(editor.getCursor(), {line: editor.getCursor().line, ch: editor.getCursor().ch - 1});");
|
evalJavaScript("editor.setSelection(editor.getCursor(), {line: editor.getCursor().line, ch: editor.getCursor().ch - 1});");
|
||||||
}
|
}
|
||||||
return super.performContextMenuAction(id);
|
return super.performContextMenuAction(id);
|
||||||
|
|||||||
@@ -428,10 +428,11 @@ public class EditorView extends FrameLayout implements CodeCompletionBar.OnHintC
|
|||||||
@Override
|
@Override
|
||||||
public void onPropertyClick(Module m, Property property) {
|
public void onPropertyClick(Module m, Property property) {
|
||||||
if (property.isGlobal()) {
|
if (property.isGlobal()) {
|
||||||
mEditor.insert(property.getKey());
|
mEditor.insert(property.getKey() + "()");
|
||||||
} else {
|
} else {
|
||||||
mEditor.insert(m.getName() + "." + property.getKey());
|
mEditor.insert(m.getName() + "." + property.getKey() + "()");
|
||||||
}
|
}
|
||||||
|
mEditor.moveCursor(0, -1);
|
||||||
mFunctionsKeyboardHelper.hideFunctionsLayout(true);
|
mFunctionsKeyboardHelper.hideFunctionsLayout(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user