#374 Hide text regions in the buffer from the text area

v5.2
pending
nobody
5
2014-07-27
2010-09-24
Shlomy Reinstein
No

Allow a configurable engine for hiding selected regions of text from the text area.
For example: In C/C++, hide parts of the buffer that are excluded from the current build configuration (e.g. using #ifdef ...).

This can be extended to different syntax highlight styles for different regions of text. For example, MS Developer Studio shows the text in the above example in gray, while the rest of the text is syntax highlighted. Another example: Mylyn (an eclipse plugin) colors text according to the frequency of visiting it. A function that was never visited (by browsing through the source code) is hidden; frequently visited text is colored "darker" than rarely visited text.

Discussion

  • In addition, when some buffer text is hidden from the text area, the folding should apply only to the visible lines - as if the hidden text is not part of the buffer. That is, the folding should be applied on the result of the filtering.

     
  • Robert Schwenn
    Robert Schwenn
    2010-09-25

    Sounds like an ambitious plan. Two notes:

    1. One way to filter lines could be "simply" to use a hyper search result.
    2. It would be perfect if operations like search&replace or column cursor editing could ignore the hidden lines.

     
  • An ambitious plan, yes. But I think it's a very useful feature.
    1. How would you use hypersearch results for filtering? The filtering may, for example, include all the text between a "#if" and its "#end".
    2. I don't think so, but I think that the filtering should be easily turned off (or modified to select another criteria for filtering) using the UI.

    One thing missing here is how to apply the filter during editing. It seems like me like this should use a mechanism similar to the syntax highlighting.

     
  • Robert Schwenn
    Robert Schwenn
    2010-09-26

    Some time ago a user asked for a feature which is found in "The Hessling Editor" ( http://hessling-editor.sourceforge.net/ ). It lets You hide all lines that don't match a criteria (i.e. a search text) and then lets You edit only the displayed lines.

    So I thought, that using the line numbers of hyper search results could be one way of filtering for Your "configurable engine". But if this hasn't been Your intent, I won't ask for this feature.

     
  • Alan Ezust
    Alan Ezust
    2013-12-09

    • labels: core --> ConfigurableFoldHandler
    • status: open --> pending
    • Group: --> v5.2
     
  • Alan Ezust
    Alan Ezust
    2013-12-09

    Can you get something like this from ConfigurableFoldHandler?
    Define the start/end of the folds as regexes, and then you can expand/collapse the folds to show/hide those regions.

    If not, this sounds like a feature request for ConfigurableFoldHandler.

     
  • Well, yes and no. Possibly you can define the regions in ConfigurableFoldHandler, but the feature request is deeper. I would like to have the option to either hide the regions completely (not fold them, hide them - it's not the same as considering the preceding line to be the start of a fold containing the region, as I want the folding to be used only on the visible lines and not on those hidden - and don't want to see dummy folds).
    ConfigurableFoldHandler is for folding only. The core needs to change in order to support hidden (not folded!) regions.