]> git.lizzy.rs Git - linenoise.git/log
linenoise.git
2 years agoUse CMake master
Elias Fleckenstein [Mon, 25 Apr 2022 09:46:14 +0000 (11:46 +0200)]
Use CMake

3 years agoinclude utf8.c and utf8.h in the right order
Steve Bennett [Sat, 14 Nov 2020 00:16:43 +0000 (10:16 +1000)]
include utf8.c and utf8.h in the right order

In linenoise-ship.c - need these first

Signed-off-by: Steve Bennett <steveb@workware.net.au>
3 years agodon't reinclude utf8.h in "shipped" version
Steve Bennett [Wed, 4 Nov 2020 01:38:10 +0000 (11:38 +1000)]
don't reinclude utf8.h in "shipped" version

linenoise-ship.c already includes utf8.h, so
don't reinclude it

Signed-off-by: Steve Bennett <steveb@workware.net.au>
4 years agostringbuf: clarify license
Steve Bennett [Thu, 12 Mar 2020 12:24:11 +0000 (22:24 +1000)]
stringbuf: clarify license

Signed-off-by: Steve Bennett <steveb@workware.net.au>
4 years agoClear some warnings and errors with GCC and MSVC.
Cliff Yapp [Wed, 11 Mar 2020 11:46:02 +0000 (07:46 -0400)]
Clear some warnings and errors with GCC and MSVC.

4 years agoCan't use insert/delete char optimisation on win32
Steve Bennett [Mon, 10 Jun 2019 04:52:33 +0000 (14:52 +1000)]
Can't use insert/delete char optimisation on win32

On win32, everything must go through refreshLine().
It is not possible to use outputChars() directly.

This fixes an assertion failure on win32

Signed-off-by: Steve Bennett <steveb@workware.net.au>
4 years agoInclude licence text in utf8.{c,h} explicitly
Steve Bennett [Sun, 9 Jun 2019 23:51:27 +0000 (09:51 +1000)]
Include licence text in utf8.{c,h} explicitly

Signed-off-by: Steve Bennett <steveb@workware.net.au>
4 years agoAccept linefeed as enter
Steve Bennett [Sun, 9 Jun 2019 23:39:23 +0000 (09:39 +1000)]
Accept linefeed as enter

Signed-off-by: Steve Bennett <steveb@workware.net.au>
5 years agoRe-add delete char optimisation
Steve Bennett [Wed, 25 Jul 2018 10:00:12 +0000 (20:00 +1000)]
Re-add delete char optimisation

When backspacing at the end of the line, if the row wouldn't
change and the previous chars is a simple ascii char and there
is no hint to display, simply output \b space \b

Signed-off-by: Steve Bennett <steveb@workware.net.au>
5 years agoFix some static analyser problems
Steve Bennett [Wed, 25 Jul 2018 06:52:10 +0000 (16:52 +1000)]
Fix some static analyser problems

Signed-off-by: Steve Bennett <steveb@workware.net.au>
5 years agoRemove a spurious function declaration
Steve Bennett [Wed, 25 Jul 2018 06:51:52 +0000 (16:51 +1000)]
Remove a spurious function declaration

Signed-off-by: Steve Bennett <steveb@workware.net.au>
5 years agoRe-add insert optimisation
Steve Bennett [Wed, 25 Jul 2018 06:51:26 +0000 (16:51 +1000)]
Re-add insert optimisation

When inserting at the end of the line, if there is sufficient
space and no hint to display, simply output the character directly

This especially helps when running over a slow serial link

Signed-off-by: Steve Bennett <steveb@workware.net.au>
5 years agoFix compiler warning
Steve Bennett [Sun, 8 Jul 2018 01:12:31 +0000 (11:12 +1000)]
Fix compiler warning

Ignore return code from write() in linenoiseClearScreen()

Signed-off-by: Steve Bennett <steveb@workware.net.au>
6 years agoAdd explicit support for single-file delivery
Steve Bennett [Fri, 16 Feb 2018 23:35:16 +0000 (09:35 +1000)]
Add explicit support for single-file delivery

Signed-off-by: Steve Bennett <steveb@workware.net.au>
6 years agoGuard inclusion of stringbuf.h
Steve Bennett [Thu, 15 Feb 2018 23:13:12 +0000 (09:13 +1000)]
Guard inclusion of stringbuf.h

