Xfce Forum

Sub domains
 

You are not logged in.

#1 2020-12-18 03:12:32

almahdi
Member
Registered: 2020-07-04
Posts: 125

Desktop terminal automatically replaces tab and newline with space

Which Linux terminal can automatically replaces tab and newline with plain space (spacebar) in which it's pasted, and how is the configuration setting for that?

Last edited by almahdi (2020-12-18 07:15:56)

Offline

#2 2020-12-18 07:56:49

Signy
Member
Registered: 2020-10-20
Posts: 52

Re: Desktop terminal automatically replaces tab and newline with space

Do you mean that when you pastes text from clipboard into terminal, the terminal would change pasted text (with tabs and newlines replaced by spaces)?

If so I do not know any terminal with similar function.
If I needed something like this I would use AutoKey:

  • I would make a Python script, which would do this text change.

  • I would configure a shortcut key for this script.

  • I would make this script (and shortcut key) working only in preferred terminal application (by setting a Window Filter).

The script could look like this:

# Changes text in clipboard and pastes it to terminal
# (window filter: xfce4-terminal\.Xfce4-terminal)
import platform, time

newClip = clipboard.get_clipboard()
# Text change
output = newClip.replace("\n"," ")
output = output.replace("\t"," ")
# Put changed text into clipboard
clipboard.fill_clipboard(output)
time.sleep(0.3)
# Paste text to terminal window
keyboard.send_keys("<ctrl>+<shift>+v")
#time.sleep(0.5)
# Cleaning
del newClip, output

and Scipt Settings (in AutoKey) in case of using the Xfce terminal could be:

  • Hotkey: <ctrl>+b

  • Window Filter: xfce4-terminal\.Xfce4-terminal

Offline

Board footer

Powered by FluxBB