GNU screen copy paste breaks lines

I’m running a Armbian on a PI and operate it through a Serial USB TTL dongle.

I’m running the following command to connect to the PI:

screen /dev/tty.usbXXXX 115200

I can successully log in and run commands but when I try to paste a long file, things go terribly wrong as line breaks are broken.

For example, if I copy and paste the following file (CRLF):

version: "3.9"

services:
  ip-initializer:
    image: myImage
    restart: unless-stopped
    environment:
      MODULE: ip-initializer
      IP: 10.0.0.19
      LOGLEVEL: info
    volumes:
      - ./docker-compose.yml:/docker-compose.yml
      - ./logs:/logs
    privileged: true
    network_mode: host
    cap_add:
      - NET_ADMIN
    healthcheck:
      test: ["CMD-SHELL", "ip addr show dev eth0 | grep -q $$IP || exit 1"]

  telnet-haas:
    image: myImage
    restart: unless-stopped
    environment:
      MODULE: telnet-haas
      IP: 10.0.0.20
      PORT: 8081
      DPRINT_PORT: 8080
      COMMANDS: '["?Q102", "?Q100", "?Q500", "?Q303", "?Q201", "?Q600 8505", "?Q600 8511", "?Q600 8512", "?Q600 8515", "?Q600 3011", "?Q600 3027"]'
      LOGLEVEL: info
    devices:
      - '/dev/ttyS1:/dev/ttyOpto'
    volumes:
      - ./logs:/logs
    ports:
      - "10.0.0.20:8081:8081/tcp"
      - "10.0.0.20:8080:8080/tcp"
    depends_on:
      - ip-initializer:
          condition: service_healthy

  telnet-haas2:
    image: myImage
    restart: unless-stopped
    environment:
      MODULE: telnet-haas2
      IP: 10.0.0.21
      PORT: 8081
      DPRINT_PORT: 8080
      COMMANDS: '["?Q102", "?Q100", "?Q500", "?Q303", "?Q201", "?Q600 8505", "?Q600 8511", "?Q600 8512", "?Q600 8515", "?Q600 3011", "?Q600 3027"]'
      LOGLEVEL: info
    devices:
      - '/dev/ttyS2:/dev/ttyOpto'
    volumes:
      - ./logs:/logs
    ports:
      - "10.0.0.21:8081:8081/tcp"
      - "10.0.0.21:8080:8080/tcp"
    depends_on:
      - ip-initializer:
          condition: service_healthy

The serial will produce:

enter image description here

It adds line breaks and seems to edit the content even if no key was pressed.

Is there something I need to change to fix that ?


EDIT:

Adding the following line to ~/.nanorc did the trick:

unbind ^J main
Asked By: IArchi

||

Adding the following line to ~/.nanorc did the trick:

unbind ^J main
Answered By: IArchi
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.