summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tabs.py5
-rw-r--r--src/windows.py30
2 files changed, 31 insertions, 4 deletions
diff --git a/src/tabs.py b/src/tabs.py
index 78663419..8760abe8 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -2589,9 +2589,14 @@ class XMLTab(Tab):
self.key_func['^I'] = self.completion
self.key_func["KEY_DOWN"] = self.on_scroll_down
self.key_func["KEY_UP"] = self.on_scroll_up
+ self.key_func["^K"] = self.on_freeze
self.key_func["/"] = self.on_slash
self.resize()
+ def on_freeze(self):
+ self.text_win.toggle_lock()
+ self.refresh()
+
def on_slash(self):
"""
'/' is pressed, activate the input
diff --git a/src/windows.py b/src/windows.py
index b8d276f0..5b48f052 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -607,6 +607,22 @@ class TextWin(Win):
self.pos = 0
self.built_lines = [] # Each new message is built and kept here.
# on resize, we rebuild all the messages
+ self.lock = False
+ self.lock_buffer = []
+
+ def toggle_lock(self):
+ if self.lock:
+ self.release_lock()
+ else:
+ self.acquire_lock()
+
+ def acquire_lock(self):
+ self.lock = True
+
+ def release_lock(self):
+ for line in self.lock_buffer:
+ self.built_lines.append(line)
+ self.lock = False
def scroll_up(self, dist=14):
self.pos += dist
@@ -668,10 +684,16 @@ class TextWin(Win):
if get_theme().CHAR_TIME_RIGHT:
offset += 1
lines = cut_text(txt, self.width-offset)
- for line in lines:
- self.built_lines.append(Line(msg=message,
- start_pos=line[0],
- end_pos=line[1]))
+ if self.lock:
+ for line in lines:
+ self.lock_buffer.append(Line(msg=message,
+ start_pos=line[0],
+ end_pos=line[1]))
+ else:
+ for line in lines:
+ self.built_lines.append(Line(msg=message,
+ start_pos=line[0],
+ end_pos=line[1]))
if clean:
while len(self.built_lines) > self.lines_nb_limit:
self.built_lines.pop(0)