johnnovak / illwill

A curses inspired simple cross-platform console library for Nim
Do What The F*ck You Want To Public License
398 stars 27 forks source link

Can't get Ctrl-J #30

Closed fox0430 closed 2 years ago

fox0430 commented 2 years ago

I used getKey to pressCtrl-J but it's Enter. Is it only my environment? Do you know anything?

OS: Arch Linux Terminal: Urxvt & Alacritty Nim: v1.6.6

Code:

import std/os
import pkg/illwill

illwillInit()

while true:
  let key = getKey()
  if key != None:
    echo key
    echo int(key)
  sleep 20

Start this program and press Ctrl-J

Enter
13

In addition, I can get it normally with terminal.getch.

import std/terminal

let key = getch()
echo int(key)

Start this program and press Ctrl-J

10
johnnovak commented 2 years ago

Terminal issue, closing.

https://www.reddit.com/r/programming/comments/7qxgy/real_programmers_use_ctrlj_instead_of_enter_key/