This allows for creation of a single-file to deliver linenoise support:

cat stringbuf.h stringbuf.c utf8.h utf8.c linenoise.c >linenoise-ship.c

Signed-off-by: Steve Bennett <steveb@workware.net.au>
6 years agoAdd support for utf16 surrogate pairs on Windows
Steve Bennett [Fri, 5 Jan 2018 02:22:35 +0000 (12:22 +1000)]
Add support for utf16 surrogate pairs on Windows

Signed-off-by: Steve Bennett <steveb@workware.net.au>
6 years agoImplement multiline and hints support
Steve Bennett [Mon, 1 Jan 2018 21:50:12 +0000 (07:50 +1000)]
Implement multiline and hints support

multiline and hints support now matches antirez/master

Additionally:
- Use an expanding stringbuf to simplify management of the current line
- Now there is no maximum line length
- All output is buffered in refreshLine() and output at once to improve
  performance
- Remove insert/delete char optimisation since it fails with control chars
  and wide characters
- General code cleanup
- Support CRNL in addition to NL for EOL
- don't allow ^V to insert a null char
- Coloured prompts using ANSI escape sequences are now supported on both windows
  and non-windows
- Example app now supports a custom prompt

Signed-off-by: Steve Bennett <steveb@workware.net.au>
6 years agoAdd an assertion for fd_printf() buffer size
Steve Bennett [Mon, 1 Jan 2018 03:23:48 +0000 (13:23 +1000)]
Add an assertion for fd_printf() buffer size

Signed-off-by: Steve Bennett <steveb@workware.net.au>
6 years agoEnable ^Z (SUSP) support
Steve Bennett [Mon, 1 Jan 2018 03:11:16 +0000 (13:11 +1000)]
Enable ^Z (SUSP) support

Allows the current process to be backgrounded and then resumed.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
6 years agoutf8: Update utf8 width tables to 10.0.0
Steve Bennett [Sun, 31 Dec 2017 01:31:59 +0000 (11:31 +1000)]
utf8: Update utf8 width tables to 10.0.0

And merge adjacent ranges

Signed-off-by: Steve Bennett <steveb@workware.net.au>
6 years agoFix potential buffer overflow in utf8 mode
Steve Bennett [Sun, 31 Dec 2017 00:20:25 +0000 (10:20 +1000)]
Fix potential buffer overflow in utf8 mode

Define and use MAX_UTF8_LEN for the longest utf8 sequence
that can be returned.

In any case reverse incremental search was using + 3 rather
than - 3 to check for buffer overflow.

Also:
- support 4 byte utf8 sequences.
- better handling of invalid utf8 sequences

Signed-off-by: Steve Bennett <steveb@workware.net.au>
7 years agoUse <poll.h> instead of glibc-specific <sys/poll.h>
Steve Bennett [Thu, 16 Mar 2017 11:31:56 +0000 (21:31 +1000)]
Use <poll.h> instead of glibc-specific <sys/poll.h>

This keeps musl happy too

Signed-off-by: Steve Bennett <steveb@workware.net.au>
7 years agoAdd a fast path for utf8_width()
Steve Bennett [Sun, 4 Sep 2016 03:09:25 +0000 (13:09 +1000)]
Add a fast path for utf8_width()

For common ASCII characters

Signed-off-by: Steve Bennett <steveb@workware.net.au>
7 years agoAdd support for utf-8 wide chars and combining chars
Jenson@Win32 [Sun, 4 Sep 2016 00:11:48 +0000 (10:11 +1000)]
Add support for utf-8 wide chars and combining chars

7 years agoAdd support for utf-8 display width
Steve Bennett [Sun, 4 Sep 2016 01:25:58 +0000 (11:25 +1000)]
Add support for utf-8 display width

Supports wide characters and combining characters

Signed-off-by: Steve Bennett <steveb@workware.net.au>
7 years agofix display of utf-8 chars on Windows
Jenson@Win32 [Sat, 3 Sep 2016 23:56:00 +0000 (09:56 +1000)]
fix display of utf-8 chars on Windows

Need to use WriteConsoleOutputCharacterW() to write wide chars

