Skip to content
This repository was archived by the owner on Oct 28, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

cmake_minimum_required(VERSION 2.6)

project(linenoise)
project(linenoise-ng)

set(CMAKE_BINARY_DIR "${CMAKE_SOURCE_DIR}/build")

Expand Down Expand Up @@ -76,15 +76,16 @@ include_directories(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/src)

# build liblinenoise
add_library(
linenoise
STATIC
linenoise-ng
SHARED
#STATIC
src/ConvertUTF.cpp
src/linenoise.cpp
src/wcwidth.cpp
)

# install
install(TARGETS linenoise DESTINATION lib)
install(TARGETS linenoise-ng DESTINATION lib)

# headers
install(FILES include/linenoise.h DESTINATION include)
Expand All @@ -97,7 +98,7 @@ add_executable(

target_link_libraries(
example
linenoise
linenoise-ng
)

# packaging
Expand All @@ -116,5 +117,5 @@ set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")

set(CPACK_STRIP_FILES "ON")

set(CPACK_PACKAGE_NAME "linenoise")
set(CPACK_PACKAGE_NAME "linenoise-ng")
set(CPACK_DEBIAN_PACKAGE_SECTION "utilities")
6 changes: 3 additions & 3 deletions src/linenoise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2554,7 +2554,7 @@ int InputBuffer::getInputLine(PromptBase& pi) {
killRing.lastAction = KillRing::actionKill;
break;

case ctrlChar('J'): // ctrl-J/linefeed/newline, accept line
//case ctrlChar('J'): // ctrl-J/linefeed/newline, accept line
case ctrlChar('M'): // ctrl-M/return/enter
killRing.lastAction = KillRing::actionOther;
// we need one last refresh with the cursor at the end of the line
Expand Down Expand Up @@ -2828,12 +2828,12 @@ int InputBuffer::getInputLine(PromptBase& pi) {
default:
killRing.lastAction = KillRing::actionOther;
historyRecallMostRecent = false;
if (c & (META | CTRL)) { // beep on unknown Ctrl and/or Meta keys
if (c & (META | CTRL) && !(c==ctrlChar('J'))) { // beep on unknown Ctrl and/or Meta keys
beep();
break;
}
if (len < buflen) {
if (isControlChar(c)) { // don't insert control characters
if (isControlChar(c) && !(c==ctrlChar('J'))) { // don't insert control characters
beep();
break;
}
Expand Down
1 change: 0 additions & 1 deletion tst/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ int main () {
printf("starting...\n");

char const* prompt = "\x1b[1;32mlinenoise\x1b[0m> ";

while (1) {
char* result = linenoise(prompt);

Expand Down