summaryrefslogtreecommitdiff
path: root/libraries/libfm/patches/0002-3582816-If-no-region-is-selected-in-editable-then-ap.patch
blob: ce7eb20b0851f3093868d28592a37f437c6ef1b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 74901d717fefaf239bf7d8b6f5b14ea146170663 Mon Sep 17 00:00:00 2001
From: Andriy Grytsenko <andrej@rep.kiev.ua>
Date: Sat, 3 Nov 2012 16:05:31 +0200
Subject: [PATCH 02/22] [#3582816]If no region is selected in editable then
 apply 'Delete' to char next to cursor.

---
 src/gtk/fm-folder-view.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/gtk/fm-folder-view.c b/src/gtk/fm-folder-view.c
index 153ed48..fe65e9f 100644
--- a/src/gtk/fm-folder-view.c
+++ b/src/gtk/fm-folder-view.c
@@ -1001,7 +1001,15 @@ static void on_trash(GtkAction* act, FmFolderView* fv)
         }
     }
     else if(GTK_IS_EDITABLE(focus)) /* fallback for editables */
+    {
+        if(!gtk_editable_get_selection_bounds((GtkEditable*)focus, NULL, NULL))
+        {
+            gint pos = gtk_editable_get_position((GtkEditable*)focus);
+            /* if no text selected then delete character next to cursor */
+            gtk_editable_select_region((GtkEditable*)focus, pos, pos + 1);
+        }
         gtk_editable_delete_selection((GtkEditable*)focus);
+    }
 }
 
 static void on_rm(GtkAction* act, FmFolderView* fv)
-- 
1.8.0.1