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

Input command should not be auto-corrected (#7424) #7462

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import GBDeviceInfo

extension RoomInputToolbarView {
open override func sendCurrentMessage() {
// Triggers auto-correct if needed.
if self.isFirstResponder {
// Triggers auto-correct if needed and if it is not a command.
let isCommand = self.textMessage.hasPrefix("/")
if self.isFirstResponder && !isCommand {
Comment on lines +23 to +25
Copy link
Contributor

@aringenbach aringenbach Jun 12, 2023

Choose a reason for hiding this comment

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

I think the issue with that code is that it will only avoid triggering that last auto-correction that happens upon sending the message, and it will still still trigger upon typing.
I suppose we could do something similar that what the RTE does if it works: https://github.com/matrix-org/matrix-rich-text-editor/blob/main/platforms/ios/lib/WysiwygComposer/Sources/WysiwygComposer/Extensions/UITextView.swift

(triggered when the text changes, so we could evaluate that at the same moment we evaluate for mentions text trigger)

let temp = UITextField(frame: .zero)
temp.isHidden = true
self.addSubview(temp)
Expand Down
1 change: 1 addition & 0 deletions changelog.d/7424.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Input command should not be auto-corrected