This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 603817f64f5 CAMEL-21945: camel-jbang fix help prompts in edit plugin 
(#17786)
603817f64f5 is described below

commit 603817f64f5e02812eb89b9abb8f6804a841ae05
Author: John Poth <poth.j...@gmail.com>
AuthorDate: Thu Apr 17 19:06:30 2025 +0200

    CAMEL-21945: camel-jbang fix help prompts in edit plugin (#17786)
---
 .../core/commands/edit/CamelNanoLspEditor.java     | 16 ++---
 .../dsl/jbang/core/commands/edit/edit-help.txt     | 81 ++++++++++++++++++++++
 2 files changed, 89 insertions(+), 8 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-edit/src/main/java/org/apache/camel/dsl/jbang/core/commands/edit/CamelNanoLspEditor.java
 
b/dsl/camel-jbang/camel-jbang-plugin-edit/src/main/java/org/apache/camel/dsl/jbang/core/commands/edit/CamelNanoLspEditor.java
index 58f7be261ea..31e11c5cd87 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-edit/src/main/java/org/apache/camel/dsl/jbang/core/commands/edit/CamelNanoLspEditor.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-edit/src/main/java/org/apache/camel/dsl/jbang/core/commands/edit/CamelNanoLspEditor.java
@@ -1950,7 +1950,7 @@ public class CamelNanoLspEditor implements Editor {
                         buffer.nextSearch();
                         break;
                     case HELP:
-                        help("nano-main-help.txt");
+                        help("edit-help.txt");
                         break;
                     case CONSTANT_CURSOR:
                         constantCursor();
@@ -2107,7 +2107,7 @@ public class CamelNanoLspEditor implements Editor {
                     }
                     return false;
                 case HELP:
-                    help("nano-write-help.txt");
+                    help("/org/jline/builtins/nano-write-help.txt");
                     break;
                 case MAC_FORMAT:
                     buffer.format = (buffer.format == WriteFormat.MAC) ? 
WriteFormat.UNIX : WriteFormat.MAC;
@@ -2340,7 +2340,7 @@ public class CamelNanoLspEditor implements Editor {
                     this.shortcuts = standardShortcuts();
                     return;
                 case HELP:
-                    help("nano-read-help.txt");
+                    help("/org/jline/builtins/nano-read-help.txt");
                     break;
                 case NEW_BUFFER:
                     readNewBuffer = !readNewBuffer;
@@ -2431,7 +2431,7 @@ public class CamelNanoLspEditor implements Editor {
                     this.shortcuts = standardShortcuts();
                     return;
                 case HELP:
-                    help("nano-goto-help.txt");
+                    help("/org/jline/builtins/nano-goto-help.txt");
                     break;
                 default:
                     curPos = editInputBuffer(op, curPos);
@@ -2550,7 +2550,7 @@ public class CamelNanoLspEditor implements Editor {
 
     void help(String help) {
         Buffer org = this.buffer;
-        Buffer newBuf = new Buffer(null);
+        Buffer newBuf = new Buffer("");
         try (InputStream is = getClass().getResourceAsStream(help)) {
             newBuf.open(is);
         } catch (IOException e) {
@@ -2761,9 +2761,9 @@ public class CamelNanoLspEditor implements Editor {
                         return;
                     case HELP:
                         if (searchToReplace) {
-                            help("nano-search-replace-help.txt");
+                            
help("/org/jline/builtins/nano-search-replace-help.txt");
                         } else {
-                            help("nano-search-help.txt");
+                            help("/org/jline/builtins/nano-search-help.txt");
                         }
                         break;
                     case FIRST_LINE:
@@ -2844,7 +2844,7 @@ public class CamelNanoLspEditor implements Editor {
                         patternHistory.add(replaceTerm);
                         return replaceTerm;
                     case HELP:
-                        help("nano-replace-help.txt");
+                        help("/org/jline/builtins/nano-replace-help.txt");
                         break;
                     case FIRST_LINE:
                         buffer.firstLine();
diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-edit/src/main/resources/org/apache/camel/dsl/jbang/core/commands/edit/edit-help.txt
 
b/dsl/camel-jbang/camel-jbang-plugin-edit/src/main/resources/org/apache/camel/dsl/jbang/core/commands/edit/edit-help.txt
new file mode 100644
index 00000000000..a6422df1bf7
--- /dev/null
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-edit/src/main/resources/org/apache/camel/dsl/jbang/core/commands/edit/edit-help.txt
@@ -0,0 +1,81 @@
+
+Camel JBang editor help
+
+ The Camel JBang editor adds Camel suggestions (^Space) and diagnostics to 
JLine's Nano editor. This is done through 
https://github.com/camel-tooling/camel-language-server.  There are four main 
sections of the editor.  The top line shows the program version, the current 
filename being edited, and whether or not the file has been modified.  Next is 
the main editor window showing the file being edited.  The status line is the 
third line from the bottom and shows important messages.  The bo [...]
+
+ The notation for shortcuts is as follows: Control-key sequences are notated 
with a caret (^) symbol and can be entered either by using the Control (Ctrl) 
key or pressing the Escape (Esc) key twice.  Escape-key sequences are notated 
with the Meta (M-) symbol and can be entered using either the Esc, Alt, or Meta 
key depending on your keyboard setup.  Also, pressing Esc twice and then typing 
a three-digit decimal number from 000 to 255 will enter the character with the 
corresponding value. [...]
+
+^G      (F1)            Display this help text
+^X      (F2)            Close the current window / Exit from nano
+^O      (F3)            Write the current file to disk
+^J      (F4)            Justify the current paragraph
+
+^R      (F5)            Insert another file into the current one
+^W      (F6)            Search for a string or a regular expression
+^Y      (F7)            Move to the previous screen
+^V      (F8)            Move to the next screen
+
+^K      (F9)            Cut the current line and store it in the cutbuffer
+^U      (F10)           Uncut from the cutbuffer into the current line
+^C      (F11)           Display the position of the cursor
+^T      (F12)           Invoke the spell checker, if available
+
+^_      (F13)   (M-G)   Go to line and column number
+        (F14)   (M-R)   Replace a string or a regular expression
+^^      (F15)   (M-A)   Mark text at the cursor position
+        (F16)   (M-W)   Repeat last search
+
+M-^             (M-6)   Copy the current line and store it in the cutbuffer
+M-}                     Indent the current line
+M-{                     Unindent the current line
+
+^F      (Right)         Move forward one character
+^B      (Left)          Move back one character
+^Space                  Show Camel suggestions if any
+
+^P      (Up)            Move to the previous line
+^N      (Down)          Move to the next line
+
+^A      (Home)          Move to the beginning of the current line
+^E      (End)           Move to the end of the current line
+M-(             (M-9)   Move to the beginning of the current paragraph
+M-)             (M-0)   Move to the end of the current paragraph
+M-\             (M-|)   Move to the first line of the file
+M-/             (M-?)   Move to the last line of the file
+
+M-]                     Move to the matching bracket
+M--             (M-_)   Scroll up one line without scrolling the cursor
+M-+             (M-=)   Scroll down one line without scrolling the cursor
+
+M-<             (M-,)   Switch to the previous file buffer
+M->             (M-.)   Switch to the next file buffer
+
+M-V                     Insert the next keystroke verbatim
+^I                      Insert a tab at the cursor position
+^M                      Insert a newline at the cursor position
+^D                      Delete the character under the cursor
+^H                      Delete the character to the left of the cursor
+M-T                     Cut from the cursor position to the end of the file
+
+M-J                     Justify the entire file
+M-D                     Count the number of words, lines, and characters
+^L                      Refresh (redraw) the current screen
+
+M-X                     Help mode enable/disable
+M-C                     Constant cursor position display enable/disable
+M-O                     Use of one more line for editing enable/disable
+M-S                     Smooth scrolling enable/disable
+M-P                     Whitespace display enable/disable
+M-Y                     Color syntax highlighting enable/disable
+
+M-H                     Smart home key enable/disable
+M-I                     Auto indent enable/disable
+M-K                     Cut to end enable/disable
+M-L                     Long line wrapping enable/disable
+M-Q                     Conversion of typed tabs to spaces enable/disable
+
+M-B                     Backup files enable/disable
+M-F                     Multiple file buffers enable/disable
+M-M                     Mouse support enable/disable
+M-N                     Line numbers enable/disable
+M-Z                     Suspension enable/disable
\ No newline at end of file

Reply via email to