Skip to content

Input command should not be auto-corrected #7424

@NicolasBuquet

Description

@NicolasBuquet

Steps to reproduce

I try to send command /discardsession

Outcome

What did you expect?

I expect the input to be identified as command discardsession.

What happened instead?

Because of the auto-correction feature, the command is rewritten as /discard session.

The piece of code repsonsible of this auto-correction is in Riot/modules/Room/Views/InputToolbar/RoomInputToolbarView.swift:sendCurrentMessage() :

// Triggers auto-correct if needed.
        if self.isFirstResponder {
            let temp = UITextField(frame: .zero)
            temp.isHidden = true
            self.addSubview(temp)
            temp.becomeFirstResponder()
            self.becomeFirstResponder()
            temp.removeFromSuperview()
        }

I propose that command (string beginning with a '/') should not be auto-corrected.

The code should be:

        // Triggers auto-correct if needed and if it is not a command.
        let isCommand = self.textMessage.hasPrefix("/")
        if self.isFirstResponder && !isCommand {
            let temp = UITextField(frame: .zero)
            temp.isHidden = true
            self.addSubview(temp)
            temp.becomeFirstResponder()
            self.becomeFirstResponder()
            temp.removeFromSuperview()
        }

Your phone model

iPhone 14 Simulator

Operating system version

iOS 16

Application version

Element 1.10.3

Homeserver

No response

Will you send logs?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ComposerO-OccasionalAffects or can be seen by some users regularly or most users rarelyS-MinorImpairs non-critical functionality or suitable workarounds existT-DefectSomething isn't working: bugs, crashes, hangs and other reported problems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions