Skip to content

isAutoActivateOkay is broken #100

Open

Description

@jbellis
	@Override
	public boolean isAutoActivateOkay(JTextComponent tc) {
		Document doc = tc.getDocument();
		char ch = 0;
		try {
			doc.getText(tc.getCaretPosition(), 1, s);
			ch = s.first();
		} catch (BadLocationException ble) { // Never happens
			ble.printStackTrace();
		}
		return (autoActivateAfterLetters && Character.isLetter(ch)) ||
				(autoActivateChars!=null && autoActivateChars.indexOf(ch)>-1);
	}

when you are typing at the end of your text (the normal caret position) ch will always be the sentinel \n and Character.isLetter(ch) will evaluate to false which is not intended

Activity

  1. bobbylight commented on Jan 3, 2026

    @bobbylight
    Owner

    @jbellis - sorry, I took a break from this project but am back and looking at open items. This seems to work for me - see for example the AutoCompletionDemo module, which lets you type e.g. p and the autocomplete popup appears after a short delay with the proper completions. Can you provide an example of this not working for you?

  2. self-assigned this
    on Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions