-
Notifications
You must be signed in to change notification settings - Fork 65
[FIX] composer: set cursor on prettified formula #7166
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
Conversation
05565e2
to
0658513
Compare
const content = text || this.getComposerContent(this.getters.getActivePosition()); | ||
const validSelection = this.isSelectionValid(content.length, selection.start, selection.end); | ||
if (!validSelection) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code looks like a safeguard against a programming error somewhere else, calling this with wrong values.
Keeping this check would mean making it more complex for ... not a lot...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not the mostly pretty fix I've written...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧇 👋
if (char !== "\n" && char !== "\t") { | ||
originalIndex++; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't check the prettifier feature too closely, but are we sure that there are no tabs/newlines in the formula before the prettification ? Otherwise your fix wo'nt work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we sure that there are no tabs/newlines in the formula before the prettification
yes, because we explicitly display it in a single line
? Infinity // one liner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it's quite fragile and confusing to understand, I admit. because the cursor is linked to the one-liner that is displayed in the composer, but the content comes from somewhere else (the cell)
src/components/composer/standalone_composer/standalone_composer_store.ts
Outdated
Show resolved
Hide resolved
0658513
to
0cf12d7
Compare
Steps to reproduce: - type a long formula, e.g. =SUM(11111111, 22222222, 33333333, 44444444, 55555555, 66666666, 77777777, 88888888) - in the top bar composer, click somewhere that won't be on the first line when prettified (in the fours) => the cursor is badly positioned on the prettified formula Task: 5095470
0cf12d7
to
d534336
Compare
@rrahir fixed :) |
thanks :) robodoo r+ |
Steps to reproduce:
=> the cursor is badly positioned on the prettified formula
Task: 5095470
Description:
description of this task, what is implemented and why it is implemented that way.
Task: TASK_ID
review checklist