diff options
author | Paul Pazderski | 2019-03-21 20:45:02 +0000 |
---|---|---|
committer | Paul Pazderski | 2019-09-26 09:37:57 +0000 |
commit | 225e703a20d41def2152be864b22787b36fb9b64 (patch) | |
tree | d08520235ecc0a4090ab71fd8dd7b11e5ba8acd5 /org.eclipse.debug.tests | |
parent | 6dc3d49e11868add5f75762e02c94fc49cb21452 (diff) | |
download | eclipse.platform.debug-225e703a20d41def2152be864b22787b36fb9b64.tar.gz eclipse.platform.debug-225e703a20d41def2152be864b22787b36fb9b64.tar.xz eclipse.platform.debug-225e703a20d41def2152be864b22787b36fb9b64.zip |
Bug 550621 - [console] Improved user input handling in IOConsole.I20190930-1800I20190929-1800I20190928-1800I20190928-0515I20190928-0205I20190928-0000I20190927-1800I20190927-1530I20190927-0255I20190927-0225I20190927-0145I20190926-1800I20190926-0625
Improvements:
- if user tries to override/delete writable and read-only parts only
the writable parts are removed
- if user types in read-only part it is appended at the next possible
writable part
- if user types at border of writable part this writable part is better
reused
- if user paste content with multiple lines this his handled more
consistent with behavior when user is typing multiple lines
Change-Id: I47e4ee7493170d3537734325f0362fd6a8d7a16c
Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
Diffstat (limited to 'org.eclipse.debug.tests')
-rw-r--r-- | org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTests.java | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTests.java index 33811030e..c495892fa 100644 --- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTests.java +++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTests.java @@ -201,7 +201,11 @@ public class IOConsoleTests extends AbstractDebugTest { c.clear().insertTypingAndVerify("i").write("ooo").verifyContent("iooo").verifyPartitions(); c.enter().clear(); - closeConsole(c, "i"); + c.insertAndVerify("gnorw").write("tuo").verifyContent("gnorwtuo").verifyPartitions(2); + c.clear().insertTypingAndVerify("I").write("O").verifyContent("IO").verifyPartitions(); + c.insert("\r\n").clear(); + + closeConsole(c, "i", "I"); } /** @@ -245,8 +249,18 @@ public class IOConsoleTests extends AbstractDebugTest { assertEquals("Expected newline entered inside line does not break this line.", c.getContentLength(), c.getCaretOffset()); c.verifyPartitions().verifyContentByOffset("NewLine", pos); c.backspace().insertAndVerify("--").select(0, c.getContentLength()).insertTyping("<~>"); - c.verifyContentByLine("--<~>", 2).verifyPartitions(); - c.select(-2, 1).insertAndVerify("-=-").verifyContentByLine("--<-=->", 2).verifyPartitions(); + c.verifyContentByLine("<~>", 2).verifyPartitions(); + c.select(-2, 1).insertAndVerify("-=-").verifyContentByLine("<-=->", 2).verifyPartitions(); + + // multiline input + c.clear().insertTyping("=").insert("foo\n><"); + expectedInput.add("=foo"); + c.moveCaretToEnd().moveCaret(-1); + c.insert("abc\r\n123\n456"); + expectedInput.add(">abc<"); + expectedInput.add("123"); + c.enter().clear(); + expectedInput.add("456"); closeConsole(c, expectedInput.toArray(new String[0])); } @@ -263,7 +277,7 @@ public class IOConsoleTests extends AbstractDebugTest { c.insertTyping("~~~"); c.writeAndVerify("bar"); c.insertTyping("input."); - c.verifyContent("foo~~~barinput.").verifyPartitions(3); + c.verifyContent("foo~~~input.bar").verifyPartitions(3); c.enter().clear(); expectedInput.add("~~~input."); @@ -279,7 +293,7 @@ public class IOConsoleTests extends AbstractDebugTest { c.insert("~~p#t").select(c.getContentLength() - 5, 2).insert("in"); c.select(c.getContentLength() - 2, 1).insertTyping("u"); c.enter().clear(); - expectedInput.add("+more inputinput"); + expectedInput.add("input"); // inserted input is shorter than existing input partition c.writeAndVerify("foo"); @@ -328,6 +342,23 @@ public class IOConsoleTests extends AbstractDebugTest { c.enter().clear(); expectedInput.add("ABCabc123"); + // insert at partition borders + c.writeAndVerify("###").insertTyping("def").writeAndVerify("###"); + c.setCaretOffset(6).insertAndVerify("ghi"); + c.setCaretOffset(3).insertTypingAndVerify("abc"); + c.moveCaretToLineStart().insertTyping(":"); + c.enter().clear(); + expectedInput.add(":abcdefghi"); + + // try to overwrite read-only content + c.writeAndVerify("o\u00F6O").insertTyping("\u00EFiI").writeAndVerify("\u00D6\u00D8\u00F8"); + // line content: oöOiïIÖØø + c.verifyContent("o\u00F6O" + "\u00EFiI" + "\u00D6\u00D8\u00F8").verifyPartitions(2); + c.select(4, 4).backspace(); + c.verifyContent("o\u00F6O" + "\u00EF" + "\u00D6\u00D8\u00F8").verifyPartitions(2); + c.enter().clear(); + expectedInput.add("\u00EF"); + closeConsole(c, expectedInput.toArray(new String[0])); } |