[Haskell-cafe] Layout rule (was Re: PrefixMap: code reviewrequest)

Benjamin Franksen benjamin.franksen at bessy.de
Wed Mar 1 07:55:55 EST 2006

On Wednesday 01 March 2006 13:35, Brian Hulley wrote:
> Benjamin Franksen wrote:
> > [snip]
> > I am used to hitting TAB key and get the correct number of spaces,
> > according to how I configured my editor (NEdit) for the current
> > language mode.
> The only thing then is what happens when you type backspace or left
> arrow to get back out to a previous indentation? If the TAB character
> inserts spaces, there's no problem going from left to right but it
> would seem more complicated to go back out again ie without having to
> type backspace 4 times and try to hope when outdenting more that I
> haven't typed backspace 23 times instead of 24 times by mistake thus
> not getting to the column I expected.

With NEdit, hitting backspace /right after/ hitting the tab key deletes 
all the whitespace that were inserted, be it a tab character or 
multiple spaces. (This works also if the line was auto-indented to the 
same indentation depth as the previous one. That is, hit enter and then 
backspace, and you are at previous indentation level minus one.) If, 
however, you press any other key (e.g. any arrow keys), subsequent 
backspace will only delete a single space. Other behaviors can be 
easily implemented by writing a macro and binding it to the backspace 
key. The same is most probably true for emacs.

The upshot is: Any decent modern text editor allows to map keys like tab 
and backspace to almost any action desired, depending on context, 
language mode, whatever.


More information about the Haskell-Cafe mailing list