monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] net.venge.monotone.colored-diff: 373ced57dcd94a


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone.colored-diff: 373ced57dcd94a78e29e755d6318b22732bca21c
Date: Wed, 17 Aug 2011 11:42:43 +0200 (CEST)

revision:            373ced57dcd94a78e29e755d6318b22732bca21c
date:                2011-04-14T21:12:50
author:              Richard Hopkins <address@hidden>
branch:              net.venge.monotone.colored-diff
changelog:
New static method colorizer::output

The idea for this line of development is that the colorizer instance
handles colorizing purely by ANSI codes with

colorizer color;
string s;
s = color.colorize("pay the bills", colorizer::important);

then, the output to the display is handled via this new "output" method.

colorizer::output(cout, s);

This way, only output should need porting to Win32. It would need to split
the string into ANSI codes, then call the Windows API to change color and
output the string until the next ANSI code.

The other line of development (928bc8cc009980fb629a768dbbe01cc6f80c115e)
has come stuck with "mtn log --graph --colorize" due to all intermediate
output going through the colorizer to the display.

manifest:
format_version "1"

new_manifest [874ad4829fbdcd2ef9217283bd55842fd22942a9]

old_revision [fdfc6375fce1926cec52bfcdcd22f7e47e6871b8]

patch "src/colorizer.cc"
 from [60d92fa4ddcb041736a59baad40b79520b1fab2f]
   to [f80423c70b22a0f78074122462bf398524f28f9f]

patch "src/colorizer.hh"
 from [2d607068a3b3c98668efcf03d2b320793c69d6c6]
   to [f0b82960a0729b4978827081e15470fc0050e057]
============================================================
--- src/colorizer.cc	60d92fa4ddcb041736a59baad40b79520b1fab2f
+++ src/colorizer.cc	f80423c70b22a0f78074122462bf398524f28f9f
@@ -11,6 +11,7 @@
 #include "colorizer.hh"
 #include "platform.hh"
 
+using std::ostream;
 using std::string;
 using std::map;
 using std::make_pair;
@@ -182,6 +183,10 @@ colorizer::get_format(purpose const p) c
   return format.get<0>() + format.get<1>() + format.get<2>();
 }
 
+void colorizer::output(ostream & os, external const & in)
+{
+  os << in;
+}
 // Local Variables:
 // mode: C++
 // fill-column: 76
============================================================
--- src/colorizer.hh	2d607068a3b3c98668efcf03d2b320793c69d6c6
+++ src/colorizer.hh	f0b82960a0729b4978827081e15470fc0050e057
@@ -12,6 +12,7 @@
 
 #include "lua_hooks.hh"
 #include "vocab.hh"
+#include <iosfwd>
 #include <map>
 #include <boost/tuple/tuple.hpp>
 
@@ -39,6 +40,8 @@ struct colorizer {
   std::string
   colorize(std::string const & in, purpose p = normal) const;
 
+  static void
+  output(std::ostream & os, external const & in);
 private:
   std::map<purpose, boost::tuple<std::string, std::string, std::string> >
     colormap;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]