This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch bugfix/help-cmd in repository x2goclient. from 462e8f2 help.h: fix run time error by actually giving QTextStream a "device" to write to. new e14d428 help.cpp: clear current string if completely written onto one line. new 5bf8eb1 help.cpp: enable debugging for pretty_print(). --debug must be supplied before --help for this to work. new 7772507 help.cpp: partly fix indenting algorithm. The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: debian/changelog | 3 +++ src/help.cpp | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
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 e14d4289905ff89064fd613e7f1e41a6dd8b021f Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Apr 22 19:15:42 2015 +0200 help.cpp: clear current string if completely written onto one line. --- debian/changelog | 1 + src/help.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/debian/changelog b/debian/changelog index bfa56c2..8849c1b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -274,6 +274,7 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low - {{onmainwindow,help}.cpp},help.h}: fix misc. build errors. - help.h: fix run time error by actually giving QTextStream a "device" to write to. + - help.cpp: clear current string if completely written onto one line. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/help.cpp b/src/help.cpp index a8caf2b..1ddb360 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -206,6 +206,7 @@ QString help::pretty_print (help::data_t data) { /* Fits onto the current line. Great! */ if (remaining > static_cast<std::ptrdiff_t> (cur_len)) { out << working_copy; + working_copy = ""; } else { /* Try to find the next split point. */ -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
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 5bf8eb18b8b7437cd34b995fc90e2372e43f43d5 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Apr 22 21:16:37 2015 +0200 help.cpp: enable debugging for pretty_print(). --debug must be supplied before --help for this to work. --- debian/changelog | 2 ++ src/help.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index 8849c1b..8c447f3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -275,6 +275,8 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low - help.h: fix run time error by actually giving QTextStream a "device" to write to. - 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. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/help.cpp b/src/help.cpp index 1ddb360..29bd246 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -36,6 +36,8 @@ #include "help.h" #include "version.h" +#include "x2gologdebug.h" +#include "onmainwindow.h" help::prelude_t help::cleanup_prelude (help::prelude_t prelude) { for (help::prelude_t::iterator it = prelude.begin (); it != prelude.end (); ++it) { @@ -179,8 +181,11 @@ QString help::pretty_print (help::data_t data) { terminal_cols = terminal_internal.ws_col; #endif + x2goDebug << "Terminal cols: " << terminal_cols << endl; + for (help::params_t::const_iterator it = data.second.constBegin (); it != data.second.constEnd (); ++it) { std::size_t indent = (max_len - (*it).first.size ()) + 4; + x2goDebug << "Indent: " << indent << "; max_len: " << max_len << "; param size: " << (*it).first.size () << endl; out << " "; out << (*it).first; out << QString (" ").repeated (indent); @@ -188,11 +193,14 @@ QString help::pretty_print (help::data_t data) { indent += 2; std::ptrdiff_t remaining = 0; std::size_t cur_len = (*it).second.size (); + x2goDebug << "Going to output a description " << (*it).second.size () << " chars wide." << endl; if (0 != terminal_cols) { remaining = terminal_cols - indent; + x2goDebug << "Still have " << remaining << " characters left on this line." << endl; /* Ran out of space? That's bad... print a newline and don't use any indentation level. */ if (0 > remaining) { + x2goDebug << "Ran out of space! Will break line and start the description on a new one." << endl; out << "\n"; remaining = terminal_cols; indent = 0; @@ -202,9 +210,11 @@ QString help::pretty_print (help::data_t data) { do { cur_len = working_copy.size (); + x2goDebug << "Trying to fit a (remaining) description " << cur_len << " characters wide." << endl; /* Fits onto the current line. Great! */ if (remaining > static_cast<std::ptrdiff_t> (cur_len)) { + x2goDebug << "Fit onto the current line. Done." << endl; out << working_copy; working_copy = ""; } -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
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 7772507d84750006689d406d10293eabe6d37ea2 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Apr 22 21:17:09 2015 +0200 help.cpp: partly fix indenting algorithm. --- src/help.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/help.cpp b/src/help.cpp index 29bd246..c538868 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -190,12 +190,13 @@ QString help::pretty_print (help::data_t data) { out << (*it).first; out << QString (" ").repeated (indent); + /* Append first two spaces to the general indent level for upcoming lines. */ indent += 2; std::ptrdiff_t remaining = 0; std::size_t cur_len = (*it).second.size (); x2goDebug << "Going to output a description " << (*it).second.size () << " chars wide." << endl; if (0 != terminal_cols) { - remaining = terminal_cols - indent; + remaining = terminal_cols - (indent + (*it).first.size ()); x2goDebug << "Still have " << remaining << " characters left on this line." << endl; /* Ran out of space? That's bad... print a newline and don't use any indentation level. */ @@ -244,6 +245,7 @@ QString help::pretty_print (help::data_t data) { if (!working_copy.isEmpty ()) { out << "\n"; out << QString (" ").repeated (indent); + indent = terminal_cols - remaining; } } } -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git