aboutsummaryrefslogtreecommitdiffstats
path: root/src/wreadln.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* wreadln: support wide charactersMax Kellermann2008-10-061-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.
* wreadln: wait for complete multibyte sequence in wreadln_insert_byte()Max Kellermann2008-10-061-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...
* wreadln: don't use cursor_move_right() in insert_byte()Max Kellermann2008-10-061-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.
* wreadln: optimize wreadln_delete_char() with memmove()Max Kellermann2008-10-061-3/+4
| | | | Let memmove() do the dirty work on overlapping buffers..
* wreadln: moved code to wreadln_delete()Max Kellermann2008-10-061-7/+16
| | | | | Remove some more clutter from wreadln() by merging the duplicate character deletion code to wreadln_delete_char().
* wreadln: return early from cursor movement functionsMax Kellermann2008-10-061-11/+13
| | | | Unclutter these functions by removing one indent level.
* wreadln: use unsigned integers and size_tMax Kellermann2008-10-061-13/+14
| | | | | Declare all screen position variables as "unsigned", and all buffer positions as "size_t". We don't need signed values.
* wreadln: use memcpy() for both casesMax Kellermann2008-10-061-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.
* wreadln: use memmove() instead of an temporary bufferMax Kellermann2008-10-061-7/+2
| | | | | memmove() handles overlapping buffers well, we can use it to get room for the inserted character.
* wreadln: moved code to insert_byte()Max Kellermann2008-10-061-19/+25
| | | | Remove some clutter from wreadln(), isolate some code into a function.
* wreadln: static bufferMax Kellermann2008-10-061-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.
* wreadln: added struct wreadlnMax Kellermann2008-10-061-94/+111
| | | | | Don't pass a dozen of parameters to all internal functions; pass a pointer to the wreadln struct instead.
* wreadln: removed parameter "x1"Max Kellermann2008-10-061-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.
* wreadln: convert public globals to local constantsMax Kellermann2008-10-061-5/+6
| | | | | Convert wrln_max_line_size and wrln_max_history_length to local constants. They have no real use outside of wreadln.c.
* wreadln: import screen_bell() from screen_utils.hMax Kellermann2008-10-061-3/+1
| | | | | Don't use "extern" outside of the headers, include the proper header instead.
* code style, indent with tabs XIIMax Kellermann2008-10-061-60/+57
| | | | Follow the same code style als MPD itself.
* removed my_wgetch(), switch to wgetch()Max Kellermann2008-10-061-5/+1
| | | | | There are no special cases left for my_wgetch() to handle. We can remove it and use the original wgetch() instead.
* wreadln: removed the disabled ncursesw codeMax Kellermann2008-10-061-384/+0
| | | | | The wide character version of wreadln() is currently a non-functional mess. Remove it for now, I will reimplement that later.
* removed KEY_RESIZEMax Kellermann2008-10-031-22/+0
| | | | | Since we are handling SIGWINCH, we do not need to handle KEY_RESIZE from ncurses. Remove it.
* code style, indent with tabs XIMax Kellermann2008-10-031-3/+1
| | | | Follow the same code style als MPD itself.
* charset: renamed my_strlen() to utf8_width()Max Kellermann2008-10-021-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".
* moved code to charset.cMax Kellermann2008-10-021-3/+2
| | | | | Move everything which deals with UTF-8 strings and character set conversion to charset.c, header charset.h.
* fix miscellaneous sparse warningsMax Kellermann2008-09-251-1/+1
| | | | Static variables, pointers vs integers, void function returning, ...
* wreadln: adding additional line editing bindsJ. Alexander Treuman2008-09-211-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.
* use size_t and unsigned integersMax Kellermann2008-09-151-2/+3
|
* include cleanupMax Kellermann2008-09-151-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.
* fix function prototypesMax Kellermann2008-09-151-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.
* const pointersMax Kellermann2008-09-151-8/+8
| | | | | Convert pointers to const whenever it is possible. Fixes all those -Wconst warnings.
* code style, indent with tabsMax Kellermann2008-09-151-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.
* remove unused static functionsMax Kellermann2008-09-151-8/+6
| | | | Also remove some commented code and unused function parameters.
* fixed 0001496Andreas Obergrusberger2007-08-261-0/+13
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@6817 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Removed nested functionsAndreas Obergrusberger2007-08-261-145/+217
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@6811 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* due to bensonk's demand i added a splash screen.Andreas Obergrusberger2006-09-071-6/+32
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@4741 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* translation updates, template and german. another little build fixAndreas Obergrusberger2006-08-051-0/+1
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@4562 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fixed TAB completion support with libcursesw (path from René van Bevern)Kalle Wallin2006-03-281-0/+27
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3957 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Backspace fix (wide-char version)Kalle Wallin2006-01-221-0/+11
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3858 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Added wide-char versionKalle Wallin2006-01-221-3/+313
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3857 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* support wide-char ncurses library (ncursesw)Kalle Wallin2005-06-111-3/+4
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3325 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Use glib's str functions (g_strlcat, g_strlcpy, g_snprintf, g_strdup_vprintf)Kalle Wallin2004-07-131-24/+26
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1868 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Use my_wgetch() instead of wgetch(), added --[no-]mouse optionKalle Wallin2004-07-131-13/+6
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1864 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Support SIGSTOP, SIGCONT in raw modeKalle Wallin2004-07-121-0/+6
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1858 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Ignore mouse events in wreadln, screen_getchKalle Wallin2004-07-031-2/+5
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1778 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* added screen_bell() for optional audible/visible bellsKalle Wallin2004-06-221-2/+3
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1612 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* try to complete even if the line is emptyKalle Wallin2004-06-191-1/+1
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1566 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Added completion stuffKalle Wallin2004-06-181-1/+7
| | | | git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1556 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Added wreadln.c, wreadln.h a simple line editorKalle Wallin2004-06-061-0/+339
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1351 09075e82-0dd4-0310-85a5-a0d7c8717e4f