-
Notifications
You must be signed in to change notification settings - Fork 281
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
Paper tape inserts newline after each entry #955
Comments
I'm thinking of how to implement the change, assuming it is approved.. There is a widget, a QTextEdit, called 'suggestions'. And I see that here, a newline is being added manually: plover/plover/gui_qt/suggestions_widget.py shows this: So there is always a trailing newline. Therefore, probably move it up a bit to here: This way, the newline only gets created when it's about to be 'used'. That's one, the suggestions pane one, but then there is the paper tape one.. The paper tape one is readOnly. It's a QPlainTextEdit called 'tape'. In this case, the method appendPlainText() adds actually new paragraph. Yet, you need to append text to QPlainTextEdit without adding a newline to the text. Currently there is this: plover/plover/gui_qt/paper_tape.py I think the 'fix' is this kind of approach: ..I could have attempted a pull request, but I .. could have, I suppose .. I'm kind of at the getting oriented stage. |
Is this bug still present in the current version of Plover? I can't seem to reproduce it now, but I can get more than two thirds of an empty line below the last stroke depending on the size of the window. |
Well, right now it seems it is still there. So no, it doesn't seem to have been fixed. |
This is likely Qt's bug rather than Plover's, as depends on the paper tape size, the size of the last "empty line" varies from (approximately) 2/3 to 5/3 of a line of text. If Qt doesn't have the bug, and there's a trailing new line, the size of it should be from 1 to 2 of a line of text. However, this can be fixed, although it might break something else. Method 1: def _show_stroke(self, stroke):
text = self._formatter(stroke)
self.tape.appendPlainText(text)
+ self.tape.moveCursor(QTextCursor.End)
+ self.tape.ensureCursorVisible()
+
Problem: if the user want to view the upper part of the paper tape and stroke something, the tape is scrolled to the bottom; and if the user selects something, it will be cleared. Method 2: def _show_stroke(self, stroke):
+ vertical_scroll_bar = self.tape.verticalScrollBar()
+ old_value = vertical_scroll_bar.value()
+ self.tape.moveCursor(QTextCursor.End)
+ self.tape.ensureCursorVisible()
+ at_end = old_value == vertical_scroll_bar.value()
+ if not at_end:
+ vertical_scroll_bar.setValue(old_value)
+
text = self._formatter(stroke)
self.tape.appendPlainText(text)
+ if at_end:
+ self.tape.moveCursor(QTextCursor.End)
+ self.tape.ensureCursorVisible()
+ The first issue mentioned above is fixed, but not the second one. By the way, it looks like that the horizontal scroll bar in paper mode is not wanted (the window is forced to be larger than the text in the first line), but it is still visible in some cases because of the margin of the |
Probably fixed in #1308, with the switch to a list view. |
Summary
There is always an unused newline at the bottom of the paper tape dialog. This unused space is particularly troublesome when using a big font and a small output window. This also happens in the suggestions pane.
Reproducing
Plover Version
Plover 4.0.0.dev6+5.ga564116
System
Ubuntu 16.10 with i3-gaps, running
plover-4.0.0.dev6.5.ga564116-x86_64.AppImage
The text was updated successfully, but these errors were encountered: