Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserting Dashes, Ellipsis, Line Break, and Spaces in Insert Menu Causes Errors #409

Closed
MoonlightAshe opened this issue Aug 16, 2020 · 1 comment · Fixed by #410
Closed
Assignees
Labels
bug Issue: Something isn't working

Comments

@MoonlightAshe
Copy link

Describe the Bug
Trying to insert long dash, short dash, ellipsis, hard line break, non-breaking space, thin space, and thin non-breaking space when via the Insert menu does not work and causes an error popup. After the error popup, the editor cannot be used (cannot type in it and switching to another file clears the editor area) until you restart the program.

To Reproduce
Insert the characters mentioned above via the Insert menu.

Expected Behaviour
Insert the character and not break the editor.

Error Message

An unhandled error has been encountered
Please report this error by submitting an issue report on GitHub, providing a description and this error message. URL: <https://github.com/vkbo/novelWriter/issues>.
Environment
Version: 0.12.0, OS: win32 (10.0.18363), Python: 3.8.5 (0x30805f0), Qt: 5.15.0, PyQt: 5.15.0
Error Type
TypeError: arguments did not match any overloaded call: insertText(self, str): argument 1 has unexpected type 'tuple' insertText(self, str, QTextCharFormat): argument 1 has unexpected type 'tuple'
Traceback
  File "D:\Users\User\Documents\novelWriter\nw\gui\mainmenu.py", line 516, in 
    self.aInsEllipsis.triggered.connect(lambda: self._docInsert(nwDocInsert.ELLIPSIS))

  File "D:\Users\User\Documents\novelWriter\nw\gui\doceditor.py", line 625, in insertText
    theCursor.insertText(theText)

Additional Context
Add any other context about the problem here.

@MoonlightAshe MoonlightAshe added the bug Issue: Something isn't working label Aug 16, 2020
@vkbo vkbo self-assigned this Aug 16, 2020
@vkbo
Copy link
Owner

vkbo commented Aug 16, 2020

Thanks. Fixing it now. This one was caused by one of the weirdest pitfalls in the Python language: if you leave a comma after a variable, there's no error. Instead the variable becomes a tuple. It was caused by the rewrite of the insert function from using a dictionary, where each statement ends in a comma, to a series of if-elsifs.

@vkbo vkbo linked a pull request Aug 16, 2020 that will close this issue
@vkbo vkbo closed this as completed in #410 Aug 16, 2020
vkbo added a commit that referenced this issue Aug 16, 2020
Issue #409: Accidental tuple in insert menu
@vkbo vkbo mentioned this issue Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue: Something isn't working
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants