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

Do not force line break spacing on the user #2761

Closed
sailr7 opened this issue Jul 29, 2022 · 24 comments · Fixed by #3568
Closed

Do not force line break spacing on the user #2761

sailr7 opened this issue Jul 29, 2022 · 24 comments · Fixed by #3568
Labels
enhancement New feature or request feature: formatting Features related to text formatting and node types format: markdown

Comments

@sailr7
Copy link

sailr7 commented Jul 29, 2022

Is your feature request related to a problem? Please describe.
Two of the greatest advantages of markdown editors are 1) simplicity and 2) control. Nextcloud Text misses Point 2 when it FORCES line break spacing on the user. There are many times I don't want spacing in line breaks when taking notes -- such as if I am just jotting loose ideas, or I want to cluster concepts together. But with forced line break spacing the file becomes long and spaced out, with no discernible idea clusters. Furthermore, when downloading to markdown, those spaces turn into full line breaks of their own, which makes the document even more spaced out. Most of the major rich-text notetaking apps are not forcing line break spacing, such as Evernote, OneNote, Google Keep, etc, and I think that's for good reason -- they recognize the user doesn't always want this.

Describe the solution you'd like
Option A: Get rid of line break spacing entirely. If the user wants space after a line break, they can do it manually with their keyboard (just hit 'enter' one more time). A tried and true method that dates back to the typewriter 😉.

Option B: If we must keep some iteration of this feature, then give the user the OPTION to turn this on or off with a button in the feature tray. Line break spacing would be attributed to a block of text (i.e. the text in between line breaks). If it is turned on for the block, then there is spacing underneath. If it is turned off then there is no spacing.

Additional context

  1. If Nextcloud will approve of the concept, I can contribute to the development of this.
  2. Below is a video from Google Docs, exemplifying how it could be turned on/off for the text.
    Google Docs Line Break Spacing Example.webm
  3. Below is a rendering of what the icon could look like in the feature tray.
    Line Spacing Icon
@sailr7 sailr7 added the enhancement New feature or request label Jul 29, 2022
@vinicius73 vinicius73 added feature: formatting Features related to text formatting and node types format: markdown labels Jul 29, 2022
@susnux
Copy link
Contributor

susnux commented Jul 29, 2022

I do not fully understand the problem correctly, you can either press Enter for new paragraphs or Shift-Enter for "normal" line breaks (hard breaks) without any spacing.

Hello<Enter>World results in:

Hello

World

Hello<Shift+Enter>World results in:

Hello\
World

@sailr7
Copy link
Author

sailr7 commented Jul 29, 2022

Okay I see that now. I did not know this. Nor is this provided in the Formatting help pop-up.

What about in mobile, how do you type without page break spacing?

@sailr7 sailr7 closed this as completed Jul 29, 2022
@sailr7 sailr7 reopened this Jul 29, 2022
@juliushaertl
Copy link
Member

Okay I see that now. I did not know this. Nor is this provided in the Formatting help pop-up.

What about in mobile, how do you type without page break spacing?

Would be interesting to see if any other mobile editors handle the different linebreaks during input. I think for desktop that is quite common, but at least I'm not aware of a general pattern for this on mobile.

@susnux
Copy link
Contributor

susnux commented Aug 1, 2022

Most I know only support new paragraphs on mobile.

But I think of some input rule like hitting enter one time will trigger a newline and hitting it two times triggers a new paragraph.
Would this a solution worth considering?

@sailr7
Copy link
Author

sailr7 commented Aug 1, 2022

Since this is a matter of formatting, I think the most straightforward and most consistent way to do this is to put an icon in the formatting tray with all the other formatting icons. When the icon is active, hitting enter results in line break spacing (same behavior as what is now Shift + Enter on web). When the icon is not active, hitting enter behaves like normal enter. This also allows the matter to be resolved in mobile as well.

  1. Philosophically, this solution falls more in line with the way Nextcloud Text is structured. That starting point of the file is plain text with no formatting. The formatting bar then allows for formatting to be layered on top (including the formatting of line break spacing).
  2. This will avoid confusion for users who are not aware of Shift+Enter shortcut, and eliminate having to press an extra key (Shift)
  3. It will allow for a consistent experience on mobile.

Icon could look like this:
Line Spacing Icon

@susnux
Copy link
Contributor

susnux commented Aug 1, 2022

I guess that icon would be pretty confusing, as it looks like adjusting the line height (or line spacing) in most office apps.
While in reality it has nothing to do with the spacing but toggles between line breaks and new paragraphs.
(also not sure about the usability as the formatting bar gets somewhat full)

@sailr7
Copy link
Author

sailr7 commented Aug 1, 2022

I get what you mean, it is actually a full double line break instead of space in between two line breaks. Then I think there are two possible solutions that would solve the problem the easiest:

  1. Get rid of the double line break. The user can just press Enter twice like we do in almost all other text and note applications (especially for markdown-type ones this seems especially strange)
  2. Reverse the functionality, where Shift+Enter is a double space.

