Skip to content

Tab characters should be considered blank #13431

@SamKacer

Description

@SamKacer

Steps to reproduce:

Read the two lines between "start" and "end":

start
    
		
end

(Note: The first line after start has 4 spaces and the next line has 2 tabs)

Actual behavior:

They are read as:

start
blank
*nothing is read*
end

Further, if indentation reporting is on, then they are read as:

start
4 space blank
2 tab blank
end

Expected behavior:

I would expect the line with the 2 tabs should be read as "blank" when indentation reporting is turned off, since it is a blank line when indentation reporting is turned on. Nothing being read at all causes confusion when reading code, since it can seem as if NVDA has stopped responding.

System configuration

NVDA installed/portable/running from source: installed

NVDA version: 2021.3.3

Cause of problem

In speech.py, whether text is considered blank is determine by this code:

#: If a chunk of text contains only these characters, it will be considered blank.
BLANK_CHUNK_CHARS = frozenset((" ", "\n", "\r", "\0", u"\xa0"))
def isBlank(text):
	"""Determine whether text should be reported as blank.
	@param text: The text in question.
	@type text: str
	@return: C{True} if the text is blank, C{False} if not.
	@rtype: bool
	"""
	return not text or set(text) <= BLANK_CHUNK_CHARS

The tab character is missing from BLANK_CHUNK_CHARS , which is why it isn't considered blank. The solution would be to also include it in the set.

Not sure if there is something I am missing and this is actually the intended behavior, but the inconsistency between the line being blank when indentation reporting is on/off makes me think it is a bug.

If it is agreed this is a bug, I would be happy to provide the PR as my first contribution to the NVDA project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions