- Merged libexpr changes.
This commit is contained in:
Paul Beckingham 2014-01-02 00:26:10 -05:00
parent 2c2e94bb0f
commit 57106c86a9
3 changed files with 14 additions and 6 deletions

View file

@ -1,7 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2013 - 2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -25,6 +24,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <string>
#include <text.h>
#include <utf8.h>
@ -78,6 +78,9 @@ unsigned int utf8_codepoint (const std::string& input)
// - returns the next character
unsigned int utf8_next_char (const std::string& input, std::string::size_type& i)
{
if (input[i] == '\0')
return 0;
// How many bytes in the sequence?
int length = utf8_sequence (input[i]);

View file

@ -1,7 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2013 - 2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -40,6 +39,7 @@ unsigned int utf8_width (const std::string& str);
unsigned int utf8_text_width (const std::string&);
const std::string utf8_substr (const std::string&, unsigned int, unsigned int length = 0);
int mk_wcwidth (wchar_t);
#endif
////////////////////////////////////////////////////////////////////////////////

View file

@ -1,7 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
// Copyright 2006 - 2014, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -25,7 +24,9 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <iostream>
#include <stdlib.h>
#include <utf8.h>
#include <test.h>
@ -34,6 +35,10 @@ int main (int argc, char** argv)
{
UnitTest t (17);
// Ensure environment has no influence.
unsetenv ("TASKDATA");
unsetenv ("TASKRC");
std::string ascii_text = "This is a test";
std::string utf8_text = "más sábado miércoles";
std::string utf8_wide_text = "改变各种颜色";