mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 10:30:44 +01:00
add source option for CC insert
This commit is contained in:
@@ -86,6 +86,8 @@ public class CompletionPanel {
|
||||
private JScrollPane scrollPane;
|
||||
|
||||
protected DebugEditor editor;
|
||||
|
||||
public static final int MOUSE_COMPLETION = 10, KEYBOARD_COMPLETION = 20;
|
||||
|
||||
/**
|
||||
* Triggers the completion popup
|
||||
@@ -254,7 +256,7 @@ public class CompletionPanel {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (e.getClickCount() == 2) {
|
||||
insertSelection();
|
||||
insertSelection(MOUSE_COMPLETION);
|
||||
hide();
|
||||
}
|
||||
}
|
||||
@@ -296,7 +298,7 @@ public class CompletionPanel {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean insertSelection() {
|
||||
public boolean insertSelection(int completionSource) {
|
||||
if (completionList.getSelectedValue() != null) {
|
||||
try {
|
||||
// If user types 'abc.', subword becomes '.' and null is returned
|
||||
@@ -324,6 +326,13 @@ public class CompletionPanel {
|
||||
}
|
||||
}
|
||||
|
||||
if (completionSource == MOUSE_COMPLETION) {
|
||||
if (completionString.endsWith("(")) {
|
||||
completionString = completionString.substring(0, completionString
|
||||
.length() - 2);
|
||||
}
|
||||
}
|
||||
|
||||
logE(subWord + " <= subword, Inserting suggestion=> "
|
||||
+ selectedSuggestion + " Current sub: " + currentSubword);
|
||||
if (currentSubword.length() > 0) {
|
||||
|
||||
@@ -163,7 +163,7 @@ public class TextArea extends JEditTextArea {
|
||||
else if(evt.getKeyCode() == KeyEvent.VK_ENTER && evt.getID() == KeyEvent.KEY_PRESSED){
|
||||
if (suggestion != null) {
|
||||
if (suggestion.isVisible()) {
|
||||
if (suggestion.insertSelection()) {
|
||||
if (suggestion.insertSelection(CompletionPanel.KEYBOARD_COMPLETION)) {
|
||||
//hideSuggestion(); // Kill it!
|
||||
evt.consume();
|
||||
// Still try to show suggestions after inserting if it's
|
||||
|
||||
Reference in New Issue
Block a user