diff options
author | Melanie | 2010-01-16 00:05:08 +0000 |
---|---|---|
committer | Melanie | 2010-01-16 00:05:08 +0000 |
commit | 10f8c2ea9b67158c32b361f9652d503ea48de292 (patch) | |
tree | be0d88bc4b6df3825a0d27f62a08170d7c7ad262 /OpenSim/Framework/Console | |
parent | Merge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/open... (diff) | |
parent | Add "create user" instructions to README.txt (diff) | |
download | opensim-SC_OLD-10f8c2ea9b67158c32b361f9652d503ea48de292.zip opensim-SC_OLD-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.gz opensim-SC_OLD-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.bz2 opensim-SC_OLD-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.xz |
Merge branch 'master' into presence-refactor
This merge was very conflicted. I think I got them all, but I can't be sure.
I had to merge to master or risk divergence to the point of unmergeability.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Console/CommandConsole.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/Console/LocalConsole.cs | 106 |
2 files changed, 79 insertions, 35 deletions
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index 9671bc2..66f483c 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs | |||
@@ -552,8 +552,9 @@ namespace OpenSim.Framework.Console | |||
552 | } | 552 | } |
553 | } | 553 | } |
554 | 554 | ||
555 | // A console that processes commands internally | 555 | /// <summary> |
556 | // | 556 | /// A console that processes commands internally |
557 | /// </summary> | ||
557 | public class CommandConsole : ConsoleBase | 558 | public class CommandConsole : ConsoleBase |
558 | { | 559 | { |
559 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 560 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -574,6 +575,9 @@ namespace OpenSim.Framework.Console | |||
574 | Output(s); | 575 | Output(s); |
575 | } | 576 | } |
576 | 577 | ||
578 | /// <summary> | ||
579 | /// Display a command prompt on the console and wait for user input | ||
580 | /// </summary> | ||
577 | public void Prompt() | 581 | public void Prompt() |
578 | { | 582 | { |
579 | string line = ReadLine(m_defaultPrompt + "# ", true, true); | 583 | string line = ReadLine(m_defaultPrompt + "# ", true, true); |
diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index 39edd2a..b7e191b 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs | |||
@@ -36,8 +36,9 @@ using log4net; | |||
36 | 36 | ||
37 | namespace OpenSim.Framework.Console | 37 | namespace OpenSim.Framework.Console |
38 | { | 38 | { |
39 | // A console that uses cursor control and color | 39 | /// <summary> |
40 | // | 40 | /// A console that uses cursor control and color |
41 | /// </summary> | ||
41 | public class LocalConsole : CommandConsole | 42 | public class LocalConsole : CommandConsole |
42 | { | 43 | { |
43 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -85,30 +86,70 @@ namespace OpenSim.Framework.Console | |||
85 | history.Add(text); | 86 | history.Add(text); |
86 | } | 87 | } |
87 | 88 | ||
89 | /// <summary> | ||
90 | /// Set the cursor row. | ||
91 | /// </summary> | ||
92 | /// | ||
93 | /// <param name="top"> | ||
94 | /// Row to set. If this is below 0, then the row is set to 0. If it is equal to the buffer height or greater | ||
95 | /// then it is set to one less than the height. | ||
96 | /// </param> | ||
97 | /// <returns> | ||
98 | /// The new cursor row. | ||
99 | /// </returns> | ||
88 | private int SetCursorTop(int top) | 100 | private int SetCursorTop(int top) |
89 | { | 101 | { |
90 | if (top >= 0 && top < System.Console.BufferHeight) | 102 | // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try |
91 | { | 103 | // to set a cursor row position with a currently invalid column, mono will throw an exception. |
92 | System.Console.CursorTop = top; | 104 | // Therefore, we need to make sure that the column position is valid first. |
93 | return top; | 105 | int left = System.Console.CursorLeft; |
94 | } | 106 | |
95 | else | 107 | if (left < 0) |
96 | { | 108 | System.Console.CursorLeft = 0; |
97 | return System.Console.CursorTop; | 109 | else if (left >= System.Console.BufferWidth) |
98 | } | 110 | System.Console.CursorLeft = System.Console.BufferWidth - 1; |
111 | |||
112 | if (top < 0) | ||
113 | top = 0; | ||
114 | if (top >= System.Console.BufferHeight) | ||
115 | top = System.Console.BufferHeight - 1; | ||
116 | |||
117 | System.Console.CursorTop = top; | ||
118 | |||
119 | return top; | ||
99 | } | 120 | } |
100 | 121 | ||
122 | /// <summary> | ||
123 | /// Set the cursor column. | ||
124 | /// </summary> | ||
125 | /// | ||
126 | /// <param name="left"> | ||
127 | /// Column to set. If this is below 0, then the column is set to 0. If it is equal to the buffer width or greater | ||
128 | /// then it is set to one less than the width. | ||
129 | /// </param> | ||
130 | /// <returns> | ||
131 | /// The new cursor column. | ||
132 | /// </returns> | ||
101 | private int SetCursorLeft(int left) | 133 | private int SetCursorLeft(int left) |
102 | { | 134 | { |
103 | if (left >= 0 && left < System.Console.BufferWidth) | 135 | // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try |
104 | { | 136 | // to set a cursor column position with a currently invalid row, mono will throw an exception. |
105 | System.Console.CursorLeft = left; | 137 | // Therefore, we need to make sure that the row position is valid first. |
106 | return left; | 138 | int top = System.Console.CursorTop; |
107 | } | 139 | |
108 | else | 140 | if (top < 0) |
109 | { | 141 | System.Console.CursorTop = 0; |
110 | return System.Console.CursorLeft; | 142 | else if (top >= System.Console.BufferHeight) |
111 | } | 143 | System.Console.CursorTop = System.Console.BufferHeight - 1; |
144 | |||
145 | if (left < 0) | ||
146 | left = 0; | ||
147 | if (left >= System.Console.BufferWidth) | ||
148 | left = System.Console.BufferWidth - 1; | ||
149 | |||
150 | System.Console.CursorLeft = left; | ||
151 | |||
152 | return left; | ||
112 | } | 153 | } |
113 | 154 | ||
114 | private void Show() | 155 | private void Show() |
@@ -128,21 +169,21 @@ namespace OpenSim.Framework.Console | |||
128 | { | 169 | { |
129 | y--; | 170 | y--; |
130 | new_y--; | 171 | new_y--; |
131 | System.Console.CursorLeft = 0; | 172 | SetCursorLeft(0); |
132 | System.Console.CursorTop = System.Console.BufferHeight-1; | 173 | SetCursorTop(System.Console.BufferHeight - 1); |
133 | System.Console.WriteLine(" "); | 174 | System.Console.WriteLine(" "); |
134 | } | 175 | } |
135 | 176 | ||
136 | y=SetCursorTop(y); | 177 | y = SetCursorTop(y); |
137 | System.Console.CursorLeft = 0; | 178 | SetCursorLeft(0); |
138 | 179 | ||
139 | if (echo) | 180 | if (echo) |
140 | System.Console.Write("{0}{1}", prompt, cmdline); | 181 | System.Console.Write("{0}{1}", prompt, cmdline); |
141 | else | 182 | else |
142 | System.Console.Write("{0}", prompt); | 183 | System.Console.Write("{0}", prompt); |
143 | 184 | ||
144 | SetCursorLeft(new_x); | ||
145 | SetCursorTop(new_y); | 185 | SetCursorTop(new_y); |
186 | SetCursorLeft(new_x); | ||
146 | } | 187 | } |
147 | } | 188 | } |
148 | 189 | ||
@@ -162,8 +203,7 @@ namespace OpenSim.Framework.Console | |||
162 | System.Console.Write(" "); | 203 | System.Console.Write(" "); |
163 | 204 | ||
164 | y = SetCursorTop(y); | 205 | y = SetCursorTop(y); |
165 | System.Console.CursorLeft = 0; | 206 | SetCursorLeft(0); |
166 | |||
167 | } | 207 | } |
168 | } | 208 | } |
169 | catch (Exception) | 209 | catch (Exception) |
@@ -252,7 +292,7 @@ namespace OpenSim.Framework.Console | |||
252 | } | 292 | } |
253 | 293 | ||
254 | y = SetCursorTop(y); | 294 | y = SetCursorTop(y); |
255 | System.Console.CursorLeft = 0; | 295 | SetCursorLeft(0); |
256 | 296 | ||
257 | int count = cmdline.Length + prompt.Length; | 297 | int count = cmdline.Length + prompt.Length; |
258 | 298 | ||
@@ -260,7 +300,7 @@ namespace OpenSim.Framework.Console | |||
260 | System.Console.Write(" "); | 300 | System.Console.Write(" "); |
261 | 301 | ||
262 | y = SetCursorTop(y); | 302 | y = SetCursorTop(y); |
263 | System.Console.CursorLeft = 0; | 303 | SetCursorLeft(0); |
264 | 304 | ||
265 | WriteLocalText(text, level); | 305 | WriteLocalText(text, level); |
266 | 306 | ||
@@ -299,7 +339,7 @@ namespace OpenSim.Framework.Console | |||
299 | echo = e; | 339 | echo = e; |
300 | int historyLine = history.Count; | 340 | int historyLine = history.Count; |
301 | 341 | ||
302 | System.Console.CursorLeft = 0; // Needed for mono | 342 | SetCursorLeft(0); // Needed for mono |
303 | System.Console.Write(" "); // Needed for mono | 343 | System.Console.Write(" "); // Needed for mono |
304 | 344 | ||
305 | lock (cmdline) | 345 | lock (cmdline) |
@@ -339,7 +379,7 @@ namespace OpenSim.Framework.Console | |||
339 | cmdline.Remove(cp-1, 1); | 379 | cmdline.Remove(cp-1, 1); |
340 | cp--; | 380 | cp--; |
341 | 381 | ||
342 | System.Console.CursorLeft = 0; | 382 | SetCursorLeft(0); |
343 | y = SetCursorTop(y); | 383 | y = SetCursorTop(y); |
344 | 384 | ||
345 | System.Console.Write("{0}{1} ", prompt, cmdline); | 385 | System.Console.Write("{0}{1} ", prompt, cmdline); |
@@ -387,7 +427,7 @@ namespace OpenSim.Framework.Console | |||
387 | cp++; | 427 | cp++; |
388 | break; | 428 | break; |
389 | case ConsoleKey.Enter: | 429 | case ConsoleKey.Enter: |
390 | System.Console.CursorLeft = 0; | 430 | SetCursorLeft(0); |
391 | y = SetCursorTop(y); | 431 | y = SetCursorTop(y); |
392 | 432 | ||
393 | System.Console.WriteLine("{0}{1}", prompt, cmdline); | 433 | System.Console.WriteLine("{0}{1}", prompt, cmdline); |
@@ -424,4 +464,4 @@ namespace OpenSim.Framework.Console | |||
424 | } | 464 | } |
425 | } | 465 | } |
426 | } | 466 | } |
427 | } | 467 | } \ No newline at end of file |