7 years agoExtend utf-8 support to 4 byte characters
Steve Bennett [Sun, 4 Sep 2016 01:04:30 +0000 (11:04 +1000)]
Extend utf-8 support to 4 byte characters

Up to \u1fffff

Signed-off-by: Steve Bennett <steveb@workware.net.au>
7 years agoFix compilation on Windows
Steve Bennett [Sat, 3 Sep 2016 00:04:01 +0000 (10:04 +1000)]
Fix compilation on Windows

Reported-by: Jenson@Win32 <jenson.shixf@gmail.com>
Signed-off-by: Steve Bennett <steveb@workware.net.au>
7 years agolinenoise: Allow a completion callback user parameter
Steve Bennett [Mon, 19 May 2014 10:32:28 +0000 (20:32 +1000)]
linenoise: Allow a completion callback user parameter

Signed-off-by: Steve Bennett <steveb@workware.net.au>
7 years agoDon't disable OPOST
Steve Bennett [Wed, 10 Aug 2016 00:57:04 +0000 (10:57 +1000)]
Don't disable OPOST

Is it isn't required by linenoise and this helps with multithreaded applications
where another thread produces output.

Ref github issue #18

Signed-off-by: Steve Bennett <steveb@workware.net.au>
7 years agoMake linenoiseClearScreen() public
Steve Bennett [Thu, 24 Mar 2016 13:47:17 +0000 (23:47 +1000)]
Make linenoiseClearScreen() public

7 years agoAvoid ESC [ n C with n=0
Steve Bennett [Mon, 19 Jan 2015 05:49:49 +0000 (15:49 +1000)]
Avoid ESC [ n C with n=0

Note that this can only happen if the prompt is the empty string.

8 years agoMerge pull request #19 from bblanchon/master
Steve Bennett [Tue, 12 May 2015 12:43:14 +0000 (22:43 +1000)]
Merge pull request #19 from bblanchon/master

Fixed Visual Studio warning C4204

8 years agoFixed Visual Studio warning C4204 (nonstandard extension used : non-constant aggregat...
Benoit Blanchon [Tue, 12 May 2015 08:22:26 +0000 (10:22 +0200)]
Fixed Visual Studio warning C4204 (nonstandard extension used : non-constant aggregate initializer)

9 years agoadded API docs.
Stephan Beal [Tue, 13 May 2014 13:26:01 +0000 (15:26 +0200)]
added API docs.

9 years agoMerge pull request #15 from sgbeal/master
Steve Bennett [Mon, 12 May 2014 21:36:31 +0000 (07:36 +1000)]
Merge pull request #15 from sgbeal/master

linenoiseSetCompletionCallback() now returns its prior callback, so that...

9 years agolinenoiseSetCompletionCallback() now returns its prior callback, so that the caller...
Stephan Beal [Mon, 12 May 2014 18:02:22 +0000 (20:02 +0200)]
linenoiseSetCompletionCallback() now returns its prior callback, so that the caller can save/restore the value.

10 years agoMerge pull request #14 from lirenlin/master
Steve Bennett [Sun, 23 Mar 2014 00:49:44 +0000 (10:49 +1000)]
Merge pull request #14 from lirenlin/master

fix ctrl bug during reverse search

10 years agofix ctrl bug during reverse search
unknown [Fri, 21 Mar 2014 17:00:45 +0000 (17:00 +0000)]
fix ctrl bug during reverse search

10 years agoBug fix. Fix fallback code for getting the terminal width.
Andreas Kupries [Fri, 18 Oct 2013 20:43:06 +0000 (13:43 -0700)]
Bug fix. Fix fallback code for getting the terminal width.

When using vt100 control sequences, do not change the visible cursor location.
Instead of
- go far right
- query location
we now do
(1) query location
(2) go far right
(3) query location again
(4) move left to the original location as reported by (1).

Only if (1) succeeds and (3) fails will the visible cursor location change (moving to far left).
Placed the code to request cursor location and parse the response into its own helper function.

The old way of doing it left the cursor at far right, and could mess up an outer shell prompt.

10 years agoBug fix. Ensure that current->cols is initialized
Andreas Kupries [Fri, 18 Oct 2013 20:38:07 +0000 (13:38 -0700)]
Bug fix. Ensure that current->cols is initialized

Even when both stdin/stdout are redirected (which prevents the raw mode from getting set).

10 years agoFix a couple of compiler warnings
Steve Bennett [Sun, 4 Aug 2013 01:19:15 +0000 (11:19 +1000)]
Fix a couple of compiler warnings

With the colour prompt support.
Also recognize '\e[m' as an escape sequence.
Simplify countColorControlChars().

Signed-off-by: Steve Bennett <steveb@workware.net.au>
10 years agoFix a bogus compiler warning
Steve Bennett [Wed, 24 Jul 2013 06:13:50 +0000 (16:13 +1000)]
Fix a bogus compiler warning

Signed-off-by: Steve Bennett <steveb@workware.net.au>
10 years agoUpdate for more accurate line count
Steve Bennett [Wed, 24 Jul 2013 04:53:53 +0000 (14:53 +1000)]
Update for more accurate line count

10 years agoAvoid use of strcasecmp()
Steve Bennett [Wed, 24 Jul 2013 04:50:51 +0000 (14:50 +1000)]
Avoid use of strcasecmp()

It isn't really necessary and isn't always available.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
11 years agoExample app improved.
antirez [Fri, 8 Feb 2013 11:24:07 +0000 (12:24 +0100)]
Example app improved.

11 years agolinenosePrompt() -> linenoiseEdit().
antirez [Tue, 5 Feb 2013 18:34:10 +0000 (19:34 +0100)]
linenosePrompt() -> linenoiseEdit().

11 years agolinenoiseHistorySetMaxLen() was broken and never tested. Fixed.
antirez [Fri, 8 Feb 2013 11:18:42 +0000 (12:18 +0100)]
linenoiseHistorySetMaxLen() was broken and never tested. Fixed.

11 years agoNew feature: Maintain a cut/paste buffer.
Andreas Kupries [Thu, 21 Feb 2013 00:12:35 +0000 (16:12 -0800)]
New feature: Maintain a cut/paste buffer.

The existing bindings for Ctrl+k, Ctrl+u, and Ctrl+w are
modified to fill the cut buffer with the characters they deleted.
The new binding for Ctrl+y inserts the contents of the
cut buffer at the current position.

11 years agoBug fix. Discount the characters of ANSI color control sequences.
Andreas Kupries [Wed, 20 Feb 2013 23:57:44 +0000 (15:57 -0800)]
Bug fix. Discount the characters of ANSI color control sequences.

Without discounting them they cause the input area to start too far right
of the end of the prompt.

11 years agoMerge pull request #10 from andreas-kupries/feature-export-get-console-width
Steve Bennett [Thu, 21 Feb 2013 01:10:24 +0000 (17:10 -0800)]
Merge pull request #10 from andreas-kupries/feature-export-get-console-width

New feature: Export console width through accessor API

11 years agoNew feature: Provide a public accessor to the getWindowSize() functionality.
Andreas Kupries [Thu, 21 Feb 2013 00:31:39 +0000 (16:31 -0800)]
New feature: Provide a public accessor to the getWindowSize() functionality.
The accessor returns only the number of columns, i.e. window width.

11 years agoNew feature: Page Up/Down keys jump in history (start, end).
Andreas Kupries [Fri, 25 Jan 2013 01:11:03 +0000 (17:11 -0800)]
New feature: Page Up/Down keys jump in history (start, end).

Note: Also recognizes the Insert now as well, but doesn't do anything
with it.  This may be used in some future extension.  A possibility
would be to have an additional overwrite mode, and use this key to
toggle between the two.

11 years agoNew feature: Extended character transpose (Ctrl+t) at end of the line.
Andreas Kupries [Fri, 25 Jan 2013 21:12:52 +0000 (13:12 -0800)]
New feature: Extended character transpose (Ctrl+t) at end of the line.

Bash is able to transpose characters with the cursor after the last
character. It simply transposes the last two. Added this behavior
to linenoise.

11 years agoNew feature: Accessor for the history max len.
Andreas Kupries [Fri, 25 Jan 2013 02:54:38 +0000 (18:54 -0800)]
New feature: Accessor for the history max len.

11 years agoBug fix. Reset size information when clearing the history.
Andreas Kupries [Fri, 25 Jan 2013 00:31:39 +0000 (16:31 -0800)]
Bug fix. Reset size information when clearing the history.

Otherwise the next historyAdd will access freed memory, and crash.

11 years agoMerge pull request #3 from andreas-kupries/void-cast-clarification
Steve Bennett [Fri, 15 Feb 2013 02:29:34 +0000 (18:29 -0800)]
Merge pull request #3 from andreas-kupries/void-cast-clarification

Clarify the comment at the definition of IGNORE_RC.

11 years agoClarify the comment at the definition of IGNORE_RC.
Andreas Kupries [Fri, 25 Jan 2013 00:34:09 +0000 (16:34 -0800)]
Clarify the comment at the definition of IGNORE_RC.

11 years agoMerge pull request #2 from devurandom/msteveb/feature/completion-at-eol
Steve Bennett [Sun, 4 Nov 2012 10:18:42 +0000 (02:18 -0800)]
Merge pull request #2 from devurandom/msteveb/feature/completion-at-eol

Allow tab-completion only at the end of line and replace magic number

11 years agoAllow tab-completion only at the end of line
Dennis Schridde [Fri, 2 Nov 2012 09:50:00 +0000 (10:50 +0100)]
Allow tab-completion only at the end of line

11 years agoReplace magic number 9 with '\t' in linenoisePrompt()
Dennis Schridde [Fri, 2 Nov 2012 09:48:22 +0000 (10:48 +0100)]
Replace magic number 9 with '\t' in linenoisePrompt()

11 years agoFix linenoise serial console window size for vt102
Steve Bennett [Wed, 31 Oct 2012 03:17:24 +0000 (13:17 +1000)]
Fix linenoise serial console window size for vt102

This includes minicom, which doesn't support hpa (CHA), only cuf.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
11 years agoFix a linenoise bug when moving off the left
Steve Bennett [Thu, 18 Oct 2012 22:02:06 +0000 (08:02 +1000)]
Fix a linenoise bug when moving off the left

If the buffer is too big to fit in the window and the cursor
would move off the left edge of the windows, the display
is not shown correctly.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
11 years agoMerge pull request #1 from starwing/master
Steve Bennett [Wed, 6 Jun 2012 20:48:21 +0000 (13:48 -0700)]
Merge pull request #1 from starwing/master

add *.exe to gitignore, and fix several warnings from gcc.

11 years agoadd *.exe to ignore, fix gcc warnings
starwing [Wed, 6 Jun 2012 03:18:08 +0000 (11:18 +0800)]
add *.exe to ignore, fix gcc warnings

12 years agoFix first-chance exceptions in Windows
Tad Marshall [Mon, 17 Oct 2011 23:18:13 +0000 (19:18 -0400)]
Fix first-chance exceptions in Windows

A call to WriteConsoleOutputCharacter() didn't have its final parameter
set, passing a zero instead of a pointer to where to return the char count.
I added the same code that was there for FillConsoleOutputCharacter() and
FillConsoleOutputAttribute(), just allocate a dummy 'n' and pass its address.

12 years agoAdd MSVC support
Tad Marshall [Mon, 17 Oct 2011 22:49:25 +0000 (18:49 -0400)]
Add MSVC support

Test for _WIN32 to check for building for Windows.
Test __MINGW32__ to check for using MinGW compiler (on Windows).
If _WIN32 is defined and __MINGW32__ is not defined, assume Microsoft compiler, headers and libraries.
There are other ways this could be done, testing _MSC_VER for example, but these tests work.
Tested with Visual Studio 2005, MinGW 4.6.1 on Windows (mingw-get-inst-20110802.exe) and gcc 4.6.1
in Ubuntu 11.10 (Ubuntu/Linaro 4.6.1-9ubuntu3).

12 years agoFixed typo in README -- 'Readl world' => 'Real world'
Tad Marshall [Mon, 17 Oct 2011 21:31:07 +0000 (17:31 -0400)]
Fixed typo in README -- 'Readl world' => 'Real world'

12 years agoCombine some duplicate code
Steve Bennett [Thu, 29 Sep 2011 03:42:52 +0000 (13:42 +1000)]
Combine some duplicate code

Signed-off-by: Steve Bennett <steveb@workware.net.au>
12 years agoSupport more HOME/END escape sequences
Steve Bennett [Thu, 29 Sep 2011 03:42:15 +0000 (13:42 +1000)]
Support more HOME/END escape sequences

HOME: \e[7~
END: \e[8~

Signed-off-by: Steve Bennett <steveb@workware.net.au>
12 years agoDo not add duplicates lines to history
dvir volk [Wed, 28 Sep 2011 21:07:01 +0000 (00:07 +0300)]
Do not add duplicates lines to history

If the previous line is identical to the new line

12 years agoTabs not inserted as control characters
Steve Bennett [Sun, 25 Sep 2011 21:34:10 +0000 (07:34 +1000)]
Tabs not inserted as control characters

Due to missing parens in non-utf8 version of utf8_strlen()

Reported-by: Karl Robillard <krobillard@san.rr.com>
Signed-off-by: Steve Bennett <steveb@workware.net.au>
12 years agoUpdate comments and attributions for this fork
Steve Bennett [Thu, 15 Sep 2011 03:17:33 +0000 (13:17 +1000)]
Update comments and attributions for this fork

Signed-off-by: Steve Bennett <steveb@workware.net.au>
12 years agoLinenoise support for win32 console
Steve Bennett [Tue, 13 Sep 2011 22:16:54 +0000 (08:16 +1000)]
Linenoise support for win32 console

Signed-off-by: Steve Bennett <steveb@workware.net.au>
12 years agoRestructure linenoise in prep. for win32 support
Steve Bennett [Tue, 13 Sep 2011 22:15:48 +0000 (08:15 +1000)]
Restructure linenoise in prep. for win32 support

Separate out the termios-specific code

Signed-off-by: Steve Bennett <steveb@workware.net.au>
12 years agoAdd support for HOME and END keys
Steve Bennett [Tue, 13 Sep 2011 22:06:58 +0000 (08:06 +1000)]
Add support for HOME and END keys

Signed-off-by: Steve Bennett <steveb@workware.net.au>
12 years agoBetter integrate C++ example
Steve Bennett [Tue, 12 Apr 2011 23:43:59 +0000 (09:43 +1000)]
Better integrate C++ example

Signed-off-by: Steve Bennett <steveb@workware.net.au>
12 years agoBetter treatment of high-bit chars for non-utf8
Steve Bennett [Tue, 13 Sep 2011 22:57:13 +0000 (08:57 +1000)]
Better treatment of high-bit chars for non-utf8

Signed-off-by: Steve Bennett <steveb@workware.net.au>
13 years agoconst correctness
Mathias Stearn [Fri, 18 Mar 2011 19:50:10 +0000 (14:50 -0500)]
const correctness

13 years agoAdded some casts to make it easier to include in a c++ project
Eliot Horowitz [Fri, 18 Mar 2011 07:47:51 +0000 (03:47 -0400)]
Added some casts to make it easier to include in a c++ project

13 years agoCHA is 1-based
Mathias Stearn [Mon, 11 Apr 2011 23:34:19 +0000 (19:34 -0400)]
CHA is 1-based

13 years agoOptimise common insert/remove char cases
Steve Bennett [Thu, 7 Apr 2011 21:38:24 +0000 (07:38 +1000)]
Optimise common insert/remove char cases

When at the end of the line and no scrolling is needed
Also, ^L forces recalculation of the window size on serial terminals.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
13 years agoBetter line editing on serial terminals
Steve Bennett [Tue, 5 Apr 2011 02:40:39 +0000 (12:40 +1000)]
Better line editing on serial terminals

If TIOCGWINSZ doesn't work, try to query the window width
with escape sequences.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
13 years agoFix line editing when columns unavailable
Steve Bennett [Thu, 17 Mar 2011 06:39:06 +0000 (16:39 +1000)]
Fix line editing when columns unavailable

Sometimes TIOCGWINSZ succeeds but returns columns=0
This makes line editing work rather badly.

If this occurs, just behave as though TIOCGWINSZ had failed
and assume 80 columns.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
13 years agoMinor compiler warning fixes
Steve Bennett [Sun, 28 Nov 2010 13:58:55 +0000 (23:58 +1000)]
Minor compiler warning fixes

Also, don't define _XOPEN_SOURCE if already defined

Signed-off-by: Steve Bennett <steveb@workware.net.au>
13 years agoAdd utf-8 support to linenoise.c
Steve Bennett [Fri, 8 Oct 2010 12:55:20 +0000 (22:55 +1000)]
Add utf-8 support to linenoise.c

Plus general improvements, including:
- Allow pasting newlines to linenoise. Use TCSADRAIN, not TCAFLUSH
  so that unused input is not flushed

Signed-off-by: Steve Bennett <steveb@workware.net.au>
13 years agoBig cleanups to linenoise
Steve Bennett [Thu, 7 Apr 2011 22:11:09 +0000 (08:11 +1000)]
Big cleanups to linenoise

- Use a structure (current) to hold the state.
- Add fd_printf() to simplify output
- Add has_room(), insert_char(), remove_char(), fd_read()
- Use ctrl(X) instead of magic numbers
- Escape special chars in the history file
- Provide access to the history lines
- Completion support is optional

Signed-off-by: Steve Bennett <steveb@workware.net.au>
13 years agoAllow ^V to enter arbitrary control characters
Steve Bennett [Thu, 30 Sep 2010 22:25:56 +0000 (08:25 +1000)]
Allow ^V to enter arbitrary control characters

Signed-off-by: Steve Bennett <steveb@workware.net.au>
13 years agoHighlight control characters
Steve Bennett [Thu, 30 Sep 2010 22:23:28 +0000 (08:23 +1000)]
Highlight control characters

Signed-off-by: Steve Bennett <steveb@workware.net.au>
13 years agoAdd support for ^W to remove a word on the left
Steve Bennett [Thu, 30 Sep 2010 22:32:44 +0000 (08:32 +1000)]
Add support for ^W to remove a word on the left

Signed-off-by: Steve Bennett <steveb@workware.net.au>
13 years agoSupport reverse incremental search with ^R
Steve Bennett [Thu, 30 Sep 2010 20:11:32 +0000 (06:11 +1000)]
Support reverse incremental search with ^R

Signed-off-by: Steve Bennett <steveb@workware.net.au>
13 years agoHandle control characters in the line
Steve Bennett [Thu, 30 Sep 2010 20:07:42 +0000 (06:07 +1000)]
Handle control characters in the line

Only allow tab (^I) to be inserted in the line, not other
control characters.
But display any control character as ^x and handle
the cursor properly.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
13 years agoFix arrow keys on some terminals
Steve Bennett [Thu, 30 Sep 2010 20:01:27 +0000 (06:01 +1000)]
Fix arrow keys on some terminals

Some terminals use ^[OA instead of ^[[A for up arrow, etc.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
13 years agoswitched to two-clause simplified BSD license
antirez [Wed, 30 Mar 2011 15:08:20 +0000 (17:08 +0200)]
switched to two-clause simplified BSD license

13 years agoSupport for ctrl-d deleting the char at right of the cursor added
antirez [Tue, 22 Feb 2011 16:38:49 +0000 (17:38 +0100)]
Support for ctrl-d deleting the char at right of the cursor added

13 years agosuppress a warning on Linux adding some truly stupid code
antirez [Fri, 10 Dec 2010 18:21:28 +0000 (19:21 +0100)]
suppress a warning on Linux adding some truly stupid code

13 years agoCtrl-l support to clear the screen. New sequences added documented.
antirez [Wed, 1 Dec 2010 10:11:55 +0000 (11:11 +0100)]
Ctrl-l support to clear the screen. New sequences added documented.

13 years agogitignore added
antirez [Tue, 30 Nov 2010 10:37:48 +0000 (11:37 +0100)]
gitignore added

13 years agoPieter Noordhuis copyright notice added, since this was a major contribution. README...
antirez [Tue, 30 Nov 2010 10:34:06 +0000 (11:34 +0100)]
Pieter Noordhuis copyright notice added, since this was a major contribution. README updated.

13 years agoShow original buffer when completion is aborted
Pieter Noordhuis [Mon, 29 Nov 2010 19:35:20 +0000 (20:35 +0100)]
Show original buffer when completion is aborted