Use ncursesw in order to get correct utf8 handling

This commit is contained in:
Maxime Coste 2013-02-26 14:05:16 +01:00
parent dc7227b983
commit 9b3bc8523b
3 changed files with 4 additions and 6 deletions

View File

@ -3,7 +3,7 @@ objects := $(sources:.cc=.o)
deps := $(addprefix ., $(sources:.cc=.d)) deps := $(addprefix ., $(sources:.cc=.d))
CXXFLAGS += -std=c++0x -g -Wall -Wno-reorder -Wno-sign-compare CXXFLAGS += -std=c++0x -g -Wall -Wno-reorder -Wno-sign-compare
LDFLAGS += -lmenu -lncurses -lboost_regex LDFLAGS += -lmenu -lncursesw -lboost_regex
kak : $(objects) kak : $(objects)
$(CXX) $(LDFLAGS) $(CXXFLAGS) $(objects) -o $@ $(CXX) $(LDFLAGS) $(CXXFLAGS) $(objects) -o $@

View File

@ -138,9 +138,7 @@ using Utf8Policy = utf8::InvalidBytePolicy::Pass;
using Utf8Iterator = utf8::utf8_iterator<String::iterator, Utf8Policy>; using Utf8Iterator = utf8::utf8_iterator<String::iterator, Utf8Policy>;
void addutf8str(WINDOW* win, Utf8Iterator begin, Utf8Iterator end) void addutf8str(WINDOW* win, Utf8Iterator begin, Utf8Iterator end)
{ {
assert(begin <= end); waddstr(win, std::string(begin.underlying_iterator(), end.underlying_iterator()).c_str());
while (begin != end)
waddch(win, *begin++);
} }
static DisplayCoord window_size(WINDOW* win) static DisplayCoord window_size(WINDOW* win)

View File

@ -1,8 +1,8 @@
#ifndef ncurses_hh_INCLUDED #ifndef ncurses_hh_INCLUDED
#define ncurses_hh_INCLUDED #define ncurses_hh_INCLUDED
#include <ncurses.h> #include <ncursesw/ncurses.h>
#include <menu.h> #include <ncursesw/menu.h>
#include "user_interface.hh" #include "user_interface.hh"
#include "display_buffer.hh" #include "display_buffer.hh"