Both solutions also solve the problem on mobile.

@sailr7
Copy link
Author

sailr7 commented Aug 2, 2022

It looks like this functionality needs to be fixed anyways, because as you can see in the video below, when entering a new line break via a single line each (Shift+Enter), it carries over the Heading formatting to the previous line. This does not happen when entering a new page break via double line.

So I recommend we fix the logic based on Option 1 or 2 as mentioned above, and in doing so we fix the problem as I have shown. If agreed, I am willing to contribute.

Nextcloud.Text.Single.Line.Formatting.Issue.webm

@juliushaertl
Copy link
Member

  • Get rid of the double line break. The user can just press Enter twice like we do in almost all other text and note applications (especially for markdown-type ones this seems especially strange)
  • Reverse the functionality, where Shift+Enter is a double space.

I disagree on those points. In general there are no things as double links break, they are semantically different. One is a paragraph break and the other a line break and both office suites (MS Office, Libreoffice, as well as rich editors (like Notion) handle this separation by using Enter for a paragraph break and Shift+Enter for a line break.

It looks like this functionality needs to be fixed anyways, because as you can see in the video below, when entering a new line break via a single line each (Shift+Enter), it carries over the Heading formatting to the previous line. This does not happen when entering a new page break via double line.

This is expected behavior, as the newline will then be part of the heading block. Heading can only be ended by starting a paragraph, which adds spacing but not due to double newlines but due to the styling that we apply.

cc also @nimishavijay / @jancborchardt for the UX bits :)

@sailr7
Copy link
Author

sailr7 commented Aug 2, 2022

Okay, I see what you mean by the functional difference between line break and paragraph break and I do recognize the importance of this distinction. But it does not change the core issue I've been trying to address, which is that in all those examples you mentioned, "MS Office, Libreoffice, as well as rich editors (like Notion)," a paragraph break does not have double spacing styling by default -- but it does in Nextcloud Text.

Perhaps there is a visual workaround on Web by using line breaks instead of paragraph breaks (which has some functional limitations as I have shown in the video), but that still leaves the problem that double spacing cannot be avoided on mobile.

Might I just ask the same question again, but using the correct syntax to avoid confusion: Wouldn't this all be avoidable if paragraph breaks didn't have double line spacing? The user who wants double spacing just needs to hit Enter twice (virtually no inconvenience added and is common behavior), and the user who doesn't want it now has the choice.

StackEdit is a nice example of a smooth markdown editor that gives the user full control when editing and does not force this kind of formatting on the user.

@XueSheng-GIT
Copy link

XueSheng-GIT commented Aug 2, 2022

But it does not change the core issue I've been trying to address, which is that in all those examples you mentioned, "MS Office, Libreoffice, as well as rich editors (like Notion)," a paragraph break does not have double spacing styling by default -- but it does in Nextcloud Text.

The common Office suits do use spaces before/after paragraphs. Also depending on the textformatting you use. Of course the Office suits are way more complex than just a markdown editor.

I would vote to keep a default spacing between paragraphs. But I'm also missing the possibility to use Shift+Enter on mobile. Maybe it would be possible to convert a backslash at the end of a line to a hard line break?

EDIT: just adding the link to the hard line breaks of the commonmark spec... also double spaces at the end of a line seems to be used.
https://spec.commonmark.org/0.30/#hard-line-break

@nimishavijay
Copy link
Member

Very interesting issue. I would say we don't need any toggles as it would be confusing. Even in the Google Docs video, the icon used is to indicate line height, only in the additional options is there any mention of line breaks.

Pretty much every other editing tool allows you to use Shift+Enter to insert a line break and Enter for a paragraph break so it might be a matter of discoverability here. Once you discover it it's fairly uncomplicated to use. We could include it in the formatting help.

But I'm also missing the possibility to use Shift+Enter on mobile. Maybe it would be possible to convert a backslash at the end of a line to a hard line break?

I agree. On mobile there is no way to have a line break. Many markdown guides explicitly mention that a double space or a backslash ( \ ) at the end of a line indicates a line break. We could have support for both and convert it to a <br> while exporting so that there are no compatibility issues. And of course include this in the formatting help also.

Source:
Markdown guide
Jetbrains
Stackoverflow post

@sailr7
Copy link
Author

sailr7 commented Aug 2, 2022

Regarding the Jetbrains source mentioned, the guidance there seems perfectly clear on new paragraphs: "To start a new paragraph, leave a blank line between lines of text."

Wouldn't the simplest solution to this be to not try to mess with the user's spacing at all? Just take a literal interpretation. If they hit enter key once, that translates to a line break (no need to worry about trailing spaces or <br>). If they hit enter key twice, (i.e. leave a blank line in between lines of text), that translates to a new paragraph.

This solution works on mobile too.

Why complicate it with anything further?

@juliushaertl
Copy link
Member

Wouldn't the simplest solution to this be to not try to mess with the user's spacing at all? Just take a literal interpretation. If they hit enter key once, that translates to a line break (no need to worry about trailing spaces or
). If they hit enter key twice, (i.e. leave a blank line in between lines of text), that translates to a new paragraph.

Those are two different things. As text is primarily a rich text editor (which only uses markdown in the background) this only partly applies. As the scope of text is rich editing we will always focus on the visual representation where as mentioned above we follow the common pattern of using a paragraph break on simple enter.

I agree. On mobile there is no way to have a line break. Many markdown guides explicitly mention that a double space or a backslash ( \ ) at the end of a line indicates a line break. We could have support for both and convert it to a <br> while exporting so that there are no compatibility issues. And of course include this in the formatting help also.

A single line break (as entered with shift enter), will in the backend be converted to a markdown newline. Using a \ as trigger for that newline on mobile will not work as then there would be no way keep it if you actually want to enter a backslash.

I'd say we there is a reasonable idea how to trigger that without conflicting other behaviour or adding an extra button, we could add this. Otherwise I'd consider this a not too common use case.

@juliushaertl
Copy link
Member

Note we could also trigger it by two spaces, but most mobile keyboards will change this to . anyways unless you wait for quite a bit.

@sailr7
Copy link
Author

sailr7 commented Aug 2, 2022

Alternative on mobile...what about an option in the dropdown list called Line Break? Icon could be something like below

Line Break

@sailr7
Copy link
Author

sailr7 commented Aug 2, 2022

I did a little research online about how other editors are doing this for mobile. A keyboard solution that was mentioned: Hit Enter (new paragraph) and then hit Backspace to make it a single line break.

Alternatively (one I just thought of), starting a new line with a space could move it back to a single line break. It's similar in concept to ending the previous line with two spaces, but won't have the auto . issue.

@jancborchardt
Copy link
Member

Good points, so as usual let’s compare with other solutions:

  • Google Docs, MS Word, LibreOffice: Enter and Ctrl-Enter at least visibly look the same, but could be different in the document
  • Notion: Behaves like Text currently, Enter for paragraph break and Ctrl-Enter for line break

So we are visually closer to Notion, but maybe we should change it to behave like in the established solutions like Google Docs etc. What do you think @juliushaertl @nimishavijay? (Nimisha you mentioned "pretty much any other editing tool, which ones did you look at?)

I think we should not have it behave differently on mobile though.

@marcelklehr
Copy link
Member

@jancborchardt The short cut we discussed above would be shift+Enter. Ctrl+Enter would be a new one, but also not possible on mobile.

In this issue are actually two questions:

  1. Do we want to make hard line breaks using shift+enter easier to discover on the Desktop? If yes, how?
  2. Do we want to make hard line breaks possible on mobile? If yes, how do we do this, while keeping the experience on par with desktop?

A keyboard solution that was mentioned: Hit Enter (new paragraph) and then hit Backspace to make it a single line break.

I think the backspace might indeed be a nice solution, but only if it works on both Desktop and mobile to avoid confusion. Then it would solve both issues IMHO. What do you think @jancborchardt @nimishavijay ?

@nimishavijay
Copy link
Member

Agreed! We should preserve the behaviour of shift+enter for a line break as well as enter for a paragraph break. Additionally, the solution of enter + backspace for a line break can be added to both desktop and mobile. That way people who have been using shift + enter can continue to use that, and there is still a way to add line breaks on mobile on parity with desktop.

Do we want to make hard line breaks using shift+enter easier to discover on the Desktop? If yes, how?

We could add it to the formatting help modal, since there are a bunch of keyboard shortcuts there anyway :)

cc @jancborchardt on this when he's back

@syzdek
Copy link

syzdek commented Jul 31, 2023

I realize that this thread is old, but the shift+enter method does not work when creating lists. I agree with @jancborchardt that it would be better the start a paragraph by pressing enter twice and stop adding needless extra vertical white space unless the user explicitly adds it by pressing enter multiple times.

@max-nextcloud
Copy link
Collaborator

the shift+enter method does not work when creating lists

Works for me:

Bildschirmaufzeichnung.vom.01.08.2023.08.57.43.webm

Is that also what happens to you? If not could you specify which version you are using and record what you are seeing?
If it's the same - what do you expect to happen?

@syzdek
Copy link

syzdek commented Aug 1, 2023

While it does create a new line without double line spacing, it does not allow you to create a new bullet point without double line spacing. As an example, Github renders each bullet point of the README for this project without double line spacing, however NextCloud adds the equivalent of double line spacing between each list item when rendering lists. I'd expect to be able to be able to create list items without the excessive spacing using the same mechanism as paragraphs.

@max-nextcloud
Copy link
Collaborator

@syzdek Ah... I see. The line hight was too big due to a bug. We just landed a fix for this recently. It will change the space between list items from 1em to .5em. - which has the same effect as the line hight of 1.5em that github uses here:

  • let
  • me
  • see

Fix will be released with the upcoming maintenance releases.
#4547 is the issue in question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature: formatting Features related to text formatting and node types format: markdown
Projects
None yet