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

Feat: Add configuration option to always indent on TAB key press #2187

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

agata
Copy link
Contributor

@agata agata commented Sep 5, 2024

Description

I have added an option that allows indentation/un-indentation to be applied whenever the Tab key is pressed, regardless of the cursor position.

Previously, the Tab key would only function as an indent when the cursor was at the beginning of a line. If the Tab key was pressed in the middle of a line (for example, within a bullet point), it would just insert a tab character without indenting.

In common editors like Google Docs or Notion, and in input fields such as Slack, pressing Tab is always recognized as an indent and Shift + Tab as an un-indent, regardless of the cursor's position. To make Flutter Quill more accessible and familiar to a wider audience, we have introduced a feature that mimics this behavior.

By default, the Tab key will still only trigger indentation at the beginning of a line, as it has in the past.

Since tabs are visually indistinguishable from spaces in the editor, the need to input a tab character directly seems rare. Therefore, we considered making it so that the Tab key always functions as an indent, without adding an option. While we’ve chosen to introduce this as an optional feature for now to maintain the current behavior, we could also consider changing the default behavior or setting this option to true by default if there's no strong reason to preserve the existing behavior.

Please feel free to share your thoughts on this approach.

Related Issues

Type of Change

  • New feature: Adds new functionality without breaking existing features.
  • 🛠️ Bug fix: Resolves an issue without altering current behavior.
  • 🧹 Code refactor: Code restructuring that does not affect behavior.
  • Breaking change: Alters existing functionality and requires updates.
  • 🧪 Tests: Adds new tests or modifies existing tests.
  • 📝 Documentation: Updates or additions to documentation.
  • 🗑️ Chore: Routine tasks, or maintenance.
  • Build configuration change: Changes to build or deploy processes.

Suggestions

- Introduced `enableAlwaysIndentOnTab` configuration to control TAB key behavior.
- When set to true, TAB key will always insert indentation, regardless of the cursor's context.
- When false, indentation occurs only at the beginning of list items, otherwise a tab character is inserted.
- Default value is set to false. Updated related classes and logic to handle the new option.
@singerdmx singerdmx merged commit 19e93af into singerdmx:master Sep 5, 2024
2 checks passed
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