forward/backward word, hide mouse when typing
[fanfix.git] / src / jexer / TEditorWidget.java
index 94f1a3be545b2a401f8e32d2920faf3268c5fc1a..0f8f7715d8bf30d632c133d721b4e96a579ca4bb 100644 (file)
@@ -3,7 +3,7 @@
  *
  * The MIT License (MIT)
  *
- * Copyright (C) 2017 Kevin Lamonte
+ * Copyright (C) 2019 Kevin Lamonte
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -207,6 +207,16 @@ public class TEditorWidget extends TWidget {
         } else if (keypress.equals(kbRight)) {
             document.right();
             alignTopLine(true);
+        } else if (keypress.equals(kbAltLeft)
+            || keypress.equals(kbCtrlLeft)
+        ) {
+            document.backwardsWord();
+            alignTopLine(false);
+        } else if (keypress.equals(kbAltRight)
+            || keypress.equals(kbCtrlRight)
+        ) {
+            document.forwardsWord();
+            alignTopLine(true);
         } else if (keypress.equals(kbUp)) {
             document.up();
             alignTopLine(false);
@@ -247,7 +257,9 @@ public class TEditorWidget extends TWidget {
         } else if (keypress.equals(kbDel)) {
             document.del();
             alignCursor();
-        } else if (keypress.equals(kbBackspace)) {
+        } else if (keypress.equals(kbBackspace)
+            || keypress.equals(kbBackspaceDel)
+        ) {
             document.backspace();
             alignTopLine(false);
         } else if (keypress.equals(kbTab)) {
@@ -265,6 +277,7 @@ public class TEditorWidget extends TWidget {
             && !keypress.getKey().isCtrl()
         ) {
             // Plain old keystroke, process it
+            // TODO: fix document to use ints, not chars
             document.addChar(keypress.getKey().getChar());
             alignCursor();
         } else {