Skip to content

Commit

Permalink
Click shift+Enter to run
Browse files Browse the repository at this point in the history
  • Loading branch information
duy committed Oct 29, 2024
1 parent 9a06525 commit 80a7a24
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -67,6 +68,8 @@
import java.util.stream.Collectors;

import io.github.rosemoe.sora.event.ContentChangeEvent;
import io.github.rosemoe.sora.event.EditorKeyEvent;
import io.github.rosemoe.sora.event.KeyBindingEvent;


public abstract class BaseProgrammingFragment extends Fragment implements DragListener,
Expand Down Expand Up @@ -368,6 +371,15 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
}
}
});
inputView.subscribeEvent(KeyBindingEvent.class, (keyBindingEvent, unsubscribe) -> {
if (keyBindingEvent.isShiftPressed() && keyBindingEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
keyBindingEvent.intercept();
if (btnRun.isEnabled()) {
clickRun();
}
}
});


txtErrorLabel = view.findViewById(R.id.symja_prgm_txt_error_message);
errorContainer = view.findViewById(R.id.symja_prgm_error_container);
Expand Down

0 comments on commit 80a7a24

Please sign in to comment.