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 tab support in dingus #293

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

toptensoftware
Copy link

  • changed tab size to 4
  • support for typing tab key + block indent/unindent.

 - changed tab size to 4
 - support for typing tab key + block indent/unindent.
@jgm
Copy link
Member

jgm commented Oct 4, 2024

This is a fairly complex change. (Certainly the 4-space tab indent is a good idea.)

Can you explain what the "block indent/unindent" code does, exactly?

@toptensoftware
Copy link
Author

Hi @jgm ,

I made these changes because I was playing with the demo, trying to understand how tabs work but couldn't actually type a tab key and had to copy/paste one.

In addition to letting you type a tab character it also supports:

  • block indentation by selecting a range of lines and pressing tab
  • block un-indentation by selecting a range of lines and pressing shift+tab
  • auto indenting the new line when pressing enter (duplicates leading whitespace from the previous line)
  • escape key, followed by tab key does default tab key behaviour (ie: moves focus out of text area)

You can try it here if you like.

The code is an almost exact copy from here. I wrote this in 2017, it's been pretty well received on stackoverflow with no issues reported. I've recently tested it on Chrome (Windows, Ubuntu, macOS), Edge (Windows), Firefox (Windows+macOS+Ubuntu), Opera (macOS+Ubuntu), Safari (macOS and iOS with physical keyboard). Not sure about Android or other browsers.

fwiw: if you'd prefer something simpler, see the other answers on the same stackoverflow post but they only support inserting a tab character.

Brad

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