aboutsummaryrefslogtreecommitdiffstats
path: root/src/wreadln.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2008-11-07wreadln: return NULL instead of empty stringMax Kellermann1-0/+3
No wreadln() caller cares about an empty string. Simplify the callers by returning NULL instead of an allocated empty string. This fixes several memory leaks.
2008-11-07disable more features with --enable-miniMax Kellermann1-0/+8
Disable lots of smaller features which don't have a separate configure option: - xterm title - screen list - horizontal scrolling - MPD version number check - key binding checks - character set conversion - bitrate display - highlighting in the file browser - completion / history
2008-10-06wreadln: support wide charactersMax Kellermann1-17/+190
wreadln() didn't distinguish narrow from wide characters, which resulted in display corruption. This patch adds a lot of internal conversions between byte positions, screen positions and character position, which hopefully fixes all these bugs. Since these conversions are quite expensive, the code should be revised and optimized.
2008-10-06wreadln: wait for complete multibyte sequence in wreadln_insert_byte()Max Kellermann1-0/+54
For multibyte input, we should use wget_wch(), but this function isn't supported properly on some platforms. Add a patch which completes a multibyte character with multiple non-blocking reads. We'll see how portable this hack is...
2008-10-06wreadln: don't use cursor_move_right() in insert_byte()Max Kellermann1-1/+4
After a byte has been inserted, move the cursor right by just one byte, not one character. The byte may have been the first one in a multibyte character.
2008-10-06wreadln: optimize wreadln_delete_char() with memmove()Max Kellermann1-3/+4
Let memmove() do the dirty work on overlapping buffers..
2008-10-06wreadln: moved code to wreadln_delete()Max Kellermann1-7/+16
Remove some more clutter from wreadln() by merging the duplicate character deletion code to wreadln_delete_char().
2008-10-06wreadln: return early from cursor movement functionsMax Kellermann1-11/+13
Unclutter these functions by removing one indent level.
2008-10-06wreadln: use unsigned integers and size_tMax Kellermann1-13/+14
Declare all screen position variables as "unsigned", and all buffer positions as "size_t". We don't need signed values.
2008-10-06wreadln: use memcpy() for both casesMax Kellermann1-11/+6
Use memcpy() even when the cursor is at the end. It copies only the trailing null terminator in this case. The constant "length" is declared here in preparation for the "wide character" patches.
2008-10-06wreadln: use memmove() instead of an temporary bufferMax Kellermann1-7/+2
memmove() handles overlapping buffers well, we can use it to get room for the inserted character.
2008-10-06wreadln: moved code to insert_byte()Max Kellermann1-19/+25
Remove some clutter from wreadln(), isolate some code into a function.
2008-10-06wreadln: static bufferMax Kellermann1-18/+11
Since the buffer size is already known at compile time, don't do a second malloc() for it, declare it statically in struct wreadln. This way, it is going to be allocated on the stack.
2008-10-06wreadln: added struct wreadlnMax Kellermann1-94/+111
Don't pass a dozen of parameters to all internal functions; pass a pointer to the wreadln struct instead.
2008-10-06wreadln: removed parameter "x1"Max Kellermann1-15/+11
Several internal functions calculate the width of the input field by subtracting "x0" from "x1", although the width is already being passed to them. Eliminate the parameter "x1" in all functions, and use "width" instead.
2008-10-06wreadln: convert public globals to local constantsMax Kellermann1-5/+6
Convert wrln_max_line_size and wrln_max_history_length to local constants. They have no real use outside of wreadln.c.
2008-10-06wreadln: import screen_bell() from screen_utils.hMax Kellermann1-3/+1
Don't use "extern" outside of the headers, include the proper header instead.
2008-10-06code style, indent with tabs XIIMax Kellermann1-60/+57
Follow the same code style als MPD itself.
2008-10-06removed my_wgetch(), switch to wgetch()Max Kellermann1-5/+1
There are no special cases left for my_wgetch() to handle. We can remove it and use the original wgetch() instead.
2008-10-06wreadln: removed the disabled ncursesw codeMax Kellermann1-384/+0
The wide character version of wreadln() is currently a non-functional mess. Remove it for now, I will reimplement that later.
2008-10-03removed KEY_RESIZEMax Kellermann1-22/+0
Since we are handling SIGWINCH, we do not need to handle KEY_RESIZE from ncurses. Remove it.
2008-10-03code style, indent with tabs XIMax Kellermann1-3/+1
Follow the same code style als MPD itself.
2008-10-02charset: renamed my_strlen() to utf8_width()Max Kellermann1-3/+3
my_strlen() is a bad name for the function, since the return value is not a length, but a visible width on the screen. Rename it to utf8_width() and change its return type to "unsigned".
2008-10-02moved code to charset.cMax Kellermann1-3/+2
Move everything which deals with UTF-8 strings and character set conversion to charset.c, header charset.h.
2008-09-25fix miscellaneous sparse warningsMax Kellermann1-1/+1
Static variables, pointers vs integers, void function returning, ...
2008-09-21wreadln: adding additional line editing bindsJ. Alexander Treuman1-1/+9
Adding some GNU readline-style binds. These are ^B/^F to move the cursor back/forward, and ^N/^P to go to the next/previous line.
2008-09-15use size_t and unsigned integersMax Kellermann1-2/+3
2008-09-15include cleanupMax Kellermann1-2/+2
A header should include all headers which he needs. Move local includes on top, and let foo.c include foo.h in the first line, to automatically test its dependencies.
2008-09-15fix function prototypesMax Kellermann1-2/+2
Add missing prototypes, and fix wrong prototypes. Convert lots of functions to "static" when they are only used within the current source file.
2008-09-15const pointersMax Kellermann1-8/+8
Convert pointers to const whenever it is possible. Fixes all those -Wconst warnings.
2008-09-15code style, indent with tabsMax Kellermann1-294/+269
Follow the same code style als MPD itself. This patch only fixes parts of the code which are going to be touched in the following bunch of patches, i.e. there will be more "code style" patches in the future.
2008-09-15remove unused static functionsMax Kellermann1-8/+6
Also remove some commented code and unused function parameters.
2007-08-26fixed 0001496Andreas Obergrusberger1-0/+13
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@6817 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-08-26Removed nested functionsAndreas Obergrusberger1-145/+217
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@6811 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-09-07due to bensonk's demand i added a splash screen.Andreas Obergrusberger1-6/+32
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@4741 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-05translation updates, template and german. another little build fixAndreas Obergrusberger1-0/+1
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@4562 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-28fixed TAB completion support with libcursesw (path from René van Bevern)Kalle Wallin1-0/+27
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3957 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-01-22Backspace fix (wide-char version)Kalle Wallin1-0/+11
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3858 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-01-22Added wide-char versionKalle Wallin1-3/+313
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3857 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-06-11support wide-char ncurses library (ncursesw)Kalle Wallin1-3/+4
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3325 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-07-13Use glib's str functions (g_strlcat, g_strlcpy, g_snprintf, g_strdup_vprintf)Kalle Wallin1-24/+26
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1868 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-07-13Use my_wgetch() instead of wgetch(), added --[no-]mouse optionKalle Wallin1-13/+6
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1864 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-07-12Support SIGSTOP, SIGCONT in raw modeKalle Wallin1-0/+6
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1858 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-07-03Ignore mouse events in wreadln, screen_getchKalle Wallin1-2/+5
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1778 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-22added screen_bell() for optional audible/visible bellsKalle Wallin1-2/+3
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1612 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-19try to complete even if the line is emptyKalle Wallin1-1/+1
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1566 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-18Added completion stuffKalle Wallin1-1/+7
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1556 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-06Added wreadln.c, wreadln.h a simple line editorKalle Wallin1-0/+339
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1351 09075e82-0dd4-0310-85a5-a0d7c8717e4f