From 2a91a0b5c0d208696fc327373bc4d37fd376c59c Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Thu, 2 Dec 2010 08:12:54 +0100 Subject: Handle negative top/left in frame parameters (Bug#7510). * src/nsterm.h (FRAME_NS_TOOLBAR_HEIGHT): Rename to FRAME_TOOLBAR_HEIGHT. * src/nsterm.m (x_set_window_size, windowWillResize, initFrameFromEmacs): Use FRAME_TOOLBAR_HEIGHT. (x_set_offset): Handle XNegative and YNegative in f->size_hint_flags. --- src/ChangeLog | 9 +++++++++ src/nsterm.h | 2 +- src/nsterm.m | 43 +++++++++++++++++++++++++++++-------------- 3 files changed, 39 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 45aed177ef2..025161cc395 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2010-12-02 Jan Djärv + + * nsterm.h (FRAME_NS_TOOLBAR_HEIGHT): Rename to FRAME_TOOLBAR_HEIGHT. + + * nsterm.m (x_set_window_size, windowWillResize, initFrameFromEmacs): + Use FRAME_TOOLBAR_HEIGHT. + (x_set_offset): Handle XNegative and YNegative in + f->size_hint_flags (Bug#7510). + 2010-11-25 Kenichi Handa * charset.c (emacs_mule_charset): Make it an array of charset ID; diff --git a/src/nsterm.h b/src/nsterm.h index 01086e63b69..5b24eb6f289 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -606,7 +606,7 @@ struct x_output #define NS_FACE_FOREGROUND(f) ((f)->foreground) #define NS_FACE_BACKGROUND(f) ((f)->background) #define FRAME_NS_TITLEBAR_HEIGHT(f) ((f)->output_data.ns->titlebar_height) -#define FRAME_NS_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height) +#define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height) #define FONT_WIDTH(f) ((f)->max_width) #define FONT_HEIGHT(f) ((f)->height) diff --git a/src/nsterm.m b/src/nsterm.m index d1b984d5382..43e53cb30e7 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1082,16 +1082,31 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_grav) f->left_pos = xoff; f->top_pos = yoff; + + if (view != nil && (screen = [[view window] screen])) + { + f->left_pos = f->size_hint_flags & XNegative + ? [screen visibleFrame].size.width + f->left_pos - FRAME_PIXEL_WIDTH (f) + : f->left_pos; + /* We use visibleFrame here to take menu bar into account. + Ideally we should also adjust left/top with visibleFrame.offset. */ + + f->top_pos = f->size_hint_flags & YNegative + ? ([screen visibleFrame].size.height + f->top_pos + - FRAME_PIXEL_HEIGHT (f) - FRAME_NS_TITLEBAR_HEIGHT (f) + - FRAME_TOOLBAR_HEIGHT (f)) + : f->top_pos; #ifdef NS_IMPL_GNUSTEP - if (xoff < 100) - f->left_pos = 100; /* don't overlap menu */ + if (f->left_pos < 100) + f->left_pos = 100; /* don't overlap menu */ #endif + [[view window] setFrameTopLeftPoint: + NSMakePoint (SCREENMAXBOUND (f->left_pos), + SCREENMAXBOUND ([screen frame].size.height + - NS_TOP_POS (f)))]; + f->size_hint_flags &= ~(XNegative|YNegative); + } - if (view != nil && (screen = [[view window] screen])) - [[view window] setFrameTopLeftPoint: - NSMakePoint (SCREENMAXBOUND (f->left_pos), - SCREENMAXBOUND ([screen frame].size.height - - NS_TOP_POS (f)))]; UNBLOCK_INPUT; } @@ -1148,15 +1163,15 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows) /* NOTE: previously this would generate wrong result if toolbar not yet displayed and fixing toolbar_height=32 helped, but now (200903) seems no longer needed */ - FRAME_NS_TOOLBAR_HEIGHT (f) = + FRAME_TOOLBAR_HEIGHT (f) = NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) - FRAME_NS_TITLEBAR_HEIGHT (f); else - FRAME_NS_TOOLBAR_HEIGHT (f) = 0; + FRAME_TOOLBAR_HEIGHT (f) = 0; wr.size.width = pixelwidth + f->border_width; wr.size.height = pixelheight + FRAME_NS_TITLEBAR_HEIGHT (f) - + FRAME_NS_TOOLBAR_HEIGHT (f); + + FRAME_TOOLBAR_HEIGHT (f); /* constrain to screen if we can */ if (screen) @@ -4897,16 +4912,16 @@ ns_term_shutdown (int sig) rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, frameSize.height #ifdef NS_IMPL_GNUSTEP - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + 3 - - FRAME_NS_TOOLBAR_HEIGHT (emacsframe)); + - FRAME_TOOLBAR_HEIGHT (emacsframe)); #else - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) - - FRAME_NS_TOOLBAR_HEIGHT (emacsframe)); + - FRAME_TOOLBAR_HEIGHT (emacsframe)); #endif if (rows < MINHEIGHT) rows = MINHEIGHT; frameSize.height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (emacsframe, rows) + FRAME_NS_TITLEBAR_HEIGHT (emacsframe) - + FRAME_NS_TOOLBAR_HEIGHT (emacsframe); + + FRAME_TOOLBAR_HEIGHT (emacsframe); #ifdef NS_IMPL_COCOA { /* this sets window title to have size in it; the wm does this under GS */ @@ -5117,7 +5132,7 @@ ns_term_shutdown (int sig) [toggleButton setTarget: self]; [toggleButton setAction: @selector (toggleToolbar: )]; #endif - FRAME_NS_TOOLBAR_HEIGHT (f) = 0; + FRAME_TOOLBAR_HEIGHT (f) = 0; tem = f->icon_name; if (!NILP (tem)) -- cgit v1.2.1 From 77f1ed6cb665b06fc1cdd4e2707932f0b499d481 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 4 Dec 2010 19:32:32 -0500 Subject: Avoid infloop when scrolling conservatively (Bug#7537). * src/xdisp.c (try_scrolling): Avoid infloop if the first line is obscured due to a vscroll (Bug#7537). --- src/ChangeLog | 5 +++++ src/xdisp.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 025161cc395..95f7039eaf7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-12-05 Chong Yidong + + * xdisp.c (try_scrolling): Avoid infloop if the first line is + obscured due to a vscroll (Bug#7537). + 2010-12-02 Jan Djärv * nsterm.h (FRAME_NS_TOOLBAR_HEIGHT): Rename to FRAME_TOOLBAR_HEIGHT. diff --git a/src/xdisp.c b/src/xdisp.c index a416c8ff435..dbe3e443c67 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12759,7 +12759,11 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, /* If cursor ends up on a partially visible line, treat that as being off the bottom of the screen. */ - if (! cursor_row_fully_visible_p (w, extra_scroll_margin_lines <= 1, 0)) + if (! cursor_row_fully_visible_p (w, extra_scroll_margin_lines <= 1, 0) + /* It's possible that the cursor is on the first line of the + buffer, which is partially obscured due to a vscroll + (Bug#7537). In that case, avoid looping forever . */ + && extra_scroll_margin_lines < w->desired_matrix->nrows - 1) { clear_glyph_matrix (w->desired_matrix); ++extra_scroll_margin_lines; -- cgit v1.2.1 From a56d164e67624f351b2b89a340fa212f8c5b8efd Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Sun, 5 Dec 2010 11:33:48 +0100 Subject: Fix for 7412 (no cursor on image) backported from trunk. * nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background with cursor color and draw a rectangle around the image. --- src/ChangeLog | 5 +++++ src/nsterm.m | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 95f7039eaf7..d10b5d194a9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-12-05 Jan Djärv + + * nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background + with cursor color and draw a rectangle around the image (Bug#7412). + 2010-12-05 Chong Yidong * xdisp.c (try_scrolling): Avoid infloop if the first line is diff --git a/src/nsterm.m b/src/nsterm.m index 43e53cb30e7..38376e4eb08 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2753,7 +2753,10 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) else face = FACE_FROM_ID (s->f, s->first_glyph->face_id); - [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set]; + if (s->hl == DRAW_CURSOR) + [FRAME_CURSOR_COLOR (s->f) set]; + else + [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set]; if (bg_height > s->slice.height || s->img->hmargin || s->img->vmargin || s->img->mask || s->img->pixmap == 0 || s->width != s->background_width) @@ -2816,6 +2819,16 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) s->slice.x == 0, s->slice.x + s->slice.width == s->img->width, s); } + + /* If there is no mask, the background won't be seen, + so draw a rectangle on the image for the cursor. + Do this for all images, getting trancparency right is not reliable. */ + if (s->hl == DRAW_CURSOR) + { + int thickness = abs (s->img->relief); + if (thickness == 0) thickness = 1; + ns_draw_box (br, thickness, FRAME_CURSOR_COLOR (s->f), 1, 1); + } } -- cgit v1.2.1 From d8b2a96214c9b53ab914901fdde71f5b0a931678 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 6 Dec 2010 01:54:52 -0500 Subject: Fix crash with invisible text and overlays (Bug#7016). * src/dispextern.h (struct it): New member overlay_strings_charpos. * src/xdisp.c (next_overlay_string, load_overlay_strings): Record the charpos where we computed n_overlay_strings. (next_overlay_string): Load overlay strings at recorded position, which may not be the same as the iterator's charpos (Bug#7016). --- src/ChangeLog | 9 +++++++++ src/dispextern.h | 6 ++++++ src/xdisp.c | 10 +++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d10b5d194a9..3293ec08da5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2010-12-06 Chong Yidong + + * dispextern.h (struct it): New member overlay_strings_charpos. + + * xdisp.c (next_overlay_string, load_overlay_strings): Record the + charpos where we computed n_overlay_strings. + (next_overlay_string): Load overlay strings at recorded position, + which may not be the same as the iterator's charpos (Bug#7016). + 2010-12-05 Jan Djärv * nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background diff --git a/src/dispextern.h b/src/dispextern.h index bc34aec2dd5..b43565739ea 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1989,6 +1989,12 @@ struct it OVERLAY_STRING_CHUNK_SIZE. */ int n_overlay_strings; + /* The charpos where n_overlay_strings was calculated. This should + be set at the same time as n_overlay_strings. It is needed + because we show before-strings at the start of invisible text; + see handle_invisible_prop in xdisp.c. */ + int overlay_strings_charpos; + /* Vector of overlays to process. Overlay strings are processed OVERLAY_STRING_CHUNK_SIZE at a time. */ #define OVERLAY_STRING_CHUNK_SIZE 16 diff --git a/src/xdisp.c b/src/xdisp.c index dbe3e443c67..161e2b1cc4d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4717,6 +4717,7 @@ next_overlay_string (it) && it->stop_charpos <= it->end_charpos)); it->current.overlay_string_index = -1; it->n_overlay_strings = 0; + it->overlay_strings_charpos = -1; /* If we're at the end of the buffer, record that we have processed the overlay strings there already, so that @@ -4729,11 +4730,13 @@ next_overlay_string (it) /* There are more overlay strings to process. If IT->current.overlay_string_index has advanced to a position where we must load IT->overlay_strings with more strings, do - it. */ + it. We must load at the IT->overlay_strings_charpos where + IT->n_overlay_strings was originally computed; when invisible + text is present, this might not be IT_CHARPOS (Bug#7016). */ int i = it->current.overlay_string_index % OVERLAY_STRING_CHUNK_SIZE; if (it->current.overlay_string_index && i == 0) - load_overlay_strings (it, 0); + load_overlay_strings (it, it->overlay_strings_charpos); /* Initialize IT to deliver display elements from the overlay string. */ @@ -4949,8 +4952,9 @@ load_overlay_strings (it, charpos) if (n > 1) qsort (entries, n, sizeof *entries, compare_overlay_entries); - /* Record the total number of strings to process. */ + /* Record number of overlay strings, and where we computed it. */ it->n_overlay_strings = n; + it->overlay_strings_charpos = charpos; /* IT->current.overlay_string_index is the number of overlay strings that have already been consumed by IT. Copy some of the -- cgit v1.2.1 From 2b815743b24c79ae63863bd0f0ffcaf822d400a1 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Tue, 7 Dec 2010 07:36:25 +0100 Subject: * xsmfns.c (smc_die_CB): Call Fkill_emacs. Fixes: debbugs:7552 --- src/ChangeLog | 4 ++++ src/xsmfns.c | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3293ec08da5..9a92697b52d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-12-07 Jan Djärv + + * xsmfns.c (smc_die_CB): Call Fkill_emacs (Bug#7552). + 2010-12-06 Chong Yidong * dispextern.h (struct it): New member overlay_strings_charpos. diff --git a/src/xsmfns.c b/src/xsmfns.c index ec5ca3b1a9f..f6260d00a56 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -298,6 +298,10 @@ smc_die_CB (smcConn, clientData) SmcConn smcConn; SmPointer clientData; { + /* This may behave badly if desktop.el tries to ask questions. */ + Fkill_emacs (Qnil); + + /* This will not be reached, but we want kill-emacs-hook to be run. */ SmcCloseConnection (smcConn, 0, 0); ice_connection_closed (); } -- cgit v1.2.1 From 0b9fc69a7651c4a36ab4616f5f7d1c2f48fed783 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Fri, 10 Dec 2010 19:23:43 +0100 Subject: Move call to Fkill_emacs from signal handler (session event) (Bug#7552). * keyboard.c (kbd_buffer_get_event): Construct SAVE_SESSION_EVENT as (Qsave_session arg). * xsmfns.c (smc_interact_CB): Set arg to Qnil. (smc_die_CB): Make an event with arg Qt. (Fhandle_save_session): If event has Qt as argument, call Fkill_emacs. --- src/ChangeLog | 10 ++++++++++ src/keyboard.c | 2 +- src/xsmfns.c | 25 ++++++++++++++++++------- 3 files changed, 29 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9a92697b52d..af944c32ebd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2010-12-10 Jan Djärv + + * keyboard.c (kbd_buffer_get_event): Construct SAVE_SESSION_EVENT + as (Qsave_session arg). + + * xsmfns.c (smc_interact_CB): Set arg to Qnil. + (smc_die_CB): Make an event with arg Qt. + (Fhandle_save_session): If event has Qt as argument, + call Fkill_emacs (Bug#7552). + 2010-12-07 Jan Djärv * xsmfns.c (smc_die_CB): Call Fkill_emacs (Bug#7552). diff --git a/src/keyboard.c b/src/keyboard.c index b35e4ae84e2..b027b3b09e6 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -4305,7 +4305,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) #endif else if (event->kind == SAVE_SESSION_EVENT) { - obj = Fcons (Qsave_session, Qnil); + obj = Fcons (Qsave_session, Fcons (event->arg, Qnil)); kbd_fetch_ptr = event + 1; } /* Just discard these, by returning nil. diff --git a/src/xsmfns.c b/src/xsmfns.c index f6260d00a56..8a16f68b255 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -172,6 +172,7 @@ smc_interact_CB (smcConn, clientData) { doing_interact = True; emacs_event.kind = SAVE_SESSION_EVENT; + emacs_event.arg = Qnil; } /* This is called when the session manager tells us to save ourselves. @@ -298,12 +299,8 @@ smc_die_CB (smcConn, clientData) SmcConn smcConn; SmPointer clientData; { - /* This may behave badly if desktop.el tries to ask questions. */ - Fkill_emacs (Qnil); - - /* This will not be reached, but we want kill-emacs-hook to be run. */ - SmcCloseConnection (smcConn, 0, 0); - ice_connection_closed (); + emacs_event.kind = SAVE_SESSION_EVENT; + emacs_event.arg = Qt; } /* We don't use the next two but they are mandatory, leave them empty. @@ -540,9 +537,12 @@ Do not call this function yourself. */) (event) Lisp_Object event; { + int kill_emacs = CONSP (event) && CONSP (XCDR (event)) + && EQ (Qt, XCAR (XCDR (event))); + /* Check doing_interact so that we don't do anything if someone called this at the wrong time. */ - if (doing_interact) + if (doing_interact && ! kill_emacs) { Bool cancel_shutdown = False; @@ -553,9 +553,20 @@ Do not call this function yourself. */) doing_interact = False; } + else if (kill_emacs) + { + /* We should not do user interaction here, but it is not easy to + prevent. Fix this in next version. */ + Fkill_emacs (Qnil); + /* This will not be reached, but we want kill-emacs-hook to be run. */ + SmcCloseConnection (smc_conn, 0, 0); + ice_connection_closed (); + } + return Qnil; } + /*********************************************************************** -- cgit v1.2.1 From f055902693167478ad9affe03bb9398b6140b070 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 11 Dec 2010 14:27:13 +0200 Subject: Code cleanup in xdisp.c regarding string_char_and_length. xdisp.c (string_pos_nchars_ahead, c_string_pos) (face_before_or_after_it_pos, next_element_from_string) (next_element_from_c_string, produce_stretch_glyph): Remove unused calculations of maximum string length before calling string_char_and_length and STRING_CHAR_AND_LENGTH. (string_char_and_length): Update commentary: MAXLEN is no longer needed. --- src/ChangeLog | 10 ++++++++++ src/xdisp.c | 35 +++++++++-------------------------- 2 files changed, 19 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index af944c32ebd..f2604606982 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2010-12-11 Eli Zaretskii + + * xdisp.c (string_pos_nchars_ahead, c_string_pos) + (face_before_or_after_it_pos, next_element_from_string) + (next_element_from_c_string, produce_stretch_glyph): Remove unused + calculations of maximum string length before calling + string_char_and_length and STRING_CHAR_AND_LENGTH. + (string_char_and_length): Update commentary: MAXLEN is no longer + needed. + 2010-12-10 Jan Djärv * keyboard.c (kbd_buffer_get_event): Construct SAVE_SESSION_EVENT diff --git a/src/xdisp.c b/src/xdisp.c index 161e2b1cc4d..d3afac26a68 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1454,11 +1454,10 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos) } -/* Return the next character from STR which is MAXLEN bytes long. - Return in *LEN the length of the character. This is like - STRING_CHAR_AND_LENGTH but never returns an invalid character. If - we find one, we return a `?', but with the length of the invalid - character. */ +/* Return the next character from STR. Return in *LEN the length of + the character. This is like STRING_CHAR_AND_LENGTH but never + returns an invalid character. If we find one, we return a `?', but + with the length of the invalid character. */ static INLINE int string_char_and_length (str, len) @@ -1492,15 +1491,13 @@ string_pos_nchars_ahead (pos, string, nchars) if (STRING_MULTIBYTE (string)) { - int rest = SBYTES (string) - BYTEPOS (pos); const unsigned char *p = SDATA (string) + BYTEPOS (pos); int len; while (nchars--) { string_char_and_length (p, &len); - p += len, rest -= len; - xassert (rest >= 0); + p += len; CHARPOS (pos) += 1; BYTEPOS (pos) += len; } @@ -1545,14 +1542,13 @@ c_string_pos (charpos, s, multibyte_p) if (multibyte_p) { - int rest = strlen (s), len; + int len; SET_TEXT_POS (pos, 0, 0); while (charpos--) { string_char_and_length (s, &len); - s += len, rest -= len; - xassert (rest >= 0); + s += len; CHARPOS (pos) += 1; BYTEPOS (pos) += len; } @@ -3614,7 +3610,6 @@ face_before_or_after_it_pos (it, before_p) if (STRING_MULTIBYTE (it->string)) { const unsigned char *p = SDATA (it->string) + BYTEPOS (pos); - int rest = SBYTES (it->string) - BYTEPOS (pos); int c, len; struct face *face = FACE_FROM_ID (it->f, face_id); @@ -6264,7 +6259,6 @@ next_element_from_string (it) } else if (STRING_MULTIBYTE (it->string)) { - int remaining = SBYTES (it->string) - IT_STRING_BYTEPOS (*it); const unsigned char *s = (SDATA (it->string) + IT_STRING_BYTEPOS (*it)); it->c = string_char_and_length (s, &it->len); @@ -6300,7 +6294,6 @@ next_element_from_string (it) } else if (STRING_MULTIBYTE (it->string)) { - int maxlen = SBYTES (it->string) - IT_STRING_BYTEPOS (*it); const unsigned char *s = (SDATA (it->string) + IT_STRING_BYTEPOS (*it)); it->c = string_char_and_length (s, &it->len); @@ -6354,13 +6347,7 @@ next_element_from_c_string (it) BYTEPOS (it->position) = CHARPOS (it->position) = -1; } else if (it->multibyte_p) - { - /* Implementation note: The calls to strlen apparently aren't a - performance problem because there is no noticeable performance - difference between Emacs running in unibyte or multibyte mode. */ - int maxlen = strlen (it->s) - IT_BYTEPOS (*it); - it->c = string_char_and_length (it->s + IT_BYTEPOS (*it), &it->len); - } + it->c = string_char_and_length (it->s + IT_BYTEPOS (*it), &it->len); else it->c = it->s[IT_BYTEPOS (*it)], it->len = 1; @@ -20917,11 +20904,7 @@ produce_stretch_glyph (it) it2 = *it; if (it->multibyte_p) - { - int maxlen = ((IT_BYTEPOS (*it) >= GPT ? ZV : GPT) - - IT_BYTEPOS (*it)); - it2.c = it2.char_to_display = STRING_CHAR_AND_LENGTH (p, it2.len); - } + it2.c = it2.char_to_display = STRING_CHAR_AND_LENGTH (p, it2.len); else { it2.c = it2.char_to_display = *p, it2.len = 1; -- cgit v1.2.1 From 76feb8641e5870c73b649a6e986b5d8d8936a61f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 11 Dec 2010 17:20:11 +0200 Subject: Fix bug #7398 with truncated glyphs in tooltip display on w32. w32fns.c (Fx_show_tip): Call try_window with last argument TRY_WINDOW_IGNORE_FONTS_CHANGE. Delete the TODO ifdef: problem solved. Round up the tip height to an integral multiple of the frame's line height. Add FRAME_COLUMN_WIDTH to the tip width. --- src/ChangeLog | 6 ++++++ src/w32fns.c | 23 ++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index f2604606982..249e77d3aa3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2010-12-11 Eli Zaretskii + * w32fns.c (Fx_show_tip): Call try_window with last argument + TRY_WINDOW_IGNORE_FONTS_CHANGE. Delete the TODO ifdef: problem + solved. Round up the tip height to an integral multiple of the + frame's line height. Add FRAME_COLUMN_WIDTH to the tip width. + (Bug#7398) + * xdisp.c (string_pos_nchars_ahead, c_string_pos) (face_before_or_after_it_pos, next_element_from_string) (next_element_from_c_string, produce_stretch_glyph): Remove unused diff --git a/src/w32fns.c b/src/w32fns.c index 61dd8b9ee1f..39fa6918e62 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -5892,7 +5892,7 @@ Text larger than the specified size is clipped. */) clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); SET_TEXT_POS (pos, BEGV, BEGV_BYTE); - try_window (FRAME_ROOT_WINDOW (f), pos, 0); + try_window (FRAME_ROOT_WINDOW (f), pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); /* Compute width and height of the tooltip. */ width = height = 0; @@ -5909,9 +5909,7 @@ Text larger than the specified size is clipped. */) /* Let the row go over the full width of the frame. */ row->full_width_p = 1; -#ifdef TODO /* Investigate why some fonts need more width than is - calculated for some tooltips. */ - /* There's a glyph at the end of rows that is use to place + /* There's a glyph at the end of rows that is used to place the cursor there. Don't include the width of this glyph. */ if (row->used[TEXT_AREA]) { @@ -5919,15 +5917,16 @@ Text larger than the specified size is clipped. */) row_width = row->pixel_width - last->pixel_width; } else -#endif row_width = row->pixel_width; - /* TODO: find why tips do not draw along baseline as instructed. */ height += row->height; width = max (width, row_width); } - /* Add the frame's internal border to the width and height the X + /* Round up the height to an integral multiple of FRAME_LINE_HEIGHT. */ + if (height % FRAME_LINE_HEIGHT (f) != 0) + height += FRAME_LINE_HEIGHT (f) - height % FRAME_LINE_HEIGHT (f); + /* Add the frame's internal border to the width and height the w32 window should have. */ height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); width += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); @@ -5946,11 +5945,13 @@ Text larger than the specified size is clipped. */) FRAME_EXTERNAL_MENU_BAR (f)); /* Position and size tooltip, and put it in the topmost group. - The add-on of 3 to the 5th argument is a kludge: without it, - some fonts cause the last character of the tip to be truncated, - for some obscure reason. */ + The add-on of FRAME_COLUMN_WIDTH to the 5th argument is a + peculiarity of w32 display: without it, some fonts cause the + last character of the tip to be truncated or wrapped around to + the next line. */ SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOPMOST, - root_x, root_y, rect.right - rect.left + 3, + root_x, root_y, + rect.right - rect.left + FRAME_COLUMN_WIDTH (f), rect.bottom - rect.top, SWP_NOACTIVATE); /* Ensure tooltip is on top of other topmost windows (eg menus). */ -- cgit v1.2.1 From 15579471891efd210b5d9edd29c1374cba98f648 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 12 Dec 2010 22:37:54 +0200 Subject: Document that expand-file-name collapses multiple slashes. (Bug#7617) fileio.c (Fexpand_file_name): Doc fix. --- src/ChangeLog | 4 ++++ src/fileio.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 249e77d3aa3..97401ffe40a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-12-12 Eli Zaretskii + + * fileio.c (Fexpand_file_name): Doc fix. (Bug#7617) + 2010-12-11 Eli Zaretskii * w32fns.c (Fx_show_tip): Call try_window with last argument diff --git a/src/fileio.c b/src/fileio.c index 440a726b26b..e330f724142 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -832,6 +832,9 @@ File name components that are `.' are removed, and so are file name components followed by `..', along with the `..' itself; note that these simplifications are done without checking the resulting file names in the file system. +Multiple consecutive slashes are collapsed into a single slash, +except at the beginning of the file name when they are significant (e.g., +UNC file names on MS-Windows.) An initial `~/' expands to your home directory. An initial `~USER/' expands to USER's home directory. See also the function `substitute-in-file-name'. @@ -839,7 +842,7 @@ See also the function `substitute-in-file-name'. For technical reasons, this function can return correct but non-intuitive results for the root directory; for instance, \(expand-file-name ".." "/") returns "/..". For this reason, use -(directory-file-name (file-name-directory dirname)) to traverse a +\(directory-file-name (file-name-directory dirname)) to traverse a filesystem tree, not (expand-file-name ".." dirname). */) (name, default_directory) Lisp_Object name, default_directory; -- cgit v1.2.1