Re: Feature Request: Option to Disable End-of-Line Selection on Triple Click

Waqar Ahmed <[email protected]> Sat, 14 Sep 2024 23:17:21 +0500
Newsgroups gmane.comp.kde.devel.kwrite
Message-ID <CAPesRH7MM7GM8CyooizX6UznJV19BD5fug0UA23MK9sNAUqy_Q@mail.gmail.com>
Hi,

I would suggest that you write a "Command Line Script" that has the
behaviour you want and then bind that script to a shortcut.
See: https://docs.kde.org/stable5/en/kate/katepart/dev-scripting.html

Maybe the following will work (haven't tested it):

```
var katescript =3D {
    "author": "abcd",
    "license": "LGPLv2+",
    "revision": 1,
    "kate-version": "5.1",
    "functions": ["myCopyLine"],
    "actions": [
        {   "function": "myCopyLine",
            "name": "Copy current line",
            "category": "Editing",
            "shortcut": "Ctrl+Shift+A",
            "interactive": "false"
        }
    ]
};

function myCopyLine() {
    var cursor =3D view.cursorPosition();
    var lineLength =3D document.line(cursor.line).length;
    view.setSelection(Range(cursor.line, 0, cursor.line, lineLength));
    view.copy();
}
```

- put this in a file under ~/.local/share/katepart5/script/commands/
- start kate
- Hit Ctrl + Shift + A ...... OR .... F7 and then type "myCopyLine"

Regards,
Waqar

On Sat, Sep 14, 2024 at 9:05=E2=80=AFPM [email protected] <[email protected]>=
 wrote:
>
> Dear KWrite/Kate Development Team,
>
> I hope this message finds you well. I would like to request a small
> feature that I believe could improve the user experience for many users.
>
> Currently, in Kate Version 24.05.2 (and possibly other versions), when
> triple-clicking a line to select it, the end-of-line (newline) character
> is also included in the selection. While I understand that this may be
> the desired behavior for some, it can be quite inconvenient for others,
> especially when one frequently copies lines of code without wanting the
> newline character.
>
> I would like to suggest adding an option (perhaps a checkbox in the
> settings) that allows users to disable the inclusion of the newline
> character when triple-clicking a line. This would provide more
> flexibility and control over text selection behavior.
>
> Thank you for considering this feature request, and I appreciate all the
> hard work that goes into maintaining such a fantastic tool!
>
> Best regards,
>
> David
>