This is an automated email from the git hooks/post-receive script. ben pushed a commit to branch master in repository autocomplete.
commit 3f7cc0540304697e50ec5cbcac06418512f9fe24 Author: bobbylight <[email protected]> Date: Sun Aug 12 23:39:06 2012 +0000 AutoComplete: When in parameter completion mode, Enter should insert a newline if pressed when at the "end" offset. --- .../ParameterizedCompletionContext.java | 24 +++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/org/fife/ui/autocomplete/ParameterizedCompletionContext.java b/src/org/fife/ui/autocomplete/ParameterizedCompletionContext.java index fa99f4f..81ea1c3 100644 --- a/src/org/fife/ui/autocomplete/ParameterizedCompletionContext.java +++ b/src/org/fife/ui/autocomplete/ParameterizedCompletionContext.java @@ -33,6 +33,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.AbstractDocument; import javax.swing.text.BadLocationException; +import javax.swing.text.DefaultEditorKit; import javax.swing.text.Document; import javax.swing.text.Highlighter; import javax.swing.text.JTextComponent; @@ -767,7 +768,6 @@ class ParameterizedCompletionContext { System.out.println("CompletionContext Uninstalling keybindings"); } - JTextComponent tc = ac.getTextComponent(); InputMap im = tc.getInputMap(); ActionMap am = tc.getActionMap(); @@ -885,10 +885,28 @@ class ParameterizedCompletionContext { } // Otherwise, just move to the end. - JTextComponent tc = ac.getTextComponent(); - tc.setCaretPosition(defaultEndOffs.getOffset()); deactivate(); + JTextComponent tc = ac.getTextComponent(); + int dot = tc.getCaretPosition(); + if (dot!=defaultEndOffs.getOffset()) { + tc.setCaretPosition(defaultEndOffs.getOffset()); + } + else { + // oldEnterAction isn't what we're looking for (wrong key) + Action a = getDefaultEnterAction(tc); + if (a!=null) { + a.actionPerformed(e); + } + else { + tc.replaceSelection("\n"); + } + } + + } + private Action getDefaultEnterAction(JTextComponent tc) { + ActionMap am = tc.getActionMap(); + return am.get(DefaultEditorKit.insertBreakAction); } } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/autocomplete.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

