Author Topic: Python tab/backtab in diff editor [PATCH]  (Read 766 times)

Dennis

  • Senior Community Member
  • Posts: 3965
  • Hero Points: 517
Python tab/backtab in diff editor [PATCH]
« on: March 15, 2024, 09:08:04 PM »
Code: [Select]
diff -urN /opt/slickedit-pro2023-v2801/macros/diffedit.e ~/.slickedit/28.0.1/diffedit.e
--- /opt/slickedit-pro2023-v2801/macros/diffedit.e 2024-01-23 10:31:44.867577788 -0500
+++ ~/.slickedit/28.0.1/diffedit.e 2024-03-15 17:02:28.606699943 -0400
@@ -59,6 +59,7 @@
 #import "pmatch.e"
 #import "project.e"
 #import "projutil.e"
+#import "python.e"
 #import "recmacro.e"
 #import "saveload.e"
 #import "search.e"
@@ -117,7 +118,9 @@
 static void diff_copy_to_clipboard();
 static void diff_copy_word();
 static void diff_move_text_tab();
+static void diff_move_text_backtab();
 static void diff_ctab();
+static void diff_python_tab();
 static void diff_cut_end_line();
 static void diff_cut_word();
 static void diff_delete_word();
@@ -327,10 +330,11 @@
    "mou-extend-selection"      => { true, diff_mou_extend_selection },
    "mou-select-word"           => { true, diff_mou_select_word },
    "mou-select-line"           => { true, diff_mou_select_line },
-   "move-text-tab"             => { false, diff_move_text_tab },
    "vi-move-text-tab"          => { false, diff_move_text_tab },
    "move-text-tab"             => { false, diff_move_text_tab },
+   "move-text-backtab"         => { false, diff_move_text_backtab },
    "ctab"                      => { false, diff_ctab },
+   "python-tab"                => { false, diff_python_tab },
    "cbacktab"                  => { false, diff_cbacktab },
    "brief-tab"                 => { false, diff_move_text_tab },
    "smarttab"                  => { false, diff_ctab },
@@ -4941,6 +4945,25 @@
    AddUndoNothing(otherwid);
 }
 
+static void diff_move_text_backtab()
+{
+   wid := p_window_id;
+   if (NoSaveLine(p_line)) {
+      _beep();
+      return;
+   }
+   otherwid := 0;
+   if (wid==_ctlfile1) {
+      otherwid=_ctlfile2;
+   }else{
+      otherwid=_ctlfile1;
+   }
+   _ctlfile1._undo('S');
+   _ctlfile2._undo('S');
+   wid.move_text_backtab();
+   AddUndoNothing(otherwid);
+}
+
 static void diff_ctab()
 {
    otherwid := 0;
@@ -4956,6 +4979,22 @@
    AddUndoNothing(otherwid);
    otherwid.p_col=wid.p_col;
 }
+
+static void diff_python_tab()
+{
+   otherwid := 0;
+   wid := p_window_id;
+   if (wid==_ctlfile1) {
+      otherwid=_ctlfile2;
+   }else{
+      otherwid=_ctlfile1;
+   }
+   _ctlfile1._undo('S');
+   _ctlfile2._undo('S');
+   wid.python_tab();
+   AddUndoNothing(otherwid);
+   otherwid.p_col=wid.p_col;
+}
 
 static void diff_cbacktab()
 {

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6877
  • Hero Points: 530
Re: Python tab/backtab in diff editor [PATCH]
« Reply #1 on: March 16, 2024, 12:31:43 AM »
Thanks. We will add this to our hot fixes