Ticket #12 (assigned defect)

Opened 5 years ago

Last modified 5 years ago

indentation with unicode replacements

Reported by: sohumb@… Owned by: Baughn
Priority: major Component: haskell-indentation
Version: TIP Keywords:
Cc:

Description

foo <- do bar <- baz
          return bar

looks as follows in emacs, with unicode replacements,

foo ← do bar ← baz                                                                                                                                                                                 
         return bar

which looks like, to other editors and ghc,

foo <- do bar <- baz
         return bar

which is unacceptable layout for ghc. This occurs with all unicode replacements.

Change History

Changed 5 years ago by Baughn

I fixed the actual problem in about five minutes, along with a potential problem if anyone ever uses hard-tabs. The patch is in the repository now.

I'm not closing this, however. Right now it looks quite bad, and I want to fix that.

Changed 5 years ago by Baughn

  • status changed from new to assigned

Changed 5 years ago by Baughn

So. Thinking out loud..

When we compose "<-" to "←" (or similar), we collapse two columns into one.

To produce good visuals, the corresponding columns on lines beneath it should be collapsed into one. These columns will in all cases consist of whitespace; (compose-region a (+ a 2) ?\s) should work fine. We need to stop doing this when we hit an indentation level lower than that of the columns we're collapsing. Simple. Nesting will by and large take care of itself.

So far so good, but this has to happen progressively - while we edit.

One possible solution would be to insert a text property along with the originally composed character, and have all editing functions search for such tags when appropriate. This, needless to say, would imply a lot of extra - fragile - code.

..I'm not sure what alternatives there are. If we could center "←" in a two character wide box, that'd probably look just as nice and would also be a lot more robust, but I can't figure out how to do that.

Note: See TracTickets for help on using tickets.