Skip to content

Vocalize paragraph indent and hanging indent shortcuts in MS Word#10415

Merged
seanbudd merged 3 commits into
nvaccess:masterfrom
CyrilleB79:announceParagraphIndent
Jul 12, 2021
Merged

Vocalize paragraph indent and hanging indent shortcuts in MS Word#10415
seanbudd merged 3 commits into
nvaccess:masterfrom
CyrilleB79:announceParagraphIndent

Conversation

@CyrilleB79

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #6269

Summary of the issue:

In MS Word, the result of indent and hanging indent shortcuts is not announced by NVDA. It may be useful for the user to know the distance from the left edge of the page, as done when pressing Tab or Shift+Tab.

Description of how this pull request fixes the issue:

When the following shortcuts are executed, the distance from the left edge of the page of the paragraph is reported:

  • Ctrl+M: indent
  • Ctrl+Shift+M: outdent
  • Ctrl+T: hanging indent
  • Ctrl+Shift+T: hanging outdent

The reported distance is the one from left edge of page to the beginning of all line of the paragraph except the first that may differ.

The listed shortcuts are the ones of English version of MS Word. They may differ for other languages. In this case, translators will need to update gesture.ini file accordingly.

Testing performed:

Executed all these shortcuts and checked that the distance was correctly announced.

Known issues with pull request:

None

Change log entry:

Section: Changes

In Microsoft Word, NVDA now announces the result of indent and hanging indent shortcuts when executed. (#6269)

@CyrilleB79 CyrilleB79 changed the title Vocalize paragraph indent and hanging indent shortcuts Vocalize paragraph indent and hanging indent shortcuts in MS Word Oct 23, 2019
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

Additional comment:
In the delivered message, the indent type (indent or hanging indent) is not announced since I have considered that this information would be too verbose.

@lukaszgo1

Copy link
Copy Markdown
Contributor

Is there anything blocking this PR from being looked at? cc @seanbudd since you've recently started reviewing some older PR's.

@seanbudd seanbudd self-requested a review July 7, 2021 01:10

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @CyrilleB79, looks good to me and I have confirmed it works as intended with MS Word

@CyrilleB79 CyrilleB79 requested a review from a team as a code owner July 12, 2021 02:49

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CyrilleB79 - I noticed that in #6269 it was mentioned that other languages use different keyboard commands. I wanted to just add that this will cause this gesture to announce the current indentation once the timeout is reached, regardless if it is an indentation related action. Perhaps it would be better to announce only if the indentation is changed

Comment on lines +1318 to +1323
margin = self.WinwordDocumentObject.PageSetup.LeftMargin
val = self._WaitForValueChangeForAction(
lambda: gesture.send(),
lambda: self.WinwordSelectionObject.paragraphFormat.LeftIndent
)
msg = self.getLocalizedMeasurementTextForPointSize(margin + val)

@seanbudd seanbudd Jul 12, 2021

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
margin = self.WinwordDocumentObject.PageSetup.LeftMargin
val = self._WaitForValueChangeForAction(
lambda: gesture.send(),
lambda: self.WinwordSelectionObject.paragraphFormat.LeftIndent
)
msg = self.getLocalizedMeasurementTextForPointSize(margin + val)
margin = self.WinwordDocumentObject.PageSetup.LeftMargin
oldVal = self.WinwordSelectionObject.paragraphFormat.LeftIndent
val = self._WaitForValueChangeForAction(
lambda: gesture.send(),
lambda: self.WinwordSelectionObject.paragraphFormat.LeftIndent
)
if oldVal == val:
# indentation hasn't changed, it's likely the gesture used is not mapped to an
# indentation change in Word, which is the case for some languages (see #6269).
return
msg = self.getLocalizedMeasurementTextForPointSize(margin + val)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Localizing the keystrokes is the work of translators (edition of the gestures.ini file).
I am a bit reluctant to add this piece of code that is useful only in case a translator has not done the required translation.

Note also that this strategy is not the one used for other formatting commands. For example, not all languages use control+B to toggle bold formatting, e.g. French and Italien use ctrl+G (for "Gras" / "Grassetto").

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, my mistake. LGTM then

@seanbudd seanbudd merged commit 9409b9d into nvaccess:master Jul 12, 2021
@nvaccessAuto nvaccessAuto added this to the 2021.2 milestone Jul 12, 2021
@CyrilleB79 CyrilleB79 deleted the announceParagraphIndent branch February 15, 2022 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Announce paragraph indent / hanging indent when creating with shortcut keys in Word

5 participants