Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved indentation system #168

Merged
merged 1 commit into from
Feb 16, 2023
Merged

Improved indentation system #168

merged 1 commit into from
Feb 16, 2023

Conversation

Wakeful-Cloud
Copy link
Contributor

This pull request adds the ability to:

  • Indent all selected lines with TAB
  • De-indent all selected lines with SHIFT + TAB
  • Deindent the line the caret is currently on

@Wakeful-Cloud
Copy link
Contributor Author

@TheThirdOne Hello again! Have you had any time to review this?

// manager use them for focus traversal.
// One can also accomplish this using: setFocusTraversalKeysEnabled(false);
// but that seems heavy-handed.
// DPS 12May2010
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(
new KeyEventDispatcher() {
public boolean dispatchKeyEvent(KeyEvent e) {
if (JEditTextArea.this.isFocusOwner() && e.getKeyCode() == KeyEvent.VK_TAB && e.getModifiers() == 0) {
int modifiers = e.getModifiers();
if (JEditTextArea.this.isFocusOwner() && e.getKeyCode() == KeyEvent.VK_TAB
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be overcomplicating the matter a bit, but if simplified to JEditTextArea.this.isFocusOwner() && e.getKeyCode() == KeyEvent.VK_TAB CTRL + TAB results in a stack overflow for some reason.

@TheThirdOne
Copy link
Owner

I'm sorry it took me a while to get to this. I meant to get to this over both of the past weekends.

Looks good. It acts like most other text editors.

Thanks for the contribution.

@TheThirdOne TheThirdOne merged commit 06d1c60 into TheThirdOne:master Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants