From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: tab widths with a remapped default face Date: Fri, 06 Jun 2008 01:19:55 -0400 Message-ID: <6163snp2bo.fsf@fencepost.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1212729727 9187 80.91.229.12 (6 Jun 2008 05:22:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Jun 2008 05:22:07 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 06 07:22:50 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K4UPZ-00064J-9e for ged-emacs-devel@m.gmane.org; Fri, 06 Jun 2008 07:22:49 +0200 Original-Received: from localhost ([127.0.0.1]:52281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K4UOm-00011T-C4 for ged-emacs-devel@m.gmane.org; Fri, 06 Jun 2008 01:22:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K4UOe-00010M-P0 for emacs-devel@gnu.org; Fri, 06 Jun 2008 01:21:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K4UOd-000102-Bd for emacs-devel@gnu.org; Fri, 06 Jun 2008 01:21:52 -0400 Original-Received: from [199.232.76.173] (port=52689 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K4UOd-0000zw-3Y for emacs-devel@gnu.org; Fri, 06 Jun 2008 01:21:51 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:44542) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K4UOc-0006wo-RP for emacs-devel@gnu.org; Fri, 06 Jun 2008 01:21:50 -0400 Original-Received: from miles by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1K4UMl-00025D-6e; Fri, 06 Jun 2008 01:19:55 -0400 System-Type: x86_64-unknown-linux-gnu Blat: Foop X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:98491 Archived-At: The following patch seems to fix the bad tab rendering when the default face is altered using face remapping. Any objections? It will also change the way tabs are computed for explicit faces (and other implicit faces such as the region), but I think it's probably usually the right thing to do for those cases too. Thanks, -Miles --- orig/src/xdisp.c +++ mod/src/xdisp.c @@ -21125,14 +21125,14 @@ } else if (it->char_to_display == '\t') { - int tab_width = it->tab_width * FRAME_SPACE_WIDTH (it->f); + int tab_width = it->tab_width * font->space_width; int x = it->current_x + it->continuation_lines_width; int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; /* If the distance from the current position to the next tab stop is less than a space character width, use the tab stop after that. */ - if (next_tab_x - x < FRAME_SPACE_WIDTH (it->f)) + if (next_tab_x - x < font->space_width) next_tab_x += tab_width; it->pixel_width = next_tab_x - x; -- Year, n. A period of three hundred and sixty-five disappointments.