Re-enable caching on search.

This commit is contained in:
Aldo Cortesi 2014-01-19 12:43:58 +13:00
parent 069aca1df4
commit f5f46bf080

View File

@ -1,4 +1,4 @@
import os, sys
import os, sys, copy
import urwid
import common, grideditor, contentview
from .. import utils, flow, controller
@ -87,9 +87,7 @@ class FlowViewHeader(common.WWrap):
class CallbackCache:
#commented decorator because it was breaking search functionality (caching after
# searches.) If it can be made to only cache the first time, it'd be great.
#@utils.LRUCache(200)
@utils.LRUCache(200)
def _callback(self, method, *args, **kwargs):
return getattr(self.obj, method)(*args, **kwargs)
@ -137,7 +135,6 @@ class FlowView(common.WWrap):
limit = sys.maxint
else:
limit = contentview.VIEW_CUTOFF
description, text_objects = cache.callback(
self, "_cached_content_view",
viewmode,
@ -145,7 +142,6 @@ class FlowView(common.WWrap):
conn.content,
limit
)
return (description, text_objects)
def cont_view_handle_missing(self, conn, viewmode):
@ -173,14 +169,12 @@ class FlowView(common.WWrap):
key = "header",
val = "text"
)
if conn.content is not None:
override = self.override_get()
viewmode = self.viewmode_get(override)
msg, body = self.cont_view_handle_missing(conn, viewmode)
elif conn.content == flow.CONTENT_MISSING:
pass
return headers, msg, body
def conn_text_merge(self, headers, msg, body):
@ -188,7 +182,6 @@ class FlowView(common.WWrap):
Grabs what is returned by conn_text_raw and merges them all
toghether, mainly used by conn_text and search
"""
override = self.override_get()
viewmode = self.viewmode_get(override)
@ -222,7 +215,6 @@ class FlowView(common.WWrap):
"""
headers, msg, body = self.conn_text_raw(conn)
merged = self.conn_text_merge(headers, msg, body)
return urwid.ListBox(merged)
def _tab(self, content, attr):
@ -350,6 +342,7 @@ class FlowView(common.WWrap):
i = start_line
found = False
text_objects = copy.deepcopy(text_objects)
for text_object in text_objects[start_line:]:
if i != start_line:
start_index = 0