This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/help-cmd in repository x2goclient. commit d3ff608ca531707131687dcc55bc281d07224764 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Apr 22 21:47:19 2015 +0200 help.cpp: fix splitting algorithm to step over a space character, but include hyphens correctly into the current line. --- debian/changelog | 2 ++ src/help.cpp | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8c447f3..9396918 100644 --- a/debian/changelog +++ b/debian/changelog @@ -277,6 +277,8 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low - help.cpp: clear current string if completely written onto one line. - help.cpp: enable debugging for pretty_print(). --debug must be supplied before --help for this to work. + - help.cpp: fix splitting algorithm to step over a space character, but + include hyphens correctly into the current line. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/help.cpp b/src/help.cpp index ff8dc99..8a7a715 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -221,8 +221,12 @@ QString help::pretty_print (help::data_t data) { } else { /* Try to find the next split point. */ - std::ptrdiff_t split_point_white = working_copy.lastIndexOf (" ", remaining); - std::ptrdiff_t split_point_hyphen = working_copy.lastIndexOf ("-", remaining); + std::ptrdiff_t split_point_white = working_copy.lastIndexOf (" ", remaining - 1); + std::ptrdiff_t split_point_hyphen = working_copy.lastIndexOf ("-", remaining - 1); + + /* Make sure the hyphen is part of the current line. */ + ++split_point_hyphen; + std::ptrdiff_t split_point = std::max (split_point_white, split_point_hyphen); if (-1 == split_point) { @@ -232,14 +236,11 @@ QString help::pretty_print (help::data_t data) { } else { /* Yay, we can split. */ + x2goDebug << "Split onto " << working_copy.left (split_point); out << working_copy.left (split_point); - /* If we split at a hyphen, don't lose it. */ - if (working_copy.at (split_point) == '-') { - out << "-"; - } - - working_copy = working_copy.mid (split_point); + x2goDebug << " and new part " << working_copy.mid (split_point + 1); + working_copy = working_copy.mid (split_point + 1); /* Do the next chunk, if there are remaining characters. */ if (!working_copy.isEmpty ()) { -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git