| Commit message (Collapse) | Author | Files | Lines |
|
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.
|
|
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
|
|
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.
|
|
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...
|
|
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.
|
|
Let memmove() do the dirty work on overlapping buffers..
|
|
Remove some more clutter from wreadln() by merging the duplicate
character deletion code to wreadln_delete_char().
|
|
Unclutter these functions by removing one indent level.
|
|
Declare all screen position variables as "unsigned", and all buffer
positions as "size_t". We don't need signed values.
|
|
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.
|
|
memmove() handles overlapping buffers well, we can use it to get room
for the inserted character.
|
|
Remove some clutter from wreadln(), isolate some code into a function.
|
|
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.
|
|
Don't pass a dozen of parameters to all internal functions; pass a
pointer to the wreadln struct instead.
|
|
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.
|
|
Convert wrln_max_line_size and wrln_max_history_length to local
constants. They have no real use outside of wreadln.c.
|
|
Don't use "extern" outside of the headers, include the proper header
instead.
|
|
Follow the same code style als MPD itself.
|
|
There are no special cases left for my_wgetch() to handle. We can
remove it and use the original wgetch() instead.
|
|
The wide character version of wreadln() is currently a non-functional
mess. Remove it for now, I will reimplement that later.
|
|
Since we are handling SIGWINCH, we do not need to handle KEY_RESIZE
from ncurses. Remove it.
|
|
Follow the same code style als MPD itself.
|
|
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".
|
|
Move everything which deals with UTF-8 strings and character set
conversion to charset.c, header charset.h.
|
|
Static variables, pointers vs integers, void function returning, ...
|
|
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.
|
|
|
|
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.
|
|
Add missing prototypes, and fix wrong prototypes. Convert lots of
functions to "static" when they are only used within the current
source file.
|
|
Convert pointers to const whenever it is possible. Fixes all those
-Wconst warnings.
|
|
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.
|
|
Also remove some commented code and unused function parameters.
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@6817 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@6811 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@4741 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@4562 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3957 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3858 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3857 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3325 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1868 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1864 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1858 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1778 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1612 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1566 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1556 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1351 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|