texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] Patch #5494: Make selection behavior more standard con


From: Norbert Nemec
Subject: Re: [Texmacs-dev] Patch #5494: Make selection behavior more standard conformant
Date: Tue, 12 Dec 2006 18:37:16 +0100
User-agent: Thunderbird 1.5.0.8 (X11/20061115)

Hi there,

I'm sorry if my cheeky tone about emacs was offensive to anyone. I hope
this is not the reason why this message was silently ignored on this list?

I have gone over the patch again and noticed that there is a clean
alternative that should satisfy both Emacs and Windows users. Actually,
it should even improve the behavior for Emacs-lovers as well.

Find a new patch attached that supersedes the former patches. It does
two things:

1) make an active selection "volatile", i.e.: the selected text gets
unselected as soon as the cursor is moved. (unless you are in Emacs
selection mode that is initated by C-space)

This is default behavior of both Windows and XEmacs. For plain Emacs
there is no comparison, since the only selection mode is the C-space
selection, where this does not apply.

I hope this satisfies everybody?

Apart from being standard behavior, this also has the advantage that
there can never be any active selection except at the location of the
cursor. How often did it happen to you that you forgot an active
selection and accidentally deleted that instead of the character at the
cursor position?

2) A tiny change to the behavior of Backspace/Delete with an active
selection. Instead of doing a CUT operation (for which you should use
C-X), the selection is now simply DELETED keeping the clipboard content
untouched. Again, this is standard behavior for Windows. Emacs/XEmacs
behave differently, but here, current TeXmacs behavior already does not
follow the Emacs/XEmacs standard.

I believe this patch is actually rather important for everyday use of
TeXmacs especially for newcomers and people who use TeXmacs non-exclusively.

Please try the patch and give your feedback - it took me far too much
time to see it silently ignored.

Greetings,
Norbert




Norbert Nemec schrieb:
> Hi there,
>
> I just wanted to point out patch #5494 that I submitted to savannah a
> few days ago. I believe this may be worth a bit of discussion:
>
> https://savannah.gnu.org/patch/index.php?5494
>
> As it is, the patch will certainly not be liked by the emacs-fans among
> the TeXmacs users, as it changes the selection behavior - which is
> hardwired to something similar to emacs behavior - to a behavior more
> standard for modern editors. Having this configurable would be more
> advantageous. However - I did not manage to implement this configurability.
>
> Greetings,
> Norbert
>
>
> _______________________________________________
> Texmacs-dev mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/texmacs-dev
>
>
>   

Index: texmacs/src/Edit/Replace/edit_select.cpp
===================================================================
--- texmacs.orig/src/Edit/Replace/edit_select.cpp       2005-12-17 
12:10:24.000000000 +0100
+++ texmacs/src/Edit/Replace/edit_select.cpp    2006-12-12 17:47:55.000000000 
+0100
@@ -99,21 +99,31 @@
 
 void
 edit_select_rep::select_from_cursor () {
-  if (!(selecting || shift_selecting)) return;
-  if (path_less (mid_p, tp)) {
-    start_p= copy (mid_p);
-    end_p  = copy (tp);
-  }
-  else {
-    start_p= copy (tp);
-    end_p  = copy (mid_p);
+  if (selecting) {
+    if (path_less (mid_p, tp)) {
+      start_p= copy (mid_p);
+      end_p  = copy (tp);
+    } else {
+      start_p= copy (tp);
+      end_p  = copy (mid_p);
+    }
+    notify_change (THE_SELECTION);
+    if (shift_selecting) selecting = false;
   }
-  notify_change (THE_SELECTION);
 }
 
 void
 edit_select_rep::select_from_cursor_if_active () {
-  if (selecting) select_from_cursor ();
+  if (selecting) {
+    if (path_less (mid_p, tp)) {
+      start_p= copy (mid_p);
+      end_p  = copy (tp);
+    } else {
+      start_p= copy (tp);
+      end_p  = copy (mid_p);
+    }
+    notify_change (THE_SELECTION);
+  } else selection_cancel ();
 }
 
 void
@@ -129,10 +139,10 @@
   if ((!shift_selecting) || (end_p == start_p) ||
       ((tp != start_p) && (tp != end_p)))
     {
-      selecting= false;
-      shift_selecting= true;
       mid_p= copy (tp);
     }
+  selecting= true;
+  shift_selecting= true;
 }
 
 /******************************************************************************
Index: TeXmacs/progs/generic/generic-edit.scm
===================================================================
--- texmacs.orig/TeXmacs/progs/generic/generic-edit.scm 2006-12-12 
17:50:25.000000000 +0100
+++ texmacs/TeXmacs/progs/generic/generic-edit.scm      2006-12-12 
17:51:11.000000000 +0100
@@ -41,7 +41,8 @@
 (tm-define (kbd-remove forward?) (remove-text forward?))
 (tm-define (kbd-remove forward?)
   (:mode with-active-selection?)
-  (clipboard-cut "primary"))
+  (clipboard-cut "nowhere")
+  (clipboard-clear "nowhere"))
 
 (tm-define (kbd-tab)
   (if (not (complete-try?))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]