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

Support manual (indenting) line breaks #573

Open
uliska opened this issue Jan 15, 2015 · 8 comments
Open

Support manual (indenting) line breaks #573

uliska opened this issue Jan 15, 2015 · 8 comments
Labels

Comments

@uliska
Copy link
Collaborator

uliska commented Jan 15, 2015

I have a convention to lay out my music so each measure starts on a new line (with the possible exception of things like c1 | c | c | c). If a measure is too long to comfortably fit on a line I continue the measure on the second line but add one indent. A similar thing is true when I insert long tweaks, which will result in a layout like

c d %{ a very long measure }% e f
  g a b c

c d e
      \shape #'(()()()()) Slur
      f (

I'm particularly convinced of the second one because that makes very expressive commits. Of course both constructs get destroyes when I apply Frescobaldi's format function. Therefore I'd like to ask if it is a good idea to support that kind of formatting convention or if that's too much a personal use case?

My idea would be to recognize a user-settable "line break" comment, maybe defaulting to %/. On entering code this would result in one additional indentation step to be added to the next line. On explicit use of format this would

  • add one indentation if a line is not indented relative to the previous line
  • keep the indentation relative to the previous line if it is indented. That means if the line ending with that comment needs to be shifted by the formatting the next line would be shifted by the same amount.

An optional addition would be to recognize a second line break comment (e.g. %//). This would make the following line indent to exactly the position of the comment, just like the second example above. With my comments the examples could be entered like

c d %{ a very long measure }% e f %/
  g a b c

c d e %//
      \shape #'(()()()()) Slur
      f (
@wbsoft wbsoft added the wish label Jan 17, 2015
@MichaelHendry
Copy link

I agree that the loss of user-intended indentation is a problem with Frescobaldi's format feature, but I don't think this is a complete solution.
As I understand it, the idea is that the %/ combination signifies that the following line is to be given one extra ration of indentation, so code entered thus...

a b c d
b c d e %/
c d e f
d e f g

...becomes...
a b c d
b c d e %/
TAB c d e f
d e f g
...with the fourth line dropping back to Frescobaldi's default indentation (PS I've had to insert TAB because the indentation - visible in Edit mode - disappears when the comment is posted)

This means that every line that is to be indented will have to be preceded by %/, and that there is no way of forcing double indentation.

How would you propose switching off the %// indentation if it isn't automatically switched off in following bars?

@sincere-music
Copy link

I agree that this would be a very useful feature.
Regarding your second example, Urs: if modified thus,
c d e %//
\shape #'(()()()()) Slur %/
f (
‘format’ would be able to correctly handle the third line of the bar.

@fedelibre
Copy link
Member

I like the idea of protecting some intended indentation from frescobaldi formatting function, because I recently started using indentation with the same purpose.

I wonder if this could be achieved in some smart way through python-ly and bar checking (see issue #437), in order to avoid the comments %/ and %//. I mean, if formatting is able to know if a bar is finished or not, it may act differently if a bar is splitted in two or more lines.

@uliska
Copy link
Collaborator Author

uliska commented Apr 27, 2015

That would of course be terrific.
But it could not be reliable as you never know how correct or complete the input before any given line is.
But of course it could be handled by considering the music from the last barcheck only (which would be a means of encouraging the use of barchecks ...)

@PeterBjuhr
Copy link
Collaborator

We now have several reports of the workflow with inside bar indents. But before agreeing on trying to adapt to this particular code style I'd like to broaden the discussion; other ways of user indentation is of course possible so I think the question is - which indents should be allowed by the reformat function and which should be handled? (There's of course also a question of how to distinguishing intended indents from mere coincidental mess...)

I've a loose idea of two format options - a hard format which is basically like today (and can be useful on particularly messy code) and a softer one which is more careful with user indents.

@kierenmacmillan
Copy link

kierenmacmillan commented May 4, 2017

Has there been any development on this in the last two years? I'm finding my indenting/commenting/etc. structure/format is hard to manage in Frescobaldi, since the indent and format commands mess things up.

@uliska
Copy link
Collaborator Author

uliska commented May 4, 2017

I don't think so. At least not that I know of. I must admit that quite the contrary I seem to have adjusted my coding style using much more space between measures. That way I don't really need the indentation anymore. Something like this would seem typical now (of course this music is unusually simple):

\relative {
  c8 d e f
  \oneVoice
  g a
  \voiceTwo
  b c

  | % 14
  c4 d
  \criticalRemark \with {
    foo = bar
  }
  NoteHead
  e
  \once \override Something
  f

  | % 15
}

But still I'd say it would be really good if Frescobaldi wouldn't necessarily revert manual indentation.

@kierenmacmillan
Copy link

kierenmacmillan commented May 4, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants