Extra empty lines appear when copying to the terminal org.kde.konsole - command-line

My problem is as follows. When copying multi-line text (consisting of commands, for example) from somewhere (text editors, etc.) to the terminal via Ctrl + Shift + V or through the menu with the right mouse button, extra empty lines appear between each line.
For me, this is a problem when copying, for example, the body of a function to the Python interpreter.
My system is Linux Manjaro-KDE (5.4.43-1-MANJARO kernel), but the problem repeats in Arch-linux-KDE too (I checked this).
I managed to figure out the following on my own:
When copying multi-line text, in the Clipboard (which I view by clicking on the corresponding tray icon) a blue “Enter” icon is in front of each new line of the text.
If I edit the block with text directly in the Clipboard buffer, for example, press "edit", do nothing and just save, then the blue "Enter" disappears and the text is copied to the terminal without any extra intermediate lines.
As for other editors and exactly for the gnome-terminal, the text is copied everywhere correctly without blank lines, regardless of the "existence" of the blue "Enter" in the Clipboard. In addition, if I copy lines from the terminal itself and paste into it, then empty lines do not appear.
I think that additional CR/LF characters are added, which are perceived by a single line break everywhere except for the terminal "org.kde.konsole".
Please help: how can I change the behavior of the buffer when copying or the behavior of the terminal?
This question is similar to https://forum.manjaro.org/t/copy-paste-multiple-lines-on-yakuake-konsole-adds-newlines/94589 but it didn't help me.

Had the same problem, it was fixed in Konsole 20.04.3 by the following commit: https://invent.kde.org/utilities/konsole/-/commit/6b6a1e552492a25217cded1d83c25a652e5b249a

Related

Netbeans unindent (Shift+Tab) not working when cursor is inside the line (no selection)?

In Neatbeans, unindent works as expected when multiple lines are selected. But consider the following, where the pipe character | symbolizes the cursor position in the editor:
(a) Cursor at start of line (no selection)
|hello world!
(b) Cursor inside of line (no selection)
hell|o world!
In Netbeans, when I hit Shift+Tab on version (a) then the indentation is removed. This is what I expect.
However, when I hit Shift+Tab on version (b) then nothing happens. This is different from the code editors that I am used to. I would expect the indentation to be removed, or that the cursor moves to the start of the line, such that the next Shift+Tab will remove the indentation.
Is there a config in Netbeans that makes unindent via Shift+Tab work when the cursor is inside the line?
To shift the line to the left, regardless of the cursor position you can use the "Shift line left" editor action. In the default NetBeans mapping this is assigned to Alt+Shift+KP_LEFT and Alt+Shift-LEFT
Just open the keymap options page and search for the action "shift line"
It's not exactly what you are asking, but you could try to remap that action to "Shift-Tab" and see if it works.
TLDR: There seems to be a bug in the way NetBeans handles indenting/unindenting.
I would expect the indentation to be removed
I don't see any formal documentation on how unindenting is supposed to work in NetBeans, but it appears to move the text to the right of the cursor to the left, as long as there is only whitespace to the left of the cursor. While that is different to how unindenting works in other code editors such as Intellij IDEA and Eclipse, where the entire line is shifted to the left even when the cursor is poitioned within the text, it's not necessarily incorrect.
If you want to unindent in NetBeans there are two simple alternatives: either position the cursor at the start of the line, or select some text - anything at all! - on that line before unindenting.
Some comments in the NetBeans Bug Report Bug 212353 - Shift+Tab (Delete tab) shortcut does not work in editor may be relevant:
Please note that those actions should be inverse - I mean when you
select a block and you hit <TAB> <TAB> <Shift-TAB> <Shift-TAB> you
should always end up with the same text. The same should be true if
you change the order to <Shift-TAB> <Shift-TAB> <TAB> <TAB> you
should end up with the same text.
That said, NetBeans is not adhering to that standard. Using your second example, pressing <TAB><TAB> works fine, but subsequently pressing <SHIFT><TAB> does nothing, so it is not possible to "end up with the same text". That looks like a bug (in Apache NetBeans 11.2 at least). You can raise a bug report here.
It's also worth noting that <Shift> + <Tab> is actually defined as the keymap for "Delete TAB" rather "unindenting".
Is there a config in Netbeans that makes unindent via Shift+Tab work
when the cursor is inside the line?
I don't think so. All you can do, using Tools > Options > Keymap, is to change the shortcut keys from <Shift> + <Tab> to something else, but that won't change the behavior.

How can I copy the entire line without selection?

I wonder if there's a keyboard shortcut to copy the entire line where the cursor is without having to select it.
NOTE: I know how to duplicate it up and down, and how to move it too, but the problem is that sometimes I want to copy the same line of code to another different method, even to another different file.
You are looking for the editor.action.clipboardCopyAction command (docs). It copies either the current selection or, when nothing is selected, the whole line to the clipboard.
By default it is bound to Ctrl + C (Cmd + C on macOS).

How to select whole line in VSCode

I am using VSCode on a Mac.
Does anyone know how to select the entire line that the cursor is on? I know about Command+I, but that only selects what appears to be the whole line, which is not always the whole line if I have word wrap enabled.
I am looking for something like Sublime Text's "Expand Selection to Line" command.
All you need to do is put the cursor anywhere on the line, do not make any selection at all and then do the desired command (Cut, copy, or paste).
When no text selected, VS Code will automatically select the entire line.
just triple click the end of the line it will select the entire line
Triple click at any point on the line
Click once on number of the line
Press Command + L
An alternative to what people have posted is, when your cursor is at the start/end of the line, you can hit shift + end/home respectively.
I find this useful for wrapping a line in curly braces/quotes/etc. whereas the other answers include spaces in the select so whatever you're wrapping it in will be wrapped around that whitespace.
Install the MetaGo extension and use the "metaGo: selectLineDown" command, which will come installed already overriding the "expandLineSelection" command.
This extension has many additional commands that you'll likely find useful as well, including moving up/down over code blocks, centering the active line, and going to any character on the screen.
Now, when I press Command+I, the whole line is selected. I am guessing this was caused by an update to VS Code, but I am not sure.
Ctrl + L on Windows or Command + L on Mac to select the whole line in VS Code.
You can use your mouse to select the whole line by triple-clicking on the line but the better way is to click on the line number to select the whole line or multiple lines.
Tripple click at any point on the line
In case you're wondering why Cmd+L is not working, there might be a chance that there are duplicate shortcuts. You can find out by opening Keyboard Shortcuts in VSC and remove the one that's not needed.
I know its old but for anyone seeking, you can press Alt + arrow up/down to duplicate your cursor to other lines and then without selecting anything copy and paste multiple lines.

How to force emacs's pasting to behave like in other apps

I am new emacs user and one of the things that irritates me is that when I want to replace current selected text with the one from clipboard I need to delete it first. Every other application that I know replaces pasted text with the current selection by default.
Here's a little bit more detailed description:
Select some block of text
Paste text from clipboard
Emacs just pastes text where the cursor was and previously selected text it is still there. I want that selected text was deleted first.
As artscan wrote in a comment, you can get this functionaly for the normal yank (paste) operations by adding:
(delete-selection-mode 1)
to your configuration.
If you want yank by mouse to also delete the current selection, you can add:
(put 'mouse-yank-primary 'delete-selection 'yank)
in your configuration as well.

How to Use Autocomplete in Sublime Text

I'm switching from Dreamweaver to Sublime Text, but the way ST handles autocomplete is different from DW. In DW, the tag autocompletes when you start typing the ending tag. But with ST, it autocompletes when you type the opening tag.
My problem is that in ST, you get trapped inside the tag you're typing, and the only way to move on to the next line is to hit the right arrow key a bunch of times. That seems totally ridiculous. Is there some shortcut I'm missing?
This might be what you're looking for:
https://github.com/SublimeText/Tag
In my copy of ST with this plugin installed, beginning to type the end-tag completes the tag and moves the cursor to the character immediately following the end of line.
Ctrl Enter will bring you to the next line and keep the auto complete that shows up. I'm on a mac.