typora-issues icon indicating copy to clipboard operation
typora-issues copied to clipboard

[Feature] Let user customize the behavior of `ENTER`

Open vassudanagunta opened this issue 2 years ago • 10 comments

There are three possible ways to end a line:

  • start a new paragraph.
  • insert a hard line break. This is necessary when typing verse (poetry, lyrics).
  • insert a soft line break. This matters for people who want to control the line breaks of the source code, e.g. for consistent diffs, or for people who configure Typora to render soft line breaks as hard line breaks, as allowed by the CommonMark spec:

    A renderer may also provide an option to render soft line breaks as hard line breaks.

Recommendation

Give user total control of how all three are entered, via Settings. For example, here are two possible configurations, a default, and one that addresses Issue #37:

default example alternative
new paragraph enter enter enter
soft line break ctrl-enter enter
hard line break shift-enter shift-enter

Advantages

  • As explained by Issue #37, not everyone wants enter to mean the same thing.
  • There are other issues such as #4760 for which people will want different key combinations.
  • Allows Typora to be updated without breaking existing user expectations: the default setting can reflect

Additional Recommendation: customizing hard line breaks

Let the user configure which CommonMark compatible) representation of hard line break is inserted at the end of the line:

  • two spaces[^1]
  • a backslash[^1]
  • a <br> tag

This would address #2435.


[^1]: <br> will always be used in a table, due to table limitations.

vassudanagunta avatar Oct 29 '21 17:10 vassudanagunta