bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#46590: 27.1.91; abnormal whitespace-mode behavior


From: Eli Zaretskii
Subject: bug#46590: 27.1.91; abnormal whitespace-mode behavior
Date: Sat, 20 Feb 2021 11:27:25 +0200

> Date: Wed, 17 Feb 2021 15:06:14 +0100
> From: Frédéric Baldit <frederic.baldit@free.fr>
> 
> emacs -Q test.txt &
> 
> 2) M-x whitespace-mode RET
> 
> 3) type the following text («.» for spacebar key):
> 
> «....First line of text in emacs», then type RET
> 
> 4) DEL DEL to suppress backward two spaces on line 2, then type text
> «Second one»
> 
> 5) M-2 M-b
> 
> 6) TAB TAB TAB TAB: point should be at line 2, column 18, vertically
> aligned with fourth word of line 1 («text»), but it is at column 26:
> that's the bug.

It's a known misfeature of whitespace-mode.  There's a comment in
whitespace.el to that effect:

    ;; WARNING: the mapping below has a problem.
    ;; When a TAB occupies exactly one column, it will display the
    ;; character ?\xBB at that column followed by a TAB which goes to
    ;; the next TAB column.
    ;; If this is a problem for you, please, comment the line below.
    (tab-mark     ?\t    [?» ?\t] [?\\ ?\t])    ; tab - right guillemet

You could customize whitespace-display-mappings to remove tab-mark
from it, if you want to avoid this issue.

> Rq1: what is curious (to me) is that deactivating whitespace-mode
> removes abnormally inserted tab character (8 spaces) and everything is
> OK.

That's because disabling whitespace-mode deactivates the display-table
mappings, which include the above mapping.

> Rq2: I noted that with a different text, this behavior of
> whitespace-mode disappears. For example, if one uses the following first
> line of text:
> 
> «....This.is.a.first.line.of.text.with.a.few.words»,
> 
> then the result of typing TAB multiple times is as expected, with or
> without whitespace-mode activated!

Most probably because the "TAB occupies exactly one column" condition
doesn't happen there.

Thanks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]