[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tabs
From: |
Thomas Dickey |
Subject: |
Re: Tabs |
Date: |
Mon, 7 Nov 2016 19:15:51 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Nov 07, 2016 at 06:12:32PM -0500, Chris Delozier wrote:
> Hello,
>
> Just wanted to confirm that I am now on the current release of 6.0 and
> the issue persists. Apologies for the lackluster subject line.
short: no, there's nothing overlooked
long: It won't work as you expect because
+ the behavior that you're seeing is due to the terminal driver,
not the terminal.
+ the terminal driver does its work without paying any attention
to what the terminal's tab-stops are.
+ POSIX doesn't define tab-intervals - see
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap11.html#tag_11
which says
TABDLY
Select horizontal-tab delays:
TAB0
Horizontal-tab delay type 0.
TAB1
Horizontal-tab delay type 1.
TAB2
Horizontal-tab delay type 2.
TAB3
Expand tabs to spaces.
but odds are that every system you'll use assumes eight. Some write in
their manual pages that POSIX says it's eight:
http://man7.org/linux/man-pages/man3/termios.3.html
TABDLY Horizontal tab delay mask. Values are TAB0, TAB1, TAB2, TAB3
(or XTABS). A value of TAB3, that is, XTABS, expands tabs to
spaces (with tab stops every eight columns). [requires
_BSD_SOURCE or _SVID_SOURCE or _XOPEN_SOURCE]
+ since it doesn't pay any attention (and there's no POSIX termios
interface to tell it anything different), the terminal driver uses
8 for the tab interval.
+ in principle, the terminal driver (for each system...) could be modified
to do this, making it less general.
+ I had this in mind when writing
http://superuser.com/questions/1037615/detecting-terminal-tabstop-settings/1037780#1037780
>
> Thank you.
>
> On Mon, Nov 7, 2016 at 1:56 PM, Chris Delozier <address@hidden> wrote:
> > Hello,
> >
> > I've set tabs to 4 and am noticing that, when inputting data, if I tab
> > twice it will align correctly both times, but backspacing will go back
> > 8 characters. Is there a setting I'm missing that also handles
> > backspacing of tab character?
> >
> > Steps to reproduce: open terminal, `stty tab0`, `tabs -4`, `cat >>
> > tst0`. Enter a visual character, followed by two tabs (should be 8
> > spaces beyond that character), then press backspace once. It will take
> > you to the original character on the input line.
> >
> > version 5.9 (patch 20140913) Ncurses installed.
> >
> > Thanks for the assist.
>
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/bug-ncurses
--
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net
signature.asc
Description: Digital signature
- Tabs, Chris Delozier, 2016/11/07
- Re: Tabs, Chris Delozier, 2016/11/07
- Re: Tabs,
Thomas Dickey <=