Implement taglist.wrap
authorJack Miller <jack@codezen.org>
Thu, 3 Aug 2017 04:26:32 +0000 (23:26 -0500)
committerJack Miller <jack@codezen.org>
Thu, 3 Aug 2017 04:26:32 +0000 (23:26 -0500)
canto_curses/config.py
canto_curses/story.py

index 5526a9c..28c317c 100644 (file)
@@ -48,7 +48,7 @@ eval_settings = [\
     ".*\\.window\\.(maxwidth|maxheight|float)",
     "color\\..*", "tag.(enumerated|collapsed|extra_tags)",
     "reader.(enumerate_links|show_description|show_enclosures)",
-    "taglist.(border|tags_enumerated|tags_enumerated_absolute|hide_empty_tags|search_attributes)",
+    "taglist.(border|wrap|tags_enumerated|tags_enumerated_absolute|hide_empty_tags|search_attributes)",
     "taglist.cursor.edge",
     "story.(format_attrs|enumerated)"
 ]
@@ -143,6 +143,7 @@ class CantoCursesConfig(SubThread):
                 "search_attributes" : self.validate_string_list,
                 "cursor" : self.validate_taglist_cursor,
                 "border" : self.validate_bool,
+                "wrap" : self.validate_bool,
             },
 
             "story" :
@@ -246,6 +247,7 @@ class CantoCursesConfig(SubThread):
                 "tags_enumerated_absolute" : False,
                 "hide_empty_tags" : True,
                 "border" : False,
+                "wrap" : True,
                 "search_attributes" : [ "title" ],
 
                 "key" :
index 22cc81d..0f229f1 100644 (file)
@@ -122,7 +122,7 @@ class Story(PluginHandler):
         self.need_redraw()
 
     def on_opt_change(self, config):
-        if "taglist" in config and "border" in config["taglist"]:
+        if "taglist" in config and ("border" in config["taglist"] or "wrap" in config["taglist"]):
             self.need_redraw()
 
         if "color" in config or "style" in config:
@@ -343,6 +343,9 @@ class Story(PluginHandler):
         self.changed = False
 
         self.lns = self.render(FakePad(width), width)
+        if (not taglist_conf["wrap"]) and self.lns:
+            self.lns = 1
+
         return self.lns
 
     def pads(self, width):