ecode icon indicating copy to clipboard operation
ecode copied to clipboard

Select current line contents command

Open Curculigo opened this issue 1 year ago • 4 comments

A very long line. If I drag the mouse vertically from line n + 1 to line n - 1 or vice versa, I could indeed select the long line without having to traverse the length of it, but this will include two empty new lines when paste (to other program in my case). If I only drag from line n + 1 or n - 1 to line n then I still have one empty new line when paste.

Curculigo avatar Sep 29 '24 05:09 Curculigo

There's no single command to select a whole line without the \n, you can select by: home + shift+end also you can triple-click the line, it will also select the \n so you'll need to shift-left before copying. Now that I'm thinking about it I'll add to copy the whole line if user ctrl+c but has no selection.

SpartanJ avatar Sep 29 '24 06:09 SpartanJ

There's no single command to select a whole line without the \n, you can select by: home + shift+end

What are home and end? The Home and End buttons on my keyboard? The beginning of the line and the end of the line? But doing so I still need to traverse the whole length of the line (use the horizontal scrollbar).

also you can triple-click the line, it will also select the \n so you'll need to shift-left before copying.

I don't know about this.

Now that I'm thinking about it I'll add to copy the whole line if user ctrl+c but has no selection.

No, please don't! You must select something to use ctrl+c! There is line number, right? What about click into the line number will select the line and double click will select and copy the line? What about changing triple click to not include the new line? There are many choices but please don't change the behavior of ctrl+c.

Curculigo avatar Sep 29 '24 07:09 Curculigo

But doing so I still need to traverse the whole length of the line (use the horizontal scrollbar).

You can always enable line-wrap if you don't like horizontal scrolling. What's bothering you about that? I'm curious.

I don't know about this.

An alternative exists but it's not binded by default, command is select-line, you can bind it, but behavior is the same than triple-click (same command), it will also select end \n. I think I'll bind it for next version.

No, please don't! You must select something to use ctrl+c! There are many choices but please don't change the behavior of ctrl+c.

Why? BTW this is not an original idea, vscode does this. I'm open to counter arguments, but I thought that could be handy. I've no rush to add that functionality.

There is line number, right? What about click into the line number will select the line and double click will select and copy the line?

I'm reserving that for debugger breakpoints. I'll try to not use more gutter space than the current (I don't like when editors use/have huge gutter space, I find it annoying). Breakpoints will be highlighted differently than other editors (at least that's the idea, i'll see how it develops). All editors I know still select the whole line when you click there (\n included).

What about changing triple click to not include the new line?

I prefer to respect what is traditional here. All editors behave like this.

I'm trying to find a single editor that does not select the \n while selecting the line but I can't, I also can't find any editor with the alternative you're looking for. So the thing I can provide you is a new command that will not be binded by default but you bill be free to bind it, I'll call it select-single-line. Already pushed the addition of that command here.

SpartanJ avatar Sep 29 '24 15:09 SpartanJ

Why? BTW this is not an original idea, vscode does this. I'm open to counter arguments, but I thought that could be handy. I've no rush to add that functionality.

I have never used VSCode.

You can always enable line-wrap if you don't like horizontal scrolling. What's bothering you about that? I'm curious.

Even with line-wrap, a very long single line text still spans multiple lines. Instead of scrolling horizontally, I will have to scroll vertically. Nothing changed.

I'm trying to find a single editor that does not select the \n while selecting the line but I can't, I also can't find any editor with the alternative you're looking for. So the thing I can provide you is a new command that will not be binded by default but you bill be free to bind it, I'll call it select-single-line. Already pushed the addition of that command here.

OK. Thank you anyway.

Curculigo avatar Sep 29 '24 16:09 Curculigo

There is no such a thing as select-single-line in command palette. Did you rename it?

Curculigo avatar Oct 06 '24 18:10 Curculigo

Command palette is not searching for the command key, only it's name, i'll fix it later to search on both.

Screenshot 2024-10-11 at 00 39 03

SpartanJ avatar Oct 11 '24 03:10 SpartanJ

Isn't select single line and select to end of line the same? The wording is somewhat confusing. Btw, I want to list all available commands. I don't type anything in the prompt and just scroll down. But I don't think it really lists all of the available commands. They can't be that few! And I don't see either select single line or select to end of line on my ecode. I know about them from your screenshot. I tried to search first with select and later line, but it always gives me unrelated results.

ghost avatar Oct 11 '24 04:10 ghost

 Isn't select single line and select to end of line the same?

Nope. "select to end of line" will select from the current cursor position to the end of line, "select single line" will move the cursor start position to the end of the current line and select to the beginning of the current line.

The wording is somewhat confusing

I agree, but the real select line command ("single-line") behaves like any other editor and I added this one because it was requested here, I couldn't find it in any other editor to check how they call it so I just used whatever came to my mind. Since it's not released yet it still can be changed to something different if there's a better naming for it.

Btw, I want to list all available commands. I don't type anything in the prompt and just scroll down. But I don't think it really lists all of the available commands.

It currently display all available commands. What you see is what you get.

They can't be that few! And I don't see either select single line or select to end of line on my ecode.

My guess is that you're trying to see the command palette from anything besides a document. Command palette enables/disables the visibility of document commands depending if there's a document open and focused, given that the commands can only be executed with an open document. So you need to open the command palette having focus on some document. But still, they are just around 200 command, so it's not that much.

 I tried to search first with select and later line, but it always gives me unrelated results.

This command is new and not available in the stable release of ecode, but some users are using the nightly builds of ecode. Nightly builds are new but I did not expose them yet given that I want to do a few changes in the build generation.

SpartanJ avatar Oct 14 '24 23:10 SpartanJ

Command palette is not searching for the command key, only it's name, i'll fix it later to search on both.

Fixed.

SpartanJ avatar Oct 16 '24 00:10 SpartanJ