This repository has been archived by the owner on Oct 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Defer text wrapping until the very end (#256)
This lets us handle wrapping in one single place instead of smearing it all over HTML renderer and listformatter. HTML renderer now signals how it wants a string formatted—it can be either wrappable or non-wrappable—and textformatter does the actual wrapping.
- Loading branch information
Showing
14 changed files
with
735 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef TEXTFORMATTER__H | ||
#define TEXTFORMATTER__H | ||
|
||
#include <climits> | ||
#include <vector> | ||
#include <string> | ||
#include <utility> | ||
#include <regexmanager.h> | ||
|
||
namespace newsbeuter { | ||
|
||
enum LineType { | ||
wrappable = 1, | ||
nonwrappable, | ||
hr | ||
}; | ||
|
||
class textformatter { | ||
|
||
public: | ||
textformatter(); | ||
~textformatter(); | ||
void add_line(LineType type, std::string line); | ||
void add_lines( | ||
const std::vector<std::pair<LineType, std::string>> lines); | ||
std::string format_text_to_list(regexmanager * r = NULL, | ||
const std::string& location = "", | ||
const size_t width = 80); | ||
std::string format_text_plain(const size_t width = 80); | ||
|
||
inline void clear() { | ||
lines.clear(); | ||
} | ||
private: | ||
std::vector<std::pair<LineType, std::string>> lines; | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
newsbeuter.cpp src/cache.cpp src/htmlrenderer.cpp src/urlreader.cpp src/logger.cpp src/view.cpp src/controller.cpp src/reloadthread.cpp src/tagsouppullparser.cpp src/downloadthread.cpp src/rss.cpp src/rss_parser.cpp src/formaction.cpp src/feedlist_formaction.cpp src/itemlist_formaction.cpp src/itemview_formaction.cpp src/help_formaction.cpp src/filebrowser_formaction.cpp src/urlview_formaction.cpp src/select_formaction.cpp src/history.cpp src/filtercontainer.cpp src/listformatter.cpp src/regexmanager.cpp src/dialogs_formaction.cpp src/ttrss_api.cpp src/ttrss_urlreader.cpp src/newsblur_api.cpp src/newsblur_urlreader.cpp src/markreadthread.cpp src/oldreader_urlreader.cpp src/oldreader_api.cpp src/feedhq_api.cpp src/feedhq_urlreader.cpp | ||
newsbeuter.cpp src/cache.cpp src/htmlrenderer.cpp src/urlreader.cpp src/logger.cpp src/view.cpp src/controller.cpp src/reloadthread.cpp src/tagsouppullparser.cpp src/downloadthread.cpp src/rss.cpp src/rss_parser.cpp src/formaction.cpp src/feedlist_formaction.cpp src/itemlist_formaction.cpp src/itemview_formaction.cpp src/help_formaction.cpp src/filebrowser_formaction.cpp src/urlview_formaction.cpp src/select_formaction.cpp src/history.cpp src/filtercontainer.cpp src/listformatter.cpp src/regexmanager.cpp src/dialogs_formaction.cpp src/ttrss_api.cpp src/ttrss_urlreader.cpp src/newsblur_api.cpp src/newsblur_urlreader.cpp src/markreadthread.cpp src/oldreader_urlreader.cpp src/oldreader_api.cpp src/feedhq_api.cpp src/feedhq_urlreader.cpp src/textformatter.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.