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

Show and Hide Text Feature #399

Closed
johnblommers opened this issue Aug 14, 2020 · 6 comments
Closed

Show and Hide Text Feature #399

johnblommers opened this issue Aug 14, 2020 · 6 comments
Assignees
Labels
discussion Meta: Feature discussions editor Component: Editor enhancement Request: New feature or improvement potential feature Request: May be considered later

Comments

@johnblommers
Copy link

Is your feature request related to a problem? Please describe.

When making an edit pass over a manuscript I sometimes come across a chunk of text that I want to remove. But it's text that I might want to put back or use again later on. How can this text be maintained available and yet not have it show up in the manuscript?

novelWriter already includes a comment feature so the writer can sprinkle the text with ideas and notes. But the text I want to hide is not a comment. It might be a description.

Describe the solution you'd like

I propose novelWriter include special markers, perhaps backtics: \hide this text. A user controlled switch will:

  • reveal all hidden text but change its color so it's obvious
  • hide all hidden text (to display the manuscript as it will be exported)
  • search inside only the hidden text (so the writer can find it again)
  • don't include hidden text in the exported manuscript (default)
  • do include hidden text in the exported manuscript (not sure how this is helpful)

Describe alternatives you've considered

This sort of thing may be possible if novelWriter were to include Git integration. There is a feature request to add Git integration that might be pressed into service to accomplish the above. However the above seems so much more useful.

Additional context

None.

@johnblommers johnblommers added the enhancement Request: New feature or improvement label Aug 14, 2020
@vkbo vkbo changed the title [Show and Hide Text Feature] [FEATURE] Show and Hide Text Feature Aug 14, 2020
@vkbo vkbo changed the title [FEATURE] Show and Hide Text Feature Show and Hide Text Feature Aug 14, 2020
@vkbo
Copy link
Owner

vkbo commented Aug 14, 2020

It seems this is at least technically possible as QTextBlock has a setVisible method that, presumably, can be used to show/hide lines of text (should be easy enough to test). I would guess the feature is supported because this is a common feature of code editors, and Qt has multiple widgets clearly intended for such use.

The other feature points are easy enough to implement too, and are sensible options to have.

The remaining question is how to mark a line as one that can be hidden. Since the intention here seems to be to "comment out" text, this should be a sub class of comments, similar to how synopsis comments are tagged. This will also help to reduce complexity and slowing down of the text parsing by adding further top level branching (headers, keywords, comments and regular text are treated as separate code branches at the top level in both the highlighter and the tokenizer).

One possible solution is to have a paragraph like this tagged with:

%hidden: The text paragraph that is hidden.

For simplicity, a keyboard shortcut could be added to quickly toggle this feature on and off for a line.

@vkbo vkbo added discussion Meta: Feature discussions potential feature Request: May be considered later labels Aug 14, 2020
@vkbo
Copy link
Owner

vkbo commented Aug 15, 2020

I've been thinking about this a bit. What you essentially want is a way to strike a whole paragraph. Maybe a %strike: tag would work too as the marker for such a paragraph.

I want to keep the the syntax as consistent as possible to avoid the need to learn a lot of esoteric codes and keywords.

@johnblommers
Copy link
Author

Hiding an entire paragraph is one of the use cases I'm thinking about, indeed it is likely the most common use case. But I'm also thinking to hide entire sentences, and perhaps even a few words or phrases in the general case. I may want to \hide this text\ only. \Or this entire sentence needs to go. \.

@vkbo
Copy link
Owner

vkbo commented Aug 15, 2020

I will have to experiment with this. The backslash is not ideal as it's used for escaping characters, so unsure how to make this happen within text lines (paragraphs). Hiding whole lines is, as I said, trivial as each line, by default is a QTextBblock, which has a visibility flag.

@johnblommers
Copy link
Author

Maybe something like <hidden>Bla bla bla </hidden> or %hiddenBla bla bla %.

@vkbo
Copy link
Owner

vkbo commented Feb 25, 2024

I think I will close this issue now. I've implemented #1075, which allows a paragraph to be completely ignored in the document viewer and manuscript builds. It is not visually hidden in the editor though, but that's a trickier thing to achieve. It may also not be so desirable as it would otherwise be difficult to find the hidden text. I've tested hiding these paragraphs, but there is no visual indicator to show where they are.

The ignored paragraph feature is a toggle feature, and can be used on multiple paragraphs. It will be a part of the upcoming 2.3 release, and can be tested in the 2.3 pre-releases. The syntax is similar to comments, but uses a %~ prefix instead. They cannot be enabled in manuscripts. I agree with your point that this makes little sense.

@vkbo vkbo closed this as completed Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Meta: Feature discussions editor Component: Editor enhancement Request: New feature or improvement potential feature Request: May be considered later
Projects
None yet
Development

No branches or pull requests

2 participants