diff --git a/README.md b/README.md
index d78674b..36c5651 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Multi Line Terminal
-This plugin simply replaces the single line gcode input into a multi-line text area. Once installed you will have to use the Send button instead of the Enter key to send the commands to your printer.
+This plugin simply replaces the single line gcode input into a multi-line text area. Once installed you can use the Send button or shift+enter to send the gcode commands to your printer.
![screenshot](screenshot.png)
diff --git a/octoprint_multilineterminal/__init__.py b/octoprint_multilineterminal/__init__.py
index e13292a..e8a1e37 100644
--- a/octoprint_multilineterminal/__init__.py
+++ b/octoprint_multilineterminal/__init__.py
@@ -28,7 +28,7 @@ def get_update_information(self):
current=self._plugin_version,
# update method: pip
- pip="https://github.com/jneilliii/OctoPrint-MultiLineTerminal/archive/{target_version}.zip"
+ pip="https://github.com/jneilliii/OctoPrint-MultiLineTerminal/releases/download/{target_version}/{target_version}.zip"
)
)
diff --git a/octoprint_multilineterminal/static/css/multilineterminal.css b/octoprint_multilineterminal/static/css/multilineterminal.css
index feaf281..c5ae55b 100644
--- a/octoprint_multilineterminal/static/css/multilineterminal.css
+++ b/octoprint_multilineterminal/static/css/multilineterminal.css
@@ -1,12 +1,37 @@
textarea#terminal-command {
margin-bottom: 0px;
border-right: 0px;
+ -webkit-border-radius: 0px 0 0 0px;
+ -moz-border-radius: 0px 0 0 0px;
+ border-radius: 0px 0 0 0px;
+ resize: vertical;
+}
+
+a#terminal-send {
+ vertical-align: middle;
+}
+
+span#multilinehistorybuttons {
-webkit-border-radius: 4px 0 0 4px;
-moz-border-radius: 4px 0 0 4px;
border-radius: 4px 0 0 4px;
- resize: vertical;
+ padding: 0px 0px;
+ vertical-align: middle;
}
-a#terminal-send {
+span#multilinehistorybuttons > a {
+ width: 100%;
+ display: block;
+ color: black;
+ text-decoration: none;
+ cursor: pointer;
vertical-align: middle;
-}
\ No newline at end of file
+}
+
+span#multilinehistorybuttons > a:last-child {
+ padding-top: 10px;
+}
+
+span#multilinehistorybuttons > a:first-child {
+ padding-bottom: 10px;
+}
diff --git a/octoprint_multilineterminal/static/js/multilineterminal.js b/octoprint_multilineterminal/static/js/multilineterminal.js
index b549fb0..2ea8e1a 100644
--- a/octoprint_multilineterminal/static/js/multilineterminal.js
+++ b/octoprint_multilineterminal/static/js/multilineterminal.js
@@ -16,11 +16,39 @@ $(function() {
return;
}
- OctoPrint.control.sendGcode(command.split("\n"));
+ OctoPrint.control.sendGcode(command.split("\n"))
+ .done(function() {
+ self.terminalViewModel.cmdHistory.push(command);
+ self.terminalViewModel.cmdHistory.slice(-300); // just to set a sane limit to how many manually entered commands will be saved...
+ self.terminalViewModel.cmdHistoryIdx = self.terminalViewModel.cmdHistory.length;
+ self.terminalViewModel.command("");
+ });
+ };
+
+ self.terminalViewModel.getHistoryMultiLine = function(direction) {
+ if (direction == 1 || direction == -1) {
+ if (direction == 1 && self.terminalViewModel.cmdHistory.length > 0 && self.terminalViewModel.cmdHistoryIdx > 0) {
+ self.terminalViewModel.cmdHistoryIdx--;
+ } else if (direction == -1 && self.terminalViewModel.cmdHistoryIdx < self.terminalViewModel.cmdHistory.length - 1) {
+ self.terminalViewModel.cmdHistoryIdx++;
+ }
+
+ if (self.terminalViewModel.cmdHistoryIdx >= 0 && self.terminalViewModel.cmdHistoryIdx < self.terminalViewModel.cmdHistory.length) {
+ self.terminalViewModel.command(self.terminalViewModel.cmdHistory[self.terminalViewModel.cmdHistoryIdx]);
+ }
+ }
+ }
+
+ self.terminalViewModel.handleKeyUpMultiLine = function(e){
+ if (event.shiftKey && event.keyCode === 13) {
+ $('#terminal-send').trigger('click');
+ }
+ // do not prevent default action
+ return true;
};
self.onStartup = function(){
- $('#terminal-command').replaceWith('');
+ $('#terminal-command').replaceWith('').parent('div').addClass('input prepend');
$('#terminal-send').attr('data-bind','click: sendCommandMultiLine, enable: isOperational() && loginState.isUser()');
}
}
diff --git a/setup.py b/setup.py
index 77b4ccb..03d6de0 100644
--- a/setup.py
+++ b/setup.py
@@ -14,7 +14,7 @@
plugin_name = "Multi Line Terminal"
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
-plugin_version = "0.1.0"
+plugin_version = "0.1.1"
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module