Feature Request: Correct Previous Spelling?

Everything related to our flagship word processor.
Post Reply
anupam
Posts: 4
Joined: 2021-10-03 15:34:28

Feature Request: Correct Previous Spelling?

Post by anupam »

Nisus Writer provides a shortcut to "Correct Next Spelling (⌥⌘;)", which is very useful when initiating a global (or selection-scoped) spell-check.

However, while typing text (and with spell-check turned on), I often find myself correcting the mis-spelt word that I typed a few seconds ago; usually in the same sentence or paragraph I am in. This currently requires that I go back to the offending word (using ⌥-← or other navigation shortcuts), and then issue the "Correct Next Spelling" command.

Is it possible to add a new command (and shortcut) to do this, so that the toil of having to move back to the point of correction is eliminated?
Þorvarður
Posts: 410
Joined: 2012-12-19 05:02:52

Re: Feature Request: Correct Previous Spelling?

Post by Þorvarður »

Hello anupam,
I see you have just joined the forum. Welcome to the friendly Nisus community!
Is it possible to add a new command (and shortcut) to do this, so that the toil of having to move back to the point of correction is eliminated?
Nisus has already a feature which should prevent you from misspelling the same word over and over again. It's in the Preferences and is called QuickFix. Enter all your misspelled words there with the corresponding corrections. Once you have done that the mistakes will be automatically corrected when you mistype words. — The word list is language sensitive, which means, your QuickFix words are only corrected if they match the language of your text. This is a boon to those who write in many languages.

QuickFix.png
QuickFix.png (98.46 KiB) Viewed 6703 times

If you need to type a difficult or a long word and you always forget how to spell it correctly, then enter that word (or phrase) into a glossary file. Create a new glossary file and name it "Difficult words", or something like that. Then think of a good abbreviation for the term you are entering, an abbreviation that you will not easily forget. When you type the abbreviation it's substituted by the difficult word.
I always forget how to write "acquiesce in", therefore I created a glossary entry. Every time I now type "accepta" it will be replaced by "acquiesce in".

Since you seem to be new to Nisus I recommend you study the glossary feature carefully. Glossaries work with "everything you throw at them": formatted text, tables, lists, pictures, hyperlinks, screenshots …
anupam
Posts: 4
Joined: 2021-10-03 15:34:28

Re: Feature Request: Correct Previous Spelling?

Post by anupam »

Hello Þorvarður,

Thank you for your thoughtful, detailed reply and the suggestions. I am a long time Nisus user, though a newbie in the forum :D

I do use most of these features (especially QuickFix, which is a life-saver), but inevitably, there are mis-spelt words which always get past. I have currently cobbled together a Keyboard Maestro "hack" to do what I want (most of the time; it is not 100% reliable), where, if I see an incorrect spelling while typing (usually a few words back in the current line or sentence), then I invoke this macro with:

Code: Select all

Crtl-;
to:

(a) Go back to beginning of the line using

Code: Select all

Ctrl-A
and then,

(b) Invoke the "Correct Next Spelling" menu item

This works most of the time, except when the line has multiple typos, in which case I just re-invoke the macro using the same shortcut. I am sure this could be better achieved with a Nisus Writer macro, but I don't have much familiarity with the macro language to implement it that way.

As an aside, I have also remapped

Code: Select all

Ctrl-w
to invoke

Code: Select all

⌥-Backspace
to delete the last word, which helps a lot when it is just easier to delete the last typo and re-type the correct spelling.

The reason I am still requesting for this feature is that (1) Nisus' own implementation will be 1000x better than my hack, and (2) I don't need to depend on an external utility to make this happen.
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Feature Request: Correct Previous Spelling?

Post by martin »

Here's a macro that should do what you want:

https://nisus.com/pro/macros/browse.php ... ctPrevious

The macro is conceptually simple, but the macro code is unfortunately quite involved because there's no native "backwards" mode to the spellchecker. Instead the macro has to use some tricks (e.g. a binary search algorithm) to get the job done without too much text scanning.

I hope the macro helps!
anupam
Posts: 4
Joined: 2021-10-03 15:34:28

Re: Feature Request: Correct Previous Spelling?

Post by anupam »

Thank you Martin,

This macro works like a charm! I have remapped the keyboard shortcut to invoke the macro.

BTW, this is why I love Nisus—not just a fantastic product, but a great community and support as well!
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Feature Request: Correct Previous Spelling?

Post by martin »

anupam wrote: 2021-10-05 05:28:08 Thank you Martin,

This macro works like a charm! I have remapped the keyboard shortcut to invoke the macro.

BTW, this is why I love Nisus—not just a fantastic product, but a great community and support as well!
That's great to hear– happy to help! And thanks for joining our community :)
Þorvarður
Posts: 410
Joined: 2012-12-19 05:02:52

Re: Feature Request: Correct Previous Spelling?

Post by Þorvarður »

I hope the macro helps!
Thank you for this nice macro, Martin. Works like a charm, like anupam already said. :–)

The macro leaves the small dropdown menu open and we have to use the down arrow key to select the correct word. Since the correct word often happens to be the first word in the dropdown menu list, I wonder if it's possible to let the macro select the first word automatically. We would then just need to confirm the choice by hitting the Return key.
And it goes without saying, if the first word in the dropdown menu isn't the one we need, we just press the down arrow key until the correct word is selected.

Or in other words, can I create a macro command that simulates me pressing the down arrow key?
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Feature Request: Correct Previous Spelling?

Post by martin »

Þorvarður wrote: 2021-10-05 10:36:27 Or in other words, can I create a macro command that simulates me pressing the down arrow key?
This is not possible, at least not in this macro. The problem is this macro code:

Code: Select all

Menu 'Correct Next Spelling'
That triggers the display of a modal contextual menu. The macro does not advance to run additional macro code until the menu is dismissed, i.e. you choose a spelling correction or cancel. Thus there's no way to fix this from the macro side of things, at least not using Nisus Writer's built in macros.

You might be able to combine this Nisus spelling macro with another script/tool, if the macOS spelling corrections menu is responsive to input and manipulation. I'm not sure on that point.
Þorvarður
Posts: 410
Joined: 2012-12-19 05:02:52

Re: Feature Request: Correct Previous Spelling?

Post by Þorvarður »

Thanks for the clarification.

Þ.
Post Reply