aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2013-04-30 08:31:50 +0200
committerJoakim Verona2013-04-30 08:31:50 +0200
commit7a1bee4a713304afdf8e58f31f59d3572fa00063 (patch)
tree509b38118c25728eb2ea8ebcb2220da706d8459d /src
parent23e7d63bcc222e40e6063b6799de50544af8d70b (diff)
parent38d8527bab7f84b94d2e0a759e25a64f33838257 (diff)
downloademacs-7a1bee4a713304afdf8e58f31f59d3572fa00063.tar.gz
emacs-7a1bee4a713304afdf8e58f31f59d3572fa00063.zip
auto upstream
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog17
-rw-r--r--src/coding.c2
-rw-r--r--src/dispextern.h6
-rw-r--r--src/nsfns.m88
4 files changed, 107 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c9d458c3479..2e9e19fd547 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,20 @@
12013-04-28 Eli Zaretskii <eliz@gnu.org>
2
3 * coding.c (decode_coding_gap): Don't remove the character before
4 a newline unless it's a CR character. (Bug#14287)
5
62013-04-28 Dan Nicolaescu <dann@gnu.org>
7
8 * dispextern.h (struct face): Move enum face_underline_type
9 earlier so that bitfields can be in the same word.
10
112013-04-28 Jan Djärv <jan.h.d@swipnet.se>
12
13 * nsfns.m (handlePanelKeys): New function.
14 (EmacsOpenPanel:performKeyEquivalent:)
15 (EmacsSavePanel:performKeyEquivalent:): Call handlePanelKeys to handle
16 arrows/function/control and copy/paste keys (Bug#14296).
17
12013-04-27 Juri Linkov <juri@jurta.org> 182013-04-27 Juri Linkov <juri@jurta.org>
2 19
3 * callint.c (Fcall_interactively): Call `Qread_number' for 20 * callint.c (Fcall_interactively): Call `Qread_number' for
diff --git a/src/coding.c b/src/coding.c
index b9fb92c481b..f6664e179b7 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7774,7 +7774,7 @@ decode_coding_gap (struct coding_system *coding,
7774 while (src_beg < src) 7774 while (src_beg < src)
7775 { 7775 {
7776 *--dst = *--src; 7776 *--dst = *--src;
7777 if (*src == '\n') 7777 if (*src == '\n' && src > src_beg && src[-1] == '\r')
7778 src--; 7778 src--;
7779 } 7779 }
7780 diff = dst - src; 7780 diff = dst - src;
diff --git a/src/dispextern.h b/src/dispextern.h
index 70a5ba27b8d..45a893dcc62 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1601,13 +1601,13 @@ struct face
1601 shadow colors derived from the background color of the face. */ 1601 shadow colors derived from the background color of the face. */
1602 enum face_box_type box; 1602 enum face_box_type box;
1603 1603
1604 /* Style of underlining. */
1605 enum face_underline_type underline_type;
1606
1604 /* If `box' above specifies a 3D type, 1 means use box_color for 1607 /* If `box' above specifies a 3D type, 1 means use box_color for
1605 drawing shadows. */ 1608 drawing shadows. */
1606 unsigned use_box_color_for_shadows_p : 1; 1609 unsigned use_box_color_for_shadows_p : 1;
1607 1610
1608 /* Style of underlining. */
1609 enum face_underline_type underline_type;
1610
1611 /* Non-zero if text in this face should be underlined, overlined, 1611 /* Non-zero if text in this face should be underlined, overlined,
1612 strike-through or have a box drawn around it. */ 1612 strike-through or have a box drawn around it. */
1613 unsigned underline_p : 1; 1613 unsigned underline_p : 1;
diff --git a/src/nsfns.m b/src/nsfns.m
index a483f847dec..0d6d0e72835 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1477,7 +1477,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
1477 [panel setCanChooseFiles: YES]; 1477 [panel setCanChooseFiles: YES];
1478 } 1478 }
1479 1479
1480 block_input (); 1480 block_input ();
1481#if defined (NS_IMPL_COCOA) && \ 1481#if defined (NS_IMPL_COCOA) && \
1482 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 1482 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
1483 if (! NILP (mustmatch) || ! NILP (dir_only_p)) 1483 if (! NILP (mustmatch) || ! NILP (dir_only_p))
@@ -2544,6 +2544,75 @@ Value is t if tooltip was open, nil otherwise. */)
2544 2544
2545 ========================================================================== */ 2545 ========================================================================== */
2546 2546
2547/*
2548 Handle arrow/function/control keys and copy/paste/cut in file dialogs.
2549 Return YES if handeled, NO if not.
2550 */
2551static BOOL
2552handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent)
2553{
2554 NSString *s;
2555 int i;
2556 BOOL ret = NO;
2557
2558 if ([theEvent type] != NSKeyDown) return NO;
2559 s = [theEvent characters];
2560
2561 for (i = 0; i < [s length]; ++i)
2562 {
2563 int ch = (int) [s characterAtIndex: i];
2564 switch (ch)
2565 {
2566 case NSHomeFunctionKey:
2567 case NSDownArrowFunctionKey:
2568 case NSUpArrowFunctionKey:
2569 case NSLeftArrowFunctionKey:
2570 case NSRightArrowFunctionKey:
2571 case NSPageUpFunctionKey:
2572 case NSPageDownFunctionKey:
2573 case NSEndFunctionKey:
2574 [panel sendEvent: theEvent];
2575 ret = YES;
2576 break;
2577 /* As we don't have the standard key commands for
2578 copy/paste/cut/select-all in our edit menu, we must handle
2579 them here. TODO: handle Emacs key bindings for copy/cut/select-all
2580 here, paste works, because we have that in our Edit menu.
2581 I.e. refactor out code in nsterm.m, keyDown: to figure out the
2582 correct modifier.
2583 */
2584 case 'x': // Cut
2585 case 'c': // Copy
2586 case 'v': // Paste
2587 case 'a': // Select all
2588 if ([theEvent modifierFlags] & NSCommandKeyMask)
2589 {
2590 [NSApp sendAction:
2591 (ch == 'x'
2592 ? @selector(cut:)
2593 : (ch == 'c'
2594 ? @selector(copy:)
2595 : (ch == 'v'
2596 ? @selector(paste:)
2597 : @selector(selectAll:))))
2598 to:nil from:panel];
2599 ret = YES;
2600 }
2601 default:
2602 // Send all control keys, as the text field supports C-a, C-f, C-e
2603 // C-b and more.
2604 if ([theEvent modifierFlags] & NSControlKeyMask)
2605 {
2606 [panel sendEvent: theEvent];
2607 ret = YES;
2608 }
2609 break;
2610 }
2611 }
2612
2613
2614 return ret;
2615}
2547 2616
2548@implementation EmacsSavePanel 2617@implementation EmacsSavePanel
2549#ifdef NS_IMPL_COCOA 2618#ifdef NS_IMPL_COCOA
@@ -2572,6 +2641,14 @@ Value is t if tooltip was open, nil otherwise. */)
2572{ 2641{
2573 return ns_directory_from_panel (self); 2642 return ns_directory_from_panel (self);
2574} 2643}
2644
2645- (BOOL)performKeyEquivalent:(NSEvent *)theEvent
2646{
2647 BOOL ret = handlePanelKeys (self, theEvent);
2648 if (! ret)
2649 ret = [super performKeyEquivalent:theEvent];
2650 return ret;
2651}
2575@end 2652@end
2576 2653
2577 2654
@@ -2609,7 +2686,14 @@ Value is t if tooltip was open, nil otherwise. */)
2609{ 2686{
2610 return ns_directory_from_panel (self); 2687 return ns_directory_from_panel (self);
2611} 2688}
2612 2689- (BOOL)performKeyEquivalent:(NSEvent *)theEvent
2690{
2691 // NSOpenPanel inherits NSSavePanel, so passing self is OK.
2692 BOOL ret = handlePanelKeys (self, theEvent);
2693 if (! ret)
2694 ret = [super performKeyEquivalent:theEvent];
2695 return ret;
2696}
2613@end 2697@end
2614 2698
2615 2699