about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/defaults/keys.py3
-rw-r--r--ranger/gui/defaultui.py20
-rw-r--r--ranger/gui/displayable.py23
-rw-r--r--ranger/gui/widgets/filelist.py10
-rw-r--r--ranger/gui/widgets/filelistcontainer.py4
-rw-r--r--ranger/gui/widgets/notify.py6
6 files changed, 46 insertions, 20 deletions
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index 5e764ddd..654b1c7b 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -140,6 +140,9 @@ def initialize_commands(command_list):
 	bind('!', fm.open_console(cmode.OPEN))
 	bind('r', fm.open_console(cmode.OPEN_QUICK))
 
+	def test(arg):
+		arg.fm.notify("bla")
+	bind('x', test)
 
 	# definitions which require their own function:
 	def ggG(default):
diff --git a/ranger/gui/defaultui.py b/ranger/gui/defaultui.py
index 1bb62d72..135ef0b5 100644
--- a/ranger/gui/defaultui.py
+++ b/ranger/gui/defaultui.py
@@ -21,12 +21,6 @@ class DefaultUI(UI):
 		self.add_obj(self.filelist_container)
 		self.main_filelist = self.filelist_container.main_filelist
 
-		self.status = StatusBar(self.win, self.main_filelist)
-		self.add_obj(self.status)
-		self.console = Console(self.win)
-		self.add_obj(self.console)
-		self.console.visible = False
-
 		self.pman = ProcessManager(self.win)
 		self.pman.visible = False
 		self.add_obj(self.pman)
@@ -34,6 +28,12 @@ class DefaultUI(UI):
 		self.notify = Notify(self.win)
 		self.add_obj(self.notify)
 
+		self.status = StatusBar(self.win, self.main_filelist)
+		self.add_obj(self.status)
+		self.console = Console(self.win)
+		self.add_obj(self.console)
+		self.console.visible = False
+
 		self.pager = Pager(self.win)
 		self.add_obj(self.pager)
 
@@ -44,10 +44,10 @@ class DefaultUI(UI):
 
 		notify_hei = self.notify.requested_height
 
-		self.filelist_container.resize(1, 0, y - 2 - notify_hei, x)
-		self.pman.resize(1, 0, y - 2 - notify_hei, x)
-		self.pager.resize(1, 0, y - 2 - notify_hei, x)
-		self.notify.resize(y - 1 - notify_hei, 0, notify_hei, x)
+		self.filelist_container.resize(1, 0, y - 1 - notify_hei, x)
+		self.pman.resize(1, 0, y - 1 - notify_hei, x)
+		self.pager.resize(1, 0, y - 1 - notify_hei, x)
+		self.notify.resize(y - notify_hei, 0, notify_hei, x)
 		self.titlebar.resize(0, 0, 1, x)
 		self.status.resize(y - 1, 0, 1, x)
 		self.console.resize(y - 1, 0, 1, x)
diff --git a/ranger/gui/displayable.py b/ranger/gui/displayable.py
index 62ff41f9..95645e2c 100644
--- a/ranger/gui/displayable.py
+++ b/ranger/gui/displayable.py
@@ -1,4 +1,5 @@
 from ranger.shared import FileManagerAware, EnvironmentAware, SettingsAware
+from ranger import log
 
 class Displayable(EnvironmentAware, FileManagerAware, SettingsAware):
 	focused = False
@@ -7,6 +8,7 @@ class Displayable(EnvironmentAware, FileManagerAware, SettingsAware):
 	colorscheme = None
 
 	def __init__(self, win, env=None, fm=None, settings=None):
+		from ranger.gui.ui import UI
 		if env is not None:
 			self.env = env
 		if fm is not None:
@@ -21,7 +23,10 @@ class Displayable(EnvironmentAware, FileManagerAware, SettingsAware):
 		self.colorscheme = self.settings.colorscheme
 
 		if win is not None:
-			self.win = win
+			if isinstance(self, UI):
+				self.win = win
+			else:
+				self.win = win.derwin(1, 1, 0, 0)
 
 	def __nonzero__(self):
 		"""Always True"""
@@ -123,6 +128,9 @@ class Displayable(EnvironmentAware, FileManagerAware, SettingsAware):
 			if x < 0 or y < 0:
 				raise OutOfBoundsException("Starting point below zero!")
 
+			if wid < 1 or hei < 1:
+				raise OutOfBoundsException("WID and HEI must be >=1!")
+
 			if x + wid > maxx and y + hei > maxy:
 				raise OutOfBoundsException("X and Y out of bounds!")
 
@@ -132,8 +140,17 @@ class Displayable(EnvironmentAware, FileManagerAware, SettingsAware):
 			if y + hei > maxy:
 				raise OutOfBoundsException("Y out of bounds!")
 
-		self.x = x
-		self.y = y
+		try:
+			self.win.resize(max(1,hei), wid)
+		except:
+			log(self.__class__)
+			log("failed to resize {0}x{1}  {2}x{3}".format(y,x,hei,wid))
+		log("moving {2} to {0}x{1}".format(y, x, self.__class__.__name__))
+		self.win.mvderwin(y, x)
+		self.absx = x
+		self.absy = x
+		self.x = 0
+		self.y = 0
 		self.wid = wid
 		self.hei = hei
 
diff --git a/ranger/gui/widgets/filelist.py b/ranger/gui/widgets/filelist.py
index d8fc1073..6af13944 100644
--- a/ranger/gui/widgets/filelist.py
+++ b/ranger/gui/widgets/filelist.py
@@ -217,13 +217,19 @@ class FileList(Widget, DisplayableContainer):
 					self.win.addnstr(self.y + line, self.x + 1,
 							text, self.wid - 2)
 			else:
-				self.win.addnstr(self.y + line, self.x, text, self.wid)
+				try:
+					self.win.addnstr(self.y + line, self.x, text, self.wid)
+				except:
+					break
 
 			if self.display_infostring and drawed.infostring:
 				info = drawed.infostring
 				x = self.x + self.wid - 1 - len(info)
 				if x > self.x:
-					self.win.addstr(self.y + line, x, str(info) + ' ')
+					try:
+						self.win.addstr(self.y + line, x, str(info) + ' ')
+					except:
+						break
 
 			self.color_at(self.y + line, self.x, self.wid, this_color)
 
diff --git a/ranger/gui/widgets/filelistcontainer.py b/ranger/gui/widgets/filelistcontainer.py
index 494a3e0f..f50ea7cb 100644
--- a/ranger/gui/widgets/filelistcontainer.py
+++ b/ranger/gui/widgets/filelistcontainer.py
@@ -29,7 +29,7 @@ class FileListContainer(Widget, DisplayableContainer):
 		if preview: offset += 1
 
 		for level in range(len(ratios)):
-			fl = FileList(win, level + offset)
+			fl = FileList(self.win, level + offset)
 			self.add_obj(fl)
 
 		try:
@@ -40,7 +40,7 @@ class FileListContainer(Widget, DisplayableContainer):
 			self.main_filelist.display_infostring = True
 			self.main_filelist.main_display = True
 
-		self.pager = Pager(win, embedded=True)
+		self.pager = Pager(self.win, embedded=True)
 		self.add_obj(self.pager)
 	
 	def resize(self, y, x, hei, wid):
diff --git a/ranger/gui/widgets/notify.py b/ranger/gui/widgets/notify.py
index bb159ea7..ea35700f 100644
--- a/ranger/gui/widgets/notify.py
+++ b/ranger/gui/widgets/notify.py
@@ -5,7 +5,7 @@ from time import time
 from collections import deque
 
 class Notify(Widget):
-	requested_height = 0
+	requested_height = 1
 	max_size = 5
 	textcontainer = None
 
@@ -19,7 +19,7 @@ class Notify(Widget):
 			if msg.elapse and time() > msg.elapse:
 				msg.alive = False
 				del self.textcontainer[i]
-		self.requested_height = len(self.textcontainer)
+		self.requested_height = len(self.textcontainer) + 1
 
 	def draw(self):
 		import curses, socket, os
@@ -27,7 +27,7 @@ class Notify(Widget):
 
 		i = 0
 		for msg in self.textcontainer:
-			if i >= self.hei:
+			if i >= self.hei - 1:
 				break
 
 			how = msg.bad and 'bad' or 'good'
ter Drew DeVault <sir@cmpwn.com> 2019-07-08 18:19:08 -0400 Add :exec and :pipe -b(ackground)' href='/akspecs/aerc/commit/commands/msg/pipe.go?h=0.5.0&id=7ecc6f96de5864d76ea2a94123b11c9258791cc9'>7ecc6f9 ^
363aab5 ^

8bb115d ^


217e85a ^



05fa79e ^
7ecc6f9 ^
05fa79e ^
7ecc6f9 ^
05fa79e ^
7ecc6f9 ^
363aab5 ^
363aab5 ^


df20f1c ^
13a6a3f ^
7ecc6f9 ^





363aab5 ^
363aab5 ^